/* ============================================
   World App Data API - Frontend Styles
   ============================================ */

:root {
  /* Colors */
  --primary: #3b82f6;
  --primary-dark: #2563eb;
  --primary-light: #60a5fa;
  --secondary: #8b5cf6;
  --accent: #10b981;
  --background: #0f172a;
  --background-light: #1e293b;
  --surface: #334155;
  --text: #f8fafc;
  --text-muted: #94a3b8;
  --border: #475569;
  --success: #22c55e;
  --warning: #f59e0b;
  --error: #ef4444;

  /* Typography */
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;

  /* Spacing */
  --container-max: 1200px;
  --section-padding: 6rem 0;
}

/* Reset & Base */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-sans);
  background: var(--background);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}

a {
  color: var(--primary-light);
  text-decoration: none;
  transition: color 0.2s;
}

a:hover {
  color: var(--primary);
}

/* Container */
.container {
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 0 1.5rem;
}

/* ============================================
   Navigation
   ============================================ */
.navbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  background: rgba(15, 23, 42, 0.9);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
  z-index: 1000;
}

.nav-container {
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 1rem 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.nav-logo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-weight: 700;
  font-size: 1.25rem;
  color: var(--text);
}

.logo-icon {
  font-size: 1.5rem;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 2rem;
}

.nav-links a {
  color: var(--text-muted);
  font-weight: 500;
  transition: color 0.2s;
}

.nav-links a:hover {
  color: var(--text);
}

.nav-cta {
  background: var(--primary);
  color: var(--text) !important;
  padding: 0.5rem 1.25rem;
  border-radius: 0.5rem;
  font-weight: 600;
  transition: background 0.2s;
}

.nav-cta:hover {
  background: var(--primary-dark);
}

/* ============================================
   Hero Section
   ============================================ */
.hero {
  padding: 10rem 1.5rem 6rem;
  max-width: var(--container-max);
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4rem;
  align-items: center;
}

.hero-badge {
  display: inline-block;
  background: rgba(59, 130, 246, 0.15);
  color: var(--primary-light);
  padding: 0.5rem 1rem;
  border-radius: 2rem;
  font-size: 0.875rem;
  font-weight: 600;
  margin-bottom: 1.5rem;
}

