/* ============================================================
   Student Utility Hub — Main CSS Theme System
   India's First Semester Companion
   ============================================================ */

/* ---------- Google Fonts Import ---------- */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800;900&family=Plus+Jakarta+Sans:wght@400;500;600;700;800&display=swap');

/* ---------- CSS Custom Properties (Light Mode) ---------- */
:root {
  /* Background System */
  --bg:              #ffffff;
  --bg-secondary:    #f8fafc;
  --bg-tertiary:     #f1f5f9;
  --bg-overlay:      rgba(255, 255, 255, 0.85);

  /* Text System */
  --text:            #0f172a;
  --text-secondary:  #475569;
  --text-muted:      #94a3b8;
  --text-inverse:    #ffffff;

  /* Brand Colors */
  --primary:         #2563eb;
  --primary-hover:   #1d4ed8;
  --primary-light:   #dbeafe;
  --primary-dark:    #1e40af;

  --secondary:       #64748b;
  --secondary-hover: #475569;
  --secondary-light: #f1f5f9;

  --accent:          #f59e0b;
  --accent-hover:    #d97706;
  --accent-light:    #fef3c7;

  /* Semantic Colors */
  --success:         #10b981;
  --success-light:   #d1fae5;
  --warning:         #f59e0b;
  --warning-light:   #fef3c7;
  --error:           #ef4444;
  --error-light:     #fee2e2;
  --info:            #3b82f6;
  --info-light:      #dbeafe;

  /* Card & Surface */
  --card-bg:         #ffffff;
  --card-border:     #e2e8f0;
  --card-shadow:     0 1px 3px rgba(0,0,0,0.08), 0 4px 16px rgba(0,0,0,0.04);
  --card-shadow-hover: 0 8px 32px rgba(37,99,235,0.15), 0 2px 8px rgba(0,0,0,0.08);

  /* Navigation */
  --nav-bg:          rgba(255, 255, 255, 0.92);
  --nav-border:      #e2e8f0;

  /* Input */
  --input-bg:        #ffffff;
  --input-border:    #cbd5e1;
  --input-focus:     #2563eb;
  --input-shadow:    0 0 0 3px rgba(37,99,235,0.12);

  /* Gradients */
  --gradient-hero:   linear-gradient(135deg, #667eea 0%, #764ba2 40%, #2563eb 100%);
  --gradient-card:   linear-gradient(135deg, #f8fafc 0%, #ffffff 100%);
  --gradient-accent: linear-gradient(135deg, #f59e0b 0%, #ef4444 100%);

  /* Typography */
  --font-primary:    'Plus Jakarta Sans', 'Inter', system-ui, sans-serif;
  --font-mono:       'JetBrains Mono', 'Fira Code', monospace;

  --text-xs:    0.75rem;
  --text-sm:    0.875rem;
  --text-base:  1rem;
  --text-lg:    1.125rem;
  --text-xl:    1.25rem;
  --text-2xl:   1.5rem;
  --text-3xl:   1.875rem;
  --text-4xl:   2.25rem;
  --text-5xl:   3rem;
  --text-6xl:   3.75rem;

  /* Spacing */
  --space-1:  0.25rem;
  --space-2:  0.5rem;
  --space-3:  0.75rem;
  --space-4:  1rem;
  --space-5:  1.25rem;
  --space-6:  1.5rem;
  --space-8:  2rem;
  --space-10: 2.5rem;
  --space-12: 3rem;
  --space-16: 4rem;
  --space-20: 5rem;
  --space-24: 6rem;

  /* Border Radius */
  --radius-sm:   0.375rem;
  --radius-md:   0.625rem;
  --radius-lg:   1rem;
  --radius-xl:   1.5rem;
  --radius-2xl:  2rem;
  --radius-full: 9999px;

  /* Transitions */
  --transition-fast:   0.15s ease;
  --transition-base:   0.25s ease;
  --transition-slow:   0.4s ease;
  --transition-theme:  0.3s cubic-bezier(0.4, 0, 0.2, 1);

  /* Z-Index Scale */
  --z-dropdown: 100;
  --z-sticky:   200;
  --z-overlay:  300;
  --z-modal:    400;
  --z-toast:    500;

  /* Shadows */
  --shadow-sm:  0 1px 2px rgba(0,0,0,0.05);
  --shadow-md:  0 4px 12px rgba(0,0,0,0.08);
  --shadow-lg:  0 10px 40px rgba(0,0,0,0.12);
  --shadow-xl:  0 20px 60px rgba(0,0,0,0.15);

  /* Layout */
  --container-max:  1280px;
  --nav-height:     72px;
}

/* ---------- Dark Mode Tokens ---------- */
[data-theme="dark"] {
  --bg:              #0f1117;
  --bg-secondary:    #1a1d27;
  --bg-tertiary:     #242736;
  --bg-overlay:      rgba(15, 17, 23, 0.92);

  --text:            #f1f5f9;
  --text-secondary:  #94a3b8;
  --text-muted:      #64748b;
  --text-inverse:    #0f172a;

  --primary:         #4a9eff;
  --primary-hover:   #60aaff;
  --primary-light:   rgba(74, 158, 255, 0.15);
  --primary-dark:    #2563eb;

  --secondary:       #94a3b8;
  --secondary-hover: #cbd5e1;
  --secondary-light: rgba(148, 163, 184, 0.1);

  --accent:          #fbbf24;
  --accent-hover:    #fcd34d;
  --accent-light:    rgba(251, 191, 36, 0.15);

  --success:         #34d399;
  --success-light:   rgba(52, 211, 153, 0.15);
  --warning:         #fbbf24;
  --warning-light:   rgba(251, 191, 36, 0.15);
  --error:           #f87171;
  --error-light:     rgba(248, 113, 113, 0.15);
  --info:            #60a5fa;
  --info-light:      rgba(96, 165, 250, 0.15);

  --card-bg:         #1a1d27;
  --card-border:     #2d3247;
  --card-shadow:     0 1px 3px rgba(0,0,0,0.3), 0 4px 16px rgba(0,0,0,0.2);
  --card-shadow-hover: 0 8px 32px rgba(74,158,255,0.2), 0 2px 8px rgba(0,0,0,0.3);

  --nav-bg:          rgba(15, 17, 23, 0.95);
  --nav-border:      #2d3247;

  --input-bg:        #1a1d27;
  --input-border:    #3d4460;
  --input-focus:     #4a9eff;
  --input-shadow:    0 0 0 3px rgba(74,158,255,0.2);

  --gradient-hero:   linear-gradient(135deg, #1a1d27 0%, #242736 40%, #0f1117 100%);
  --gradient-card:   linear-gradient(135deg, #1a1d27 0%, #242736 100%);

  --shadow-sm:  0 1px 2px rgba(0,0,0,0.2);
  --shadow-md:  0 4px 12px rgba(0,0,0,0.3);
  --shadow-lg:  0 10px 40px rgba(0,0,0,0.4);
  --shadow-xl:  0 20px 60px rgba(0,0,0,0.5);
}

/* ============================================================
   RESET & BASE
   ============================================================ */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

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

img, svg, video {
  display: block;
  max-width: 100%;
}

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

button {
  cursor: pointer;
  font-family: inherit;
  border: none;
  background: none;
}

input, textarea, select {
  font-family: inherit;
  font-size: inherit;
}

ul, ol { list-style: none; }

/* ============================================================
   LAYOUT UTILITIES
   ============================================================ */
.container {
  width: 100%;
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 0 var(--space-4);
}

.section {
  padding: var(--space-16) 0;
}

.section-sm {
  padding: var(--space-10) 0;
}

.grid {
  display: grid;
  gap: var(--space-6);
}

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

.flex { display: flex; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.flex-col { display: flex; flex-direction: column; }
.gap-2 { gap: var(--space-2); }
.gap-3 { gap: var(--space-3); }
.gap-4 { gap: var(--space-4); }
.gap-6 { gap: var(--space-6); }
.gap-8 { gap: var(--space-8); }

.text-center { text-align: center; }
.text-left   { text-align: left; }
.text-right  { text-align: right; }

/* ============================================================
   TYPOGRAPHY
   ============================================================ */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-primary);
  font-weight: 700;
  line-height: 1.2;
  color: var(--text);
  transition: color var(--transition-theme);
}

h1 { font-size: var(--text-5xl); letter-spacing: -0.02em; }
h2 { font-size: var(--text-4xl); letter-spacing: -0.01em; }
h3 { font-size: var(--text-3xl); }
h4 { font-size: var(--text-2xl); }
h5 { font-size: var(--text-xl); }
h6 { font-size: var(--text-lg); }

p { color: var(--text-secondary); line-height: 1.7; }

.text-gradient {
  background: linear-gradient(135deg, var(--primary) 0%, #7c3aed 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.text-gradient-accent {
  background: var(--gradient-accent);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.section-label {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--primary);
  background: var(--primary-light);
  padding: var(--space-1) var(--space-3);
  border-radius: var(--radius-full);
  margin-bottom: var(--space-4);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  transition: background var(--transition-theme), color var(--transition-theme);
}

.section-title {
  font-size: var(--text-4xl);
  font-weight: 800;
  margin-bottom: var(--space-4);
  letter-spacing: -0.02em;
}

.section-subtitle {
  font-size: var(--text-lg);
  color: var(--text-secondary);
  max-width: 600px;
}

/* ============================================================
   NAVIGATION
   ============================================================ */
.navbar {
  position: sticky;
  top: 0;
  z-index: var(--z-sticky);
  height: var(--nav-height);
  background: var(--nav-bg);
  border-bottom: 1px solid var(--nav-border);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  transition: background var(--transition-theme), border-color var(--transition-theme), box-shadow var(--transition-base);
}

.navbar.scrolled {
  box-shadow: var(--shadow-md);
}

.navbar .container {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-8);
}

.nav-logo {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  text-decoration: none;
  flex-shrink: 0;
}

.nav-logo-icon {
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, var(--primary) 0%, #7c3aed 100%);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  box-shadow: 0 4px 12px rgba(37,99,235,0.3);
  transition: transform var(--transition-base), box-shadow var(--transition-base);
}

.nav-logo:hover .nav-logo-icon {
  transform: scale(1.05) rotate(-3deg);
  box-shadow: 0 6px 20px rgba(37,99,235,0.4);
}

.nav-logo-text {
  display: flex;
  flex-direction: column;
  line-height: 1.1;
}

.nav-logo-name {
  font-size: var(--text-base);
  font-weight: 800;
  color: var(--text);
  transition: color var(--transition-theme);
}

.nav-logo-tagline {
  font-size: 0.65rem;
  font-weight: 500;
  color: var(--primary);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  flex: 1;
  justify-content: center;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--text-secondary);
  transition: all var(--transition-fast);
  white-space: nowrap;
  text-decoration: none;
}

.nav-link:hover {
  color: var(--text);
  background: var(--bg-secondary);
}

.nav-link.active {
  color: var(--primary);
  background: var(--primary-light);
  font-weight: 600;
}

.nav-link .nav-icon {
  font-size: 1rem;
}

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

/* Hamburger for mobile */
.nav-hamburger {
  display: none;
  flex-direction: column;
  gap: 5px;
  padding: var(--space-2);
  border-radius: var(--radius-sm);
  background: none;
  border: none;
  cursor: pointer;
  transition: background var(--transition-fast);
  min-width: 48px;
  min-height: 48px;
  align-items: center;
  justify-content: center;
}
.nav-hamburger:hover { background: var(--bg-secondary); }
.nav-hamburger span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--text);
  border-radius: 2px;
  transition: all 0.3s ease;
}
.nav-hamburger.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-hamburger.open span:nth-child(2) { opacity: 0; }
.nav-hamburger.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* Mobile Nav Drawer */
.nav-mobile-drawer {
  display: none;
  position: fixed;
  top: var(--nav-height);
  left: 0;
  right: 0;
  background: var(--nav-bg);
  border-bottom: 1px solid var(--nav-border);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  padding: var(--space-4);
  flex-direction: column;
  gap: var(--space-2);
  z-index: calc(var(--z-sticky) - 1);
  box-shadow: var(--shadow-lg);
  transform: translateY(-10px);
  opacity: 0;
  transition: transform 0.3s ease, opacity 0.3s ease;
}

.nav-mobile-drawer.open {
  display: flex;
  transform: translateY(0);
  opacity: 1;
}

.nav-mobile-link {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-md);
  font-size: var(--text-base);
  font-weight: 500;
  color: var(--text-secondary);
  text-decoration: none;
  transition: all var(--transition-fast);
  min-height: 48px;
}
.nav-mobile-link:hover {
  color: var(--primary);
  background: var(--primary-light);
}

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: 0.75rem 1.5rem;
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  font-weight: 600;
  font-family: var(--font-primary);
  border: none;
  cursor: pointer;
  transition: all var(--transition-base);
  white-space: nowrap;
  text-decoration: none;
  min-height: 48px;
  letter-spacing: 0.01em;
  position: relative;
  overflow: hidden;
}

