/* =============================================
   ScenarioQ — Design System
   Theme: Black · Blue · Orange
   ============================================= */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800;900&display=swap');

:root {
  /* Core Palette */
  --bg:          #060a12;
  --bg-deep:     #040810;
  --panel:       #0c1322;
  --panel-soft:  #111b30;
  --panel-hover: #142040;
  --text:        #eaf0ff;
  --text-soft:   #cad5ee;
  --muted:       #7b8db5;

  /* Brand Colors */
  --blue:        #3b82f6;
  --blue-soft:   #60a5fa;
  --blue-dim:    rgba(59, 130, 246, 0.15);
  --orange:      #f97316;
  --orange-soft: #fb923c;
  --orange-dim:  rgba(249, 115, 22, 0.15);
  --purple:      #8b5cf6;

  /* Semantic */
  --accent:      var(--blue);
  --accent-soft: var(--blue-soft);
  --success:     #22c55e;
  --danger:      #ef4444;
  --border:      rgba(59, 130, 246, 0.12);
  --border-soft: rgba(255, 255, 255, 0.06);

  /* Geometry */
  --radius:      16px;
  --radius-sm:   10px;
  --radius-xs:   6px;
  --shadow:      0 20px 50px rgba(0, 0, 0, 0.4);
  --shadow-glow: 0 0 60px rgba(59, 130, 246, 0.08);

  /* Spacing */
  --space-1: 0.5rem;
  --space-2: 0.75rem;
  --space-3: 1rem;
  --space-4: 1.5rem;
  --space-5: 2rem;
  --space-6: 3rem;
  --space-7: 4.5rem;
  --space-8: 6rem;

  /* Typography */
  --font: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
}

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

html {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
}

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

a { color: inherit; text-decoration: none; }
img { max-width: 100%; height: auto; }

.container {
  width: min(1200px, 92vw);
  margin: 0 auto;
}

/* ─── Header ─── */
.app-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(6, 10, 18, 0.82);
  backdrop-filter: blur(20px) saturate(1.4);
  -webkit-backdrop-filter: blur(20px) saturate(1.4);
  border-bottom: 1px solid var(--border);
  transition: background 0.3s ease;
}

.nav-shell {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 72px;
  gap: var(--space-3);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-weight: 800;
  font-size: 1.1rem;
  text-decoration: none;
}

.brand-logo {
  height: 36px;
  width: auto;
  border-radius: 8px;
  object-fit: contain;
}

.brand-text {
  background: linear-gradient(135deg, #fff 0%, var(--blue-soft) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  font-weight: 800;
}

/* Legacy dot fallback */
.brand-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: linear-gradient(130deg, var(--blue), var(--orange));
  box-shadow: 0 0 16px rgba(59, 130, 246, 0.6);
  display: none;
}

.top-nav {
  display: flex;
  gap: var(--space-1);
}

.top-nav a {
  padding: 0.5rem 0.85rem;
  color: var(--muted);
  border-radius: var(--radius-sm);
  font-weight: 500;
  font-size: 0.92rem;
  transition: all 0.2s ease;
  position: relative;
}

.top-nav a.active {
  color: var(--text);
  background: var(--blue-dim);
}

.top-nav a.active::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 50%;
  transform: translateX(-50%);
  width: 20px;
  height: 2px;
  background: var(--blue);
  border-radius: 2px;
}

.top-nav a:hover:not(.active) {
  color: var(--text);
  background: rgba(255, 255, 255, 0.05);
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

/* ─── Hero Section ─── */
.home-main {
  padding: 0 0 var(--space-8);
}

.page-main {
  padding: var(--space-6) 0 var(--space-8);
}

.hero {
  position: relative;
  padding: var(--space-8) 0 var(--space-7);
  overflow: hidden;
}

/* Animated background blobs */
.hero::before,
.hero::after {
  content: '';
  position: absolute;
  border-radius: 50%;
  filter: blur(120px);
  z-index: 0;
  pointer-events: none;
  animation: float 8s ease-in-out infinite;
}

.hero::before {
  width: 600px;
  height: 600px;
  background: radial-gradient(circle, rgba(59, 130, 246, 0.18), transparent 70%);
  top: -200px;
  right: -100px;
}

.hero::after {
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, rgba(249, 115, 22, 0.12), transparent 70%);
  bottom: -200px;
  left: -100px;
  animation-delay: -4s;
}

@keyframes float {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(30px, -20px) scale(1.05); }
}

.hero-grid {
  display: grid;
  grid-template-columns: 1.35fr 1fr;
  gap: var(--space-6);
  align-items: center;
  position: relative;
  z-index: 1;
}

.hero-copy {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--orange);
  padding: 0.4rem 0.8rem;
  background: var(--orange-dim);
  border: 1px solid rgba(249, 115, 22, 0.25);
  border-radius: 999px;
  width: fit-content;
}