.hero h1 {
  font-size: 3.5rem;
  font-weight: 800;
  line-height: 1.1;
  margin-bottom: 1.5rem;
  background: linear-gradient(135deg, var(--text) 0%, var(--primary-light) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero-subtitle {
  font-size: 1.25rem;
  color: var(--text-muted);
  margin-bottom: 2rem;
}

.highlight {
  color: var(--primary-light);
  font-weight: 600;
}

.hero-actions {
  display: flex;
  gap: 1rem;
  margin-bottom: 3rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.875rem 1.75rem;
  border-radius: 0.5rem;
  font-weight: 600;
  font-size: 1rem;
  transition: all 0.2s;
  border: none;
  cursor: pointer;
}

.btn-primary {
  background: var(--primary);
  color: var(--text);
}

.btn-primary:hover {
  background: var(--primary-dark);
  transform: translateY(-2px);
}

.btn-secondary {
  background: var(--background-light);
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-secondary:hover {
  background: var(--surface);
  border-color: var(--primary);
}

.hero-stats {
  display: flex;
  gap: 3rem;
}

.stat {
  display: flex;
  flex-direction: column;
}

.stat-value {
  font-size: 2rem;
  font-weight: 700;
  color: var(--primary-light);
}

.stat-label {
  color: var(--text-muted);
  font-size: 0.875rem;
}

/* Code Preview */
.hero-code {
  background: var(--background-light);
  border-radius: 1rem;
  border: 1px solid var(--border);
  overflow: hidden;
}

.code-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 1rem 1.5rem;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.code-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
}

.code-dot.red { background: #ef4444; }
.code-dot.yellow { background: #f59e0b; }
.code-dot.green { background: #22c55e; }

.code-title {
  margin-left: auto;
  color: var(--text-muted);
  font-size: 0.875rem;
}

.hero-code pre {
  padding: 1.5rem;
  margin: 0;
  overflow-x: auto;
}

.hero-code code {
  font-family: var(--font-mono);
  font-size: 0.9rem;
  line-height: 1.8;
}

/* Syntax Highlighting */
.code-comment { color: #6b7280; }
.code-keyword { color: #c084fc; }
.code-string { color: #34d399; }
.code-function { color: #60a5fa; }
.code-number { color: #fbbf24; }

/* ============================================
   Features Section
   ============================================ */
.features {
  padding: var(--section-padding);
  background: var(--background-light);
}

.section-title {
  text-align: center;
  font-size: 2.5rem;
  font-weight: 700;
  margin-bottom: 4rem;
}

.features-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2rem;
}

.feature-card {
  background: var(--background);
  padding: 2rem;
  border-radius: 1rem;
  border: 1px solid var(--border);
  transition: all 0.3s;
}

.feature-card:hover {
  border-color: var(--primary);
  transform: translateY(-4px);
}

.feature-icon {
  font-size: 2.5rem;
  margin-bottom: 1rem;
}

.feature-card h3 {
  font-size: 1.25rem;
  margin-bottom: 0.75rem;
}

.feature-card p {
  color: var(--text-muted);
}

/* ============================================
   Quick Start Section
   ============================================ */
.quick-start {
  padding: var(--section-padding);
}

.quick-start-content {
  max-width: 800px;
  margin: 0 auto;
}

.step {
  display: flex;
  gap: 2rem;
  margin-bottom: 2rem;
  align-items: flex-start;
}

.step-number {
  flex-shrink: 0;
  width: 48px;
  height: 48px;
  background: var(--primary);
  color: var(--text);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1.25rem;
}

.step-content h3 {
  margin-bottom: 0.5rem;
}

.step-content p {
  color: var(--text-muted);
}

.code-block {
  background: var(--background-light);
  padding: 1rem 1.5rem;
  border-radius: 0.5rem;
  margin-top: 0.75rem;
  font-family: var(--font-mono);
  font-size: 0.9rem;
  border: 1px solid var(--border);
  overflow-x: auto;
}

/* ============================================
   Endpoints Section
   ============================================ */
.endpoints {
  padding: var(--section-padding);
  background: var(--background-light);
}

.section-subtitle {
  text-align: center;
  color: var(--text-muted);
  margin-top: -2rem;
  margin-bottom: 3rem;
  font-size: 1.1rem;
}

.endpoints-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2rem;
  margin-bottom: 3rem;
}

.endpoint-group {
  background: var(--background);
  padding: 1.5rem;
  border-radius: 1rem;
  border: 1px solid var(--border);
}

.endpoint-group.featured {
  border-color: var(--primary);
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.1) 0%, var(--background) 100%);
}

.endpoint-group h3 {
  margin-bottom: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border);
}

.endpoint-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.6rem 0;
  border-bottom: 1px solid rgba(71, 85, 105, 0.3);
}

.endpoint-row:last-child {
  border-bottom: none;
}

.endpoint-row .ep-label {
  color: var(--text);
  font-size: 0.9rem;
  font-weight: 500;
}

.endpoint-row code {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--primary-light);
  background: rgba(59, 130, 246, 0.1);
  padding: 0.25rem 0.5rem;
  border-radius: 0.25rem;
}

/* Fields Reference */
.fields-reference {
  background: var(--background);
  padding: 2rem;
  border-radius: 1rem;
  border: 1px solid var(--border);
  margin-bottom: 2rem;
  text-align: center;
}

.fields-reference h3 {
  margin-bottom: 1.5rem;
}

.fields-list {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
}

.field-tag {
  background: var(--surface);
  padding: 0.4rem 0.8rem;
  border-radius: 2rem;
  font-size: 0.8rem;
  font-family: var(--font-mono);
  color: var(--text-muted);
  border: 1px solid var(--border);
}

.field-tag.popular {
  background: rgba(59, 130, 246, 0.2);
  border-color: var(--primary);
  color: var(--primary-light);
}

.fields-usage {
  color: var(--text-muted);
  font-size: 0.9rem;
}

.fields-usage code {
  font-family: var(--font-mono);
  color: var(--accent);
}

.endpoint {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1rem;
  font-size: 0.875rem;
}

.endpoint:last-child {
  margin-bottom: 0;
}

.method {
  padding: 0.25rem 0.5rem;
  border-radius: 0.25rem;
  font-weight: 600;
  font-size: 0.75rem;
  text-transform: uppercase;
}

.method.get {
  background: rgba(34, 197, 94, 0.2);
  color: var(--success);
}

.endpoint code {
  font-family: var(--font-mono);
  color: var(--text);
  font-size: 0.8rem;
}

.endpoint .desc {
  color: var(--text-muted);
  flex-basis: 100%;
  padding-left: 3.5rem;
}

.endpoints-cta {
  text-align: center;
}

/* ============================================
   Examples Section
   ============================================ */
.examples {
  padding: var(--section-padding);
}

.examples-tabs {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
  max-width: 800px;
  margin-left: auto;
  margin-right: auto;
}

.tab-btn {
  flex: 1;
  padding: 0.75rem 1.5rem;
  background: var(--background-light);
  border: 1px solid var(--border);
  color: var(--text-muted);
  border-radius: 0.5rem;
  cursor: pointer;
  font-weight: 500;
  transition: all 0.2s;
}

.tab-btn:hover {
  border-color: var(--primary);
  color: var(--text);
}

.tab-btn.active {
  background: var(--primary);
  border-color: var(--primary);
  color: var(--text);
}

.examples-content {
  max-width: 800px;
  margin: 0 auto;
}

.tab-content {
  display: none;
  background: var(--background-light);
  border-radius: 1rem;
  border: 1px solid var(--border);
  overflow: hidden;
}

.tab-content.active {
  display: block;
}

.tab-content pre {
  padding: 2rem;
  margin: 0;
  overflow-x: auto;
}

.tab-content code {
  font-family: var(--font-mono);
  font-size: 0.9rem;
  line-height: 1.8;
}

/* ============================================
   Live Demo Section
   ============================================ */
.live-demo {
  padding: var(--section-padding);
  background: var(--background-light);
}

.demo-card {
  max-width: 900px;
  margin: 0 auto;
  background: var(--background);
  border-radius: 1rem;
  border: 1px solid var(--border);
  overflow: hidden;
}

.demo-input-group {
  display: flex;
  gap: 1rem;
  align-items: center;
  padding: 1.5rem;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}

.demo-input-group label {
  font-weight: 500;
}

.demo-input-group select {
  flex: 1;
  min-width: 200px;
  padding: 0.75rem 1rem;
  background: var(--background);
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 0.9rem;
  cursor: pointer;
}

.demo-input-group select:focus {
  outline: none;
  border-color: var(--primary);
}

.demo-result {
  padding: 1.5rem;
}

.demo-url {
  font-family: var(--font-mono);
  font-size: 0.875rem;
  color: var(--text-muted);
  padding: 0.75rem 1rem;
  background: var(--surface);
  border-radius: 0.5rem;
  margin-bottom: 1rem;
  word-break: break-all;
}

.demo-result pre {
  background: var(--background-light);
  padding: 1.5rem;
  border-radius: 0.5rem;
  border: 1px solid var(--border);
  overflow-x: auto;
  max-height: 400px;
}

.demo-result code {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  line-height: 1.6;
}

/* ============================================
   Footer
   ============================================ */
.footer {
  padding: 4rem 0 2rem;
  border-top: 1px solid var(--border);
}

.footer-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
}

.footer-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-weight: 700;
  font-size: 1.125rem;
}

.footer-links {
  display: flex;
  gap: 2rem;
}

.footer-links a {
  color: var(--text-muted);
}

.footer-links a:hover {
  color: var(--text);
}

.footer-bottom {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.875rem;
}

.footer-note {
  margin-top: 0.5rem;
  font-size: 0.75rem;
  opacity: 0.7;
}

/* ============================================
   Responsive Design
   ============================================ */
@media (max-width: 1024px) {
  .hero {
    grid-template-columns: 1fr;
    text-align: center;
    padding-top: 8rem;
  }

  .hero-actions {
    justify-content: center;
  }

  .hero-stats {
    justify-content: center;
  }

  .hero-code {
    max-width: 600px;
    margin: 0 auto;
  }

  .features-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .endpoints-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .nav-links {
    display: none;
  }

  .hero h1 {
    font-size: 2.5rem;
  }

  .hero-subtitle {
    font-size: 1rem;
  }

  .features-grid {
    grid-template-columns: 1fr;
  }

  .hero-actions {
    flex-direction: column;
  }

  .btn {
    width: 100%;
    justify-content: center;
  }

  .hero-stats {
    flex-direction: column;
    gap: 1.5rem;
  }

  .step {
    flex-direction: column;
    gap: 1rem;
  }

  .endpoint .desc {
    padding-left: 0;
  }

  .footer-content {
    flex-direction: column;
    gap: 1.5rem;
  }

  .demo-input-group {
    flex-direction: column;
    align-items: stretch;
  }

  .examples-tabs {
    flex-direction: column;
  }
}