.btn::after {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(255,255,255,0);
  transition: background var(--transition-fast);
}

.btn:hover::after { background: rgba(255,255,255,0.1); }
.btn:active { transform: scale(0.98); }

.btn-primary {
  background: linear-gradient(135deg, var(--primary) 0%, #7c3aed 100%);
  color: white;
  box-shadow: 0 4px 14px rgba(37,99,235,0.35);
}
.btn-primary:hover {
  box-shadow: 0 6px 20px rgba(37,99,235,0.45);
  transform: translateY(-1px);
}

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

.btn-outline {
  background: transparent;
  color: var(--primary);
  border: 2px solid var(--primary);
}
.btn-outline:hover {
  background: var(--primary-light);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
}
.btn-ghost:hover {
  background: var(--bg-secondary);
  color: var(--text);
}

.btn-accent {
  background: linear-gradient(135deg, var(--accent) 0%, #ef4444 100%);
  color: white;
  box-shadow: 0 4px 14px rgba(245,158,11,0.35);
}
.btn-accent:hover {
  box-shadow: 0 6px 20px rgba(245,158,11,0.45);
  transform: translateY(-1px);
}

.btn-sm {
  padding: 0.5rem 1rem;
  font-size: var(--text-xs);
  min-height: 36px;
  border-radius: var(--radius-sm);
}

.btn-lg {
  padding: 1rem 2rem;
  font-size: var(--text-base);
  min-height: 56px;
  border-radius: var(--radius-lg);
}

.btn-icon {
  width: 44px;
  height: 44px;
  padding: 0;
  border-radius: var(--radius-md);
  font-size: 1.1rem;
}

/* ============================================================
   CARDS
   ============================================================ */
.card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-xl);
  padding: var(--space-6);
  box-shadow: var(--card-shadow);
  transition: all var(--transition-base);
}