.hero-copy h1 {
  font-size: clamp(2.2rem, 4.5vw, 3.6rem);
  font-weight: 900;
  line-height: 1.08;
  letter-spacing: -0.03em;
  background: linear-gradient(135deg, #ffffff 0%, #e0e8ff 40%, var(--blue-soft) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero-copy > p {
  color: var(--muted);
  font-size: 1.1rem;
  line-height: 1.65;
  max-width: 520px;
}

.hero-cta-row {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-top: var(--space-2);
  flex-wrap: wrap;
}

/* Hero stats strip */
.hero-stats {
  display: flex;
  gap: var(--space-5);
  margin-top: var(--space-4);
  padding-top: var(--space-4);
  border-top: 1px solid var(--border);
}

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

.hero-stat-value {
  font-size: 1.6rem;
  font-weight: 800;
  background: linear-gradient(135deg, var(--blue), var(--orange));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero-stat-label {
  font-size: 0.8rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

/* Hero feature panel */
.hero-panel {
  padding: var(--space-5);
  background: linear-gradient(170deg, rgba(12, 19, 34, 0.9), rgba(6, 10, 18, 0.95));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow), var(--shadow-glow);
  position: relative;
  overflow: hidden;
}

.hero-panel::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--blue), var(--orange), var(--purple));
}

.hero-panel h3 {
  margin: 0 0 var(--space-3);
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text);
}

.hero-panel ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.hero-panel li {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: 0.7rem 0.9rem;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm);
  color: var(--text-soft);
  font-size: 0.92rem;
  transition: all 0.2s ease;
}

.hero-panel li:hover {
  background: rgba(59, 130, 246, 0.08);
  border-color: rgba(59, 130, 246, 0.2);
  transform: translateX(4px);
}

.hero-panel li::before {
  content: '⚡';
  font-size: 1rem;
}

/* ─── Section Cards ─── */
.section-block {
  margin-top: var(--space-7);
}

.section-heading-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  margin-bottom: var(--space-4);
}

.section-heading-row h2 {
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.section-heading-row input {
  width: min(340px, 100%);
  background: var(--panel);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: var(--radius-sm);
  padding: 0.7rem 1rem;
  font-family: var(--font);
  font-size: 0.9rem;
  transition: all 0.2s ease;
}

.section-heading-row input:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 3px var(--blue-dim);
}

.section-heading-row input::placeholder {
  color: var(--muted);
  opacity: 0.6;
}

.sections-grid,
.topics-grid,
.mode-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: var(--space-3);
}

/* Universal card style */
.section-card,
.topic-card,
.mode-card,
.page-title-card,
.state-card,
.question-card,
.question-navigator,
.practice-header-card,
.scenario-panel,
.skeleton-card {
  background: linear-gradient(170deg, var(--panel-soft), var(--panel));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  transition: all 0.3s ease;
}

.section-card:hover,
.topic-card:hover,
.mode-card:hover:not(.disabled) {
  border-color: rgba(59, 130, 246, 0.3);
  transform: translateY(-3px);
  box-shadow: var(--shadow), 0 0 40px rgba(59, 130, 246, 0.06);
}

.section-card,
.topic-card,
.mode-card {
  padding: var(--space-4);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.topic-pill-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.topic-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: var(--blue-dim);
  border: 1px solid rgba(59, 130, 246, 0.2);
  border-radius: 999px;
  padding: 0.35rem 0.7rem;
  font-size: 0.83rem;
  font-weight: 500;
  transition: all 0.2s ease;
}

.topic-pill:hover {
  background: rgba(59, 130, 246, 0.25);
  border-color: rgba(59, 130, 246, 0.4);
}

.topic-pill small {
  color: var(--muted);
  font-weight: 600;
}

.page-title-card {
  padding: var(--space-4);
  margin-bottom: var(--space-4);
}

.topic-stats {
  display: flex;
  gap: var(--space-3);
  color: var(--muted);
}

.mode-card.disabled {
  opacity: 0.6;
  pointer-events: none;
}

/* ─── Buttons ─── */
.btn {
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  padding: 0.72rem 1.2rem;
  cursor: pointer;
  font-weight: 600;
  font-family: var(--font);
  font-size: 0.92rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  text-decoration: none;
}

.btn:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
}

