:root {
  --primary-color: #2563eb;
  --primary-hover: #1d4ed8;
  --success-color: #10b981;
  --error-color: #ef4444;
  --bg-color: #ffffff;
  --text-color: #1f2937;
  --border-color: #e5e7eb;
  --code-bg: #f9fafb;
  --header-bg: #1e293b;
  --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
    'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
    sans-serif;
  line-height: 1.6;
  color: var(--text-color);
  background-color: var(--bg-color);
}

.build-badge {
  position: fixed;
  top: 1rem;
  right: 1rem;
  padding: 0.5rem 0.75rem;
  border-radius: 9999px;
  background: rgba(30, 41, 59, 0.9);
  color: #f8fafc;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  box-shadow: var(--shadow);
  z-index: 10000;
  pointer-events: none;
}

@media (max-width: 640px) {
  .build-badge {
    font-size: 0.7rem;
    top: 0.75rem;
    right: 0.75rem;
  }
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}

/* Header */
header {
  background: var(--header-bg);
  color: white;
  padding: 2rem 0;
  margin-bottom: 2rem;
  box-shadow: var(--shadow);
}

header h1 {
  font-size: 2.5rem;
  margin-bottom: 0.5rem;
  font-weight: 700;
}

.tagline {
  font-size: 1.25rem;
  opacity: 0.9;
  margin-bottom: 1rem;
}

.links {
  display: flex;
  gap: 1rem;
}

.links a {
  color: white;
  text-decoration: none;
  padding: 0.5rem 1rem;
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 4px;
  transition: background 0.2s;
}

.links a:hover {
  background: rgba(255, 255, 255, 0.1);
}

/* Main Content */
main {
  padding: 2rem 0 4rem;
}

section {
  margin-bottom: 3rem;
}

h2 {
  font-size: 2rem;
  margin-bottom: 1rem;
  color: var(--header-bg);
}

h3 {
  font-size: 1.5rem;
  margin-bottom: 1rem;
  color: var(--header-bg);
}

h4 {
  font-size: 1.25rem;
  margin: 1.5rem 0 0.75rem;
  color: var(--header-bg);
}

p {
  margin-bottom: 1rem;
}

a {
  color: var(--primary-color);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

code {
  font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', 'Consolas', 'source-code-pro', monospace;
  font-size: 0.9em;
  background: var(--code-bg);
  padding: 0.2em 0.4em;
  border-radius: 3px;
  border: 1px solid var(--border-color);
}

/* Example Sections */
.example {
  background: white;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 2rem;
  box-shadow: var(--shadow);
}

.intro {
  background: #eff6ff;
  border: 2px solid var(--primary-color);
  border-radius: 8px;
  padding: 2rem;
  margin-bottom: 2rem;
}

/* Code Blocks */
.code-block {
  margin: 1.5rem 0;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  overflow: hidden;
}

.code-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--code-bg);
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border-color);
}

.code-header span {
  font-weight: 600;
  color: #6b7280;
  font-size: 0.875rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.run-btn {
  background: var(--primary-color);
  color: white;
  border: none;
  padding: 0.5rem 1rem;
  border-radius: 4px;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.875rem;
  transition: background 0.2s;
}

.run-btn:hover {
  background: var(--primary-hover);
}

.run-btn:disabled {
  background: #9ca3af;
  cursor: not-allowed;
}

pre {
  margin: 0;
  padding: 1.5rem;
  overflow-x: auto;
  background: var(--code-bg);
}

pre code {
  background: none;
  border: none;
  padding: 0;
  font-size: 0.875rem;
  line-height: 1.7;
  display: block;
}

/* Demo Area */
.demo-area {
  margin-top: 1.5rem;
  padding: 1.5rem;
  background: #f9fafb;
  border: 1px solid var(--border-color);
  border-radius: 6px;
}

.file-info {
  margin-bottom: 1rem;
  padding: 0.75rem 1rem;
  background: white;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  font-size: 0.875rem;
}

.api-config {
  margin-bottom: 1.5rem;
  padding: 1rem;
  background: white;
  border: 1px solid var(--border-color);
  border-radius: 4px;
}

.api-config label {
  display: block;
  margin-bottom: 0.75rem;
  font-weight: 500;
  color: var(--text-color);
}

.api-input {
  width: 100%;
  padding: 0.5rem;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  font-size: 0.9rem;
  margin-top: 0.25rem;
  font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
}

.api-input:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.config-note {
  margin-top: 1rem;
  padding: 0.75rem;
  background: #fffbeb;
  border: 1px solid #fbbf24;
  border-radius: 4px;
  font-size: 0.875rem;
  color: #92400e;
}

/* Result Area */
.result {
  padding: 1rem;
  background: white;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  min-height: 60px;
  font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
  font-size: 0.875rem;
}

.result.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  color: #6b7280;
}

.result.success {
  border-color: var(--success-color);
  background: #f0fdf4;
}

.result.error {
  border-color: var(--error-color);
  background: #fef2f2;
  color: var(--error-color);
}

.result pre {
  margin: 0;
  padding: 0;
  background: none;
  white-space: pre-wrap;
  word-wrap: break-word;
}

.result-title {
  font-weight: 600;
  font-size: 1rem;
  margin-bottom: 0.5rem;
  color: var(--text-color);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', sans-serif;
}

.result-field {
  margin: 0.5rem 0;
  color: var(--text-color);
}

.result-field strong {
  color: #4b5563;
}

.result-images {
  margin-top: 1rem;
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
}

.result-image {
  max-width: 200px;
  border-radius: 4px;
  border: 1px solid var(--border-color);
}

/* Footer */
footer {
  background: var(--code-bg);
  border-top: 1px solid var(--border-color);
  padding: 2rem 0;
  margin-top: 4rem;
  text-align: center;
  color: #6b7280;
}

/* Responsive */
@media (max-width: 768px) {
  header h1 {
    font-size: 2rem;
  }

  .tagline {
    font-size: 1rem;
  }

  .example {
    padding: 1.5rem;
  }

  .code-header {
    flex-direction: column;
    gap: 0.5rem;
    align-items: flex-start;
  }

  .run-btn {
    width: 100%;
  }
}

/* Loading spinner */
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.spinner {
  display: inline-block;
  width: 1rem;
  height: 1rem;
  border: 2px solid #e5e7eb;
  border-top-color: var(--primary-color);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  margin-right: 0.5rem;
}