.card:hover {
  box-shadow: var(--card-shadow-hover);
  transform: translateY(-2px);
  border-color: var(--primary);
}

.card-header {
  display: flex;
  align-items: flex-start;
  gap: var(--space-4);
  margin-bottom: var(--space-4);
}

.card-icon {
  width: 56px;
  height: 56px;
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  flex-shrink: 0;
  transition: transform var(--transition-base);
}

.card:hover .card-icon {
  transform: scale(1.1) rotate(-5deg);
}

.card-icon-blue   { background: var(--primary-light); }
.card-icon-amber  { background: var(--accent-light); }
.card-icon-green  { background: var(--success-light); }
.card-icon-purple { background: rgba(124,58,237,0.1); }
.card-icon-red    { background: var(--error-light); }
.card-icon-cyan   { background: rgba(6,182,212,0.1); }

.card-title {
  font-size: var(--text-xl);
  font-weight: 700;
  color: var(--text);
  margin-bottom: var(--space-1);
}

.card-desc {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  line-height: 1.5;
}

.card-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.badge-blue   { background: var(--primary-light);  color: var(--primary); }
.badge-amber  { background: var(--accent-light);   color: var(--accent-hover); }
.badge-green  { background: var(--success-light);  color: var(--success); }
.badge-purple { background: rgba(124,58,237,0.1);  color: #7c3aed; }

/* ============================================================
   CATEGORY CARDS
   ============================================================ */
.category-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-xl);
  padding: var(--space-6);
  text-decoration: none;
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  box-shadow: var(--card-shadow);
  transition: all var(--transition-base);
  position: relative;
  overflow: hidden;
  cursor: pointer;
}