.btn-primary {
  color: #fff;
  background: linear-gradient(135deg, var(--blue) 0%, #2563eb 100%);
  box-shadow: 0 8px 24px rgba(59, 130, 246, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 32px rgba(59, 130, 246, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.15);
}

.btn-orange {
  color: #fff;
  background: linear-gradient(135deg, var(--orange), #ea580c);
  box-shadow: 0 8px 24px rgba(249, 115, 22, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.btn-orange:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 32px rgba(249, 115, 22, 0.4);
}

.btn-secondary {
  color: var(--text);
  background: var(--panel-soft);
  border-color: var(--border);
}

.btn-secondary:hover {
  background: var(--panel-hover);
  border-color: rgba(59, 130, 246, 0.3);
  transform: translateY(-1px);
}

.btn-ghost {
  color: var(--text-soft);
  background: transparent;
  border-color: var(--border);
}

.btn-ghost:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.15);
}

.btn-sm {
  padding: 0.4rem 0.75rem;
  font-size: 0.83rem;
  border-radius: 8px;
}

/* ─── User Pill ─── */
.user-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.3rem 0.75rem 0.3rem 0.35rem;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  font-size: 0.85rem;
  color: var(--text);
}

.user-avatar {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--blue), var(--orange));
  color: #fff;
  font-weight: 700;
  font-size: 0.75rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.user-name {
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ─── Badges ─── */
.badge {
  display: inline-flex;
  border-radius: 999px;
  padding: 0.22rem 0.65rem;
  font-size: 0.76rem;
  font-weight: 600;
  text-transform: capitalize;
}

.badge-easy {
  background: rgba(34, 197, 94, 0.15);
  color: #86efac;
}

.badge-medium {
  background: rgba(249, 115, 22, 0.15);
  color: var(--orange-soft);
}

.badge-hard {
  background: rgba(239, 68, 68, 0.15);
  color: #fca5a5;
}

/* ─── State Cards ─── */
.state-card {
  padding: var(--space-4);
  text-align: center;
}

.state-card.error {
  border-color: rgba(239, 68, 68, 0.4);
}

/* ─── Skeleton Loader ─── */
.skeleton-card {
  height: 220px;
  position: relative;
  overflow: hidden;
}

.skeleton-card::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(59, 130, 246, 0.08), transparent);
  transform: translateX(-100%);
  animation: shimmer 1.6s ease infinite;
}

@keyframes shimmer {
  to { transform: translateX(100%); }
}

/* ─── Footer ─── */
.app-footer {
  margin-top: auto;
  background: var(--panel);
  border-top: 1px solid var(--border);
  position: relative;
  overflow: hidden;
}

.app-footer::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--blue), var(--orange), transparent);
}

.footer-inner {
  padding: var(--space-7) 0 var(--space-5);
}

.footer-grid {
  display: grid;
  grid-template-columns: 1.5fr 1fr 1fr 1fr;
  gap: var(--space-6);
  padding-bottom: var(--space-6);
  border-bottom: 1px solid var(--border-soft);
}

.footer-brand {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.footer-brand-logo {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.footer-brand-logo img {
  height: 32px;
  width: auto;
  border-radius: 6px;
}

.footer-brand-logo span {
  font-weight: 800;
  font-size: 1.1rem;
  background: linear-gradient(135deg, #fff, var(--blue-soft));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.footer-brand p {
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.65;
  max-width: 300px;
}

.footer-social {
  display: flex;
  gap: var(--space-2);
  margin-top: var(--space-1);
}

.footer-social a {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  color: var(--muted);
}

.footer-social a:hover {
  background: var(--blue-dim);
  border-color: rgba(59, 130, 246, 0.3);
  color: var(--blue-soft);
  transform: translateY(-2px);
}

.footer-social a svg {
  width: 18px;
  height: 18px;
}

.footer-col h4 {
  font-size: 0.82rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-soft);
  margin-bottom: var(--space-3);
}

.footer-col ul {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.footer-col a {
  color: var(--muted);
  font-size: 0.88rem;
  transition: color 0.2s ease;
}

.footer-col a:hover {
  color: var(--blue-soft);
}

.footer-bottom {
  padding-top: var(--space-4);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--space-3);
}

.footer-copy {
  font-size: 0.82rem;
  color: var(--muted);
}

.footer-copy a {
  color: var(--blue-soft);
}

.footer-bottom-links {
  display: flex;
  gap: var(--space-4);
}

.footer-bottom-links a {
  font-size: 0.82rem;
  color: var(--muted);
  transition: color 0.2s ease;
}

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

/* ─── Utility ─── */
.muted { color: var(--muted); }

.gradient-text {
  background: linear-gradient(135deg, var(--blue), var(--orange));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ─── Responsive ─── */
@media (max-width: 960px) {
  .hero-grid {
    grid-template-columns: 1fr;
    gap: var(--space-5);
  }

  .top-nav {
    display: none;
  }

  .footer-grid {
    grid-template-columns: 1fr 1fr;
    gap: var(--space-4);
  }
}

@media (max-width: 640px) {
  .nav-shell {
    min-height: 64px;
  }

  .hero {
    padding: var(--space-6) 0 var(--space-5);
  }

  .section-heading-row {
    flex-direction: column;
    align-items: stretch;
  }

  .hero-stats {
    flex-wrap: wrap;
    gap: var(--space-3);
  }

  .footer-grid {
    grid-template-columns: 1fr;
    gap: var(--space-4);
  }

  .footer-bottom {
    flex-direction: column;
    align-items: center;
    text-align: center;
  }

  .sections-grid,
  .topics-grid,
  .mode-grid {
    grid-template-columns: 1fr;
  }
}