.category-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--primary) 0%, #7c3aed 100%);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform var(--transition-base);
}

.category-card:hover::before {
  transform: scaleX(1);
}

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

.category-icon-wrap {
  width: 72px;
  height: 72px;
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  transition: transform var(--transition-base);
}

.category-card:hover .category-icon-wrap {
  transform: scale(1.15) rotate(-8deg);
}

.category-card-title {
  font-size: var(--text-xl);
  font-weight: 800;
  color: var(--text);
  margin-bottom: var(--space-1);
  transition: color var(--transition-fast);
}

.category-card:hover .category-card-title {
  color: var(--primary);
}

.category-card-count {
  font-size: var(--text-sm);
  color: var(--text-muted);
  font-weight: 500;
}

.category-card-arrow {
  margin-top: auto;
  font-size: 1.2rem;
  color: var(--text-muted);
  transition: transform var(--transition-base), color var(--transition-base);
}

.category-card:hover .category-card-arrow {
  transform: translateX(4px);
  color: var(--primary);
}

/* ============================================================
   FEATURED TOOL CARDS
   ============================================================ */
.tool-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-xl);
  padding: var(--space-6);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  box-shadow: var(--card-shadow);
  transition: all var(--transition-base);
  flex-shrink: 0;
  width: 280px;
  text-decoration: none;
  position: relative;
  overflow: hidden;
  cursor: pointer;
}

.tool-card::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--primary) 0%, var(--accent) 100%);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform var(--transition-base);
}

.tool-card:hover::after {
  transform: scaleX(1);
}

.tool-card:hover {
  box-shadow: var(--card-shadow-hover);
  transform: translateY(-3px);
  border-color: var(--primary);
}

.tool-card-icon {
  width: 52px;
  height: 52px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  transition: transform var(--transition-base);
}

.tool-card:hover .tool-card-icon {
  transform: scale(1.1) rotate(-5deg);
}

.tool-card-title {
  font-size: var(--text-base);
  font-weight: 700;
  color: var(--text);
  line-height: 1.3;
}

.tool-card-desc {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  line-height: 1.5;
  flex: 1;
}

.tool-card-link {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--primary);
  margin-top: var(--space-2);
  transition: gap var(--transition-fast);
}

.tool-card:hover .tool-card-link {
  gap: var(--space-2);
}

/* ============================================================
   SEARCH BAR
   ============================================================ */
.search-wrap {
  position: relative;
  width: 100%;
  max-width: 640px;
  margin: 0 auto;
}

.search-input {
  width: 100%;
  padding: 1rem 1.25rem 1rem 3.5rem;
  background: var(--bg-overlay);
  border: 2px solid rgba(255,255,255,0.4);
  border-radius: var(--radius-full);
  font-size: var(--text-base);
  font-weight: 500;
  color: var(--text);
  outline: none;
  transition: all var(--transition-base);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: 0 4px 24px rgba(0,0,0,0.1);
}

.search-input::placeholder {
  color: rgba(255,255,255,0.6);
  font-weight: 400;
}

[data-theme="dark"] .search-input::placeholder {
  color: var(--text-muted);
}

.search-input:focus {
  border-color: rgba(255,255,255,0.8);
  box-shadow: 0 0 0 4px rgba(255,255,255,0.2), 0 4px 24px rgba(0,0,0,0.15);
  background: rgba(255,255,255,0.95);
  color: var(--text);
}

[data-theme="dark"] .search-input:focus {
  border-color: var(--primary);
  background: var(--input-bg);
  box-shadow: var(--input-shadow);
  color: var(--text);
}

.search-icon {
  position: absolute;
  left: 1.125rem;
  top: 50%;
  transform: translateY(-50%);
  font-size: 1.1rem;
  color: rgba(255,255,255,0.7);
  pointer-events: none;
  transition: color var(--transition-base);
  z-index: 1;
}

.search-input:focus ~ .search-icon,
.search-wrap:focus-within .search-icon {
  color: var(--primary);
}

.search-clear {
  position: absolute;
  right: 1rem;
  top: 50%;
  transform: translateY(-50%);
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--text-muted);
  color: white;
  display: none;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  border: none;
  cursor: pointer;
  transition: background var(--transition-fast);
}
.search-clear:hover { background: var(--error); }
.search-clear.visible { display: flex; }

/* Search Suggestions Dropdown */
.search-suggestions {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
  overflow: hidden;
  z-index: var(--z-dropdown);
  display: none;
  max-height: 380px;
  overflow-y: auto;
}

.search-suggestions.visible {
  display: block;
  animation: slideDown 0.2s ease;
}

@keyframes slideDown {
  from { opacity: 0; transform: translateY(-8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.suggestion-group-title {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  padding: var(--space-3) var(--space-4) var(--space-1);
}

.suggestion-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  cursor: pointer;
  transition: background var(--transition-fast);
  text-decoration: none;
}

.suggestion-item:hover,
.suggestion-item.highlighted {
  background: var(--primary-light);
}

.suggestion-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  flex-shrink: 0;
}

.suggestion-text {
  flex: 1;
}

.suggestion-title {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text);
}

.suggestion-cat {
  font-size: var(--text-xs);
  color: var(--text-muted);
}

.suggestion-arrow {
  color: var(--text-muted);
  font-size: 0.75rem;
  transition: transform var(--transition-fast);
}
.suggestion-item:hover .suggestion-arrow {
  transform: translateX(2px);
  color: var(--primary);
}

.search-empty {
  padding: var(--space-8);
  text-align: center;
  color: var(--text-muted);
  font-size: var(--text-sm);
}

/* ============================================================
   DARK MODE TOGGLE
   ============================================================ */
.dark-toggle {
  width: 52px;
  height: 28px;
  background: var(--bg-tertiary);
  border-radius: var(--radius-full);
  border: 2px solid var(--card-border);
  cursor: pointer;
  position: relative;
  transition: all var(--transition-theme);
  flex-shrink: 0;
}

.dark-toggle:hover {
  border-color: var(--primary);
}

.dark-toggle-thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: white;
  box-shadow: 0 1px 4px rgba(0,0,0,0.2);
  transition: transform var(--transition-theme), background var(--transition-theme);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
}

[data-theme="dark"] .dark-toggle {
  background: linear-gradient(135deg, var(--primary) 0%, #7c3aed 100%);
  border-color: transparent;
}

[data-theme="dark"] .dark-toggle-thumb {
  transform: translateX(24px);
  background: var(--bg-secondary);
}

/* ============================================================
   HERO SECTION
   ============================================================ */
.hero {
  min-height: 40vh;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  background: var(--gradient-hero);
  position: relative;
  overflow: hidden;
  padding: var(--space-16) 0;
}

.hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse at 20% 50%, rgba(124,58,237,0.3) 0%, transparent 60%),
    radial-gradient(ellipse at 80% 20%, rgba(37,99,235,0.4) 0%, transparent 60%),
    radial-gradient(ellipse at 60% 80%, rgba(245,158,11,0.2) 0%, transparent 50%);
}

.hero-particles {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}

.hero-particle {
  position: absolute;
  border-radius: 50%;
  background: rgba(255,255,255,0.08);
  animation: float linear infinite;
}

@keyframes float {
  0%   { transform: translateY(100vh) rotate(0deg); opacity: 0; }
  10%  { opacity: 1; }
  90%  { opacity: 1; }
  100% { transform: translateY(-100px) rotate(720deg); opacity: 0; }
}

.hero-content {
  position: relative;
  z-index: 2;
  max-width: 800px;
  padding: 0 var(--space-4);
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  background: rgba(255,255,255,0.15);
  border: 1px solid rgba(255,255,255,0.3);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-radius: var(--radius-full);
  padding: 6px 16px;
  font-size: var(--text-sm);
  font-weight: 600;
  color: white;
  margin-bottom: var(--space-6);
  letter-spacing: 0.03em;
}

.hero-badge-dot {
  width: 8px;
  height: 8px;
  background: var(--accent);
  border-radius: 50%;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%       { opacity: 0.6; transform: scale(1.3); }
}

.hero h1 {
  font-size: clamp(2.5rem, 6vw, 4.5rem);
  font-weight: 900;
  color: white;
  margin-bottom: var(--space-4);
  line-height: 1.1;
  letter-spacing: -0.03em;
  text-shadow: 0 2px 20px rgba(0,0,0,0.2);
}

.hero h1 .highlight {
  display: block;
  background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 50%, #fcd34d 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero-subtitle {
  font-size: clamp(1rem, 2.5vw, 1.25rem);
  color: rgba(255,255,255,0.85);
  margin-bottom: var(--space-8);
  max-width: 560px;
  margin-left: auto;
  margin-right: auto;
  line-height: 1.6;
}

.hero-stats {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-8);
  margin-top: var(--space-10);
  padding-top: var(--space-8);
  border-top: 1px solid rgba(255,255,255,0.15);
}

.hero-stat {
  text-align: center;
}

.hero-stat-num {
  font-size: var(--text-3xl);
  font-weight: 900;
  color: white;
  line-height: 1;
}

.hero-stat-label {
  font-size: var(--text-xs);
  color: rgba(255,255,255,0.65);
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-top: 4px;
}

/* ============================================================
   HORIZONTAL SCROLL
   ============================================================ */
.scroll-row {
  display: flex;
  gap: var(--space-5);
  overflow-x: auto;
  padding: var(--space-4) var(--space-2);
  scrollbar-width: none;
  -ms-overflow-style: none;
  -webkit-overflow-scrolling: touch;
  scroll-snap-type: x mandatory;
}

.scroll-row::-webkit-scrollbar { display: none; }

.scroll-row > * {
  scroll-snap-align: start;
  flex-shrink: 0;
}

/* ============================================================
   FORMS & INPUTS
   ============================================================ */
.form-group {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.form-label {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text);
}

.form-label .required {
  color: var(--error);
  margin-left: 2px;
}

.form-input {
  width: 100%;
  padding: 0.75rem 1rem;
  background: var(--input-bg);
  border: 2px solid var(--input-border);
  border-radius: var(--radius-md);
  font-size: var(--text-base);
  color: var(--text);
  outline: none;
  transition: all var(--transition-fast);
  min-height: 48px;
}

.form-input:focus {
  border-color: var(--input-focus);
  box-shadow: var(--input-shadow);
}

.form-input::placeholder { color: var(--text-muted); }

.form-select {
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%2364748b' stroke-width='2' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 1rem center;
  padding-right: 2.5rem;
}

.form-textarea {
  resize: vertical;
  min-height: 120px;
}

/* ============================================================
   FOOTER
   ============================================================ */
.footer {
  background: var(--bg-secondary);
  border-top: 1px solid var(--card-border);
  padding: var(--space-16) 0 var(--space-8);
  transition: background var(--transition-theme), border-color var(--transition-theme);
}

.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: var(--space-12);
  margin-bottom: var(--space-12);
}

.footer-brand-desc {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  line-height: 1.7;
  margin: var(--space-4) 0;
  max-width: 280px;
}

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

.footer-social-link {
  width: 40px;
  height: 40px;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  color: var(--text-secondary);
  text-decoration: none;
  transition: all var(--transition-fast);
}
.footer-social-link:hover {
  background: var(--primary);
  border-color: var(--primary);
  color: white;
  transform: translateY(-2px);
}

.footer-heading {
  font-size: var(--text-sm);
  font-weight: 700;
  color: var(--text);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: var(--space-5);
}

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

.footer-link {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: var(--space-2);
  transition: color var(--transition-fast);
}
.footer-link:hover { color: var(--primary); }
.footer-link::before {
  content: '→';
  opacity: 0;
  transform: translateX(-4px);
  transition: all var(--transition-fast);
  font-size: 0.75rem;
  color: var(--primary);
}
.footer-link:hover::before {
  opacity: 1;
  transform: translateX(0);
}

.footer-bottom {
  padding-top: var(--space-8);
  border-top: 1px solid var(--card-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
}

.footer-bottom-text {
  font-size: var(--text-sm);
  color: var(--text-muted);
}

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

.footer-bottom-link {
  font-size: var(--text-sm);
  color: var(--text-muted);
  text-decoration: none;
  transition: color var(--transition-fast);
}
.footer-bottom-link:hover { color: var(--primary); }

/* AdSense Placeholder */
.ad-banner {
  background: var(--bg-tertiary);
  border: 1px dashed var(--card-border);
  border-radius: var(--radius-md);
  height: 90px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-xs);
  color: var(--text-muted);
  margin: var(--space-8) 0;
}

/* ============================================================
   TOAST NOTIFICATIONS
   ============================================================ */
.toast-container {
  position: fixed;
  bottom: var(--space-6);
  right: var(--space-6);
  z-index: var(--z-toast);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.toast {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-5);
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  min-width: 280px;
  animation: toastIn 0.3s ease;
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.toast.hiding {
  opacity: 0;
  transform: translateX(20px);
}

@keyframes toastIn {
  from { opacity: 0; transform: translateX(20px); }
  to   { opacity: 1; transform: translateX(0); }
}

.toast-icon { font-size: 1.25rem; }
.toast-msg  { font-size: var(--text-sm); font-weight: 500; color: var(--text); flex: 1; }
.toast-close {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1rem;
  color: var(--text-muted);
  padding: 0;
  transition: color var(--transition-fast);
}
.toast-close:hover { color: var(--text); }

/* ============================================================
   RESULT CARD
   ============================================================ */
.result-card {
  background: var(--gradient-card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-xl);
  padding: var(--space-6);
  box-shadow: var(--card-shadow);
  transition: all var(--transition-base);
}

.result-title {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: var(--space-3);
}

.result-value {
  font-size: var(--text-4xl);
  font-weight: 900;
  color: var(--primary);
  letter-spacing: -0.02em;
  line-height: 1;
  margin-bottom: var(--space-2);
}

.result-actions {
  display: flex;
  gap: var(--space-3);
  margin-top: var(--space-4);
  flex-wrap: wrap;
}

/* ============================================================
   PAGE HEADER (Inner pages)
   ============================================================ */
.page-header {
  background: var(--gradient-hero);
  padding: var(--space-12) 0;
  position: relative;
  overflow: hidden;
}

.page-header::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at 30% 50%, rgba(124,58,237,0.3) 0%, transparent 60%);
}

.page-header-content {
  position: relative;
  z-index: 1;
}

.page-header h1 {
  font-size: var(--text-4xl);
  font-weight: 900;
  color: white;
  margin-bottom: var(--space-3);
}

.page-header p {
  font-size: var(--text-lg);
  color: rgba(255,255,255,0.8);
  max-width: 600px;
}

.breadcrumb {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-sm);
  color: rgba(255,255,255,0.7);
  margin-bottom: var(--space-4);
}

.breadcrumb-sep { opacity: 0.5; }
.breadcrumb a {
  color: rgba(255,255,255,0.7);
  text-decoration: none;
  transition: color var(--transition-fast);
}
.breadcrumb a:hover { color: white; }

/* ============================================================
   ANIMATIONS & UTILITIES
   ============================================================ */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes shimmer {
  from { background-position: -200% 0; }
  to   { background-position: 200% 0; }
}

.animate-in {
  animation: fadeInUp 0.5s ease both;
}

.animate-in-delay-1 { animation-delay: 0.1s; }
.animate-in-delay-2 { animation-delay: 0.2s; }
.animate-in-delay-3 { animation-delay: 0.3s; }
.animate-in-delay-4 { animation-delay: 0.4s; }

.skeleton {
  background: linear-gradient(90deg, var(--bg-tertiary) 25%, var(--bg-secondary) 50%, var(--bg-tertiary) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-md);
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border: 0;
}

/* Skip link for accessibility */
.skip-link {
  position: absolute;
  top: -100%;
  left: 0;
  background: var(--primary);
  color: white;
  padding: var(--space-3) var(--space-6);
  font-weight: 600;
  z-index: 9999;
  border-radius: 0 0 var(--radius-md) 0;
  text-decoration: none;
}
.skip-link:focus { top: 0; }

/* ============================================================
   FILE UPLOAD DROPZONE
   ============================================================ */
.file-upload-area {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-10) var(--space-6);
  background: var(--bg-secondary);
  border: 2px dashed var(--card-border);
  border-radius: var(--radius-xl);
  cursor: pointer;
  transition: all var(--transition-base);
  text-align: center;
  position: relative;
  overflow: hidden;
}

.file-upload-area::before {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--primary-light);
  opacity: 0;
  transition: opacity var(--transition-base);
  z-index: 0;
}

.file-upload-area:hover,
.file-upload-area.drag-over {
  border-color: var(--primary);
  border-style: solid;
}

.file-upload-area:hover::before,
.file-upload-area.drag-over::before {
  opacity: 0.5;
}

.file-upload-area > * {
  position: relative;
  z-index: 1;
}

.file-upload-icon {
  font-size: 3rem;
  margin-bottom: var(--space-4);
  filter: drop-shadow(0 4px 6px rgba(0,0,0,0.1));
  transition: transform var(--transition-base);
}

.file-upload-area:hover .file-upload-icon,
.file-upload-area.drag-over .file-upload-icon {
  transform: translateY(-4px) scale(1.1);
}

.file-upload-text {
  font-size: var(--text-lg);
  font-weight: 600;
  color: var(--text);
  margin-bottom: var(--space-2);
}

.file-upload-hint {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  margin-bottom: var(--space-5);
}

.file-upload-btn-fake {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: 0.6rem 1.25rem;
  background: var(--primary);
  color: white;
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  font-weight: 600;
  box-shadow: 0 4px 14px rgba(37,99,235,0.25);
  transition: all var(--transition-base);
}

.file-upload-area:hover .file-upload-btn-fake {
  box-shadow: 0 6px 20px rgba(37,99,235,0.4);
  transform: translateY(-1px);
}

.file-upload-area.has-file {
  border-color: var(--success);
  background: var(--success-light);
}
.file-upload-area.has-file::before { display: none; }
.file-upload-area.has-file .file-upload-icon { display: none; }
.file-upload-area.has-file .file-upload-text { display: none; }
.file-upload-area.has-file .file-upload-hint { display: none; }
.file-upload-area.has-file .file-upload-btn-fake {
  background: var(--success);
  box-shadow: 0 4px 14px rgba(16,185,129,0.25);
}

/* ============================================================
   MOBILE-FIRST BREAKPOINTS
   ============================================================ */

/* Mobile: 320px – 767px */
@media (max-width: 767px) {
  :root {
    --nav-height: 64px;
  }

  .container { padding: 0 var(--space-4); }

  h1 { font-size: var(--text-4xl); }
  h2 { font-size: var(--text-3xl); }
  h3 { font-size: var(--text-2xl); }

  .section { padding: var(--space-10) 0; }
  .section-sm { padding: var(--space-6) 0; }

  .nav-links { display: none; }
  .nav-hamburger { display: flex; }

  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }

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

  .footer-bottom {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-3);
  }

  .hero h1 { font-size: clamp(2rem, 8vw, 3rem); }

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

  .hero-stat-num { font-size: var(--text-2xl); }

  .toast-container {
    left: var(--space-4);
    right: var(--space-4);
    bottom: var(--space-4);
  }
  .toast { min-width: unset; }

  .btn-lg {
    width: 100%;
    padding: 1rem;
  }
}

/* Tablet: 768px – 1023px */
@media (min-width: 768px) and (max-width: 1023px) {
  .container { padding: 0 var(--space-6); }

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

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

/* Desktop: 1024px+ */
@media (min-width: 1024px) {
  .container { padding: 0 var(--space-8); }
  .nav-hamburger { display: none; }
}

/* Large Desktop: 1280px+ */
@media (min-width: 1280px) {
  .container { padding: 0 var(--space-10); }
}

/* ============================================================
   ADSENSE PLACEMENT STRATEGY
   ============================================================ */
.ad-slot {
  width: 100%;
  background: var(--bg-tertiary);
  border: 1px dashed var(--card-border);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: var(--text-xs);
  margin: var(--space-6) auto;
  overflow: hidden;
}
.ad-slot::before {
  content: 'Advertisement Placeholder';
}
.ad-responsive { min-height: 250px; }
.ad-leaderboard { min-height: 90px; max-width: 728px; }

