/* ============================================================
   TABLE OF CONTENTS
   1. CSS Reset & Variables
   2. Typography
   3. Layout Utilities (.container, .grid, .flex)
   4. Navbar
   5. Loader
   6. Hero Section
   7. Year Cards
   8. How It Works Section
   9. Featured Subjects
   10. Page Header (year/track/subject pages)
   11. Track Cards
   12. Subject Cards
   13. Tabs
   14. Tab Panels
   15. Channel Cards
   16. Resource Items
   17. Breadcrumb
   18. Favorite Buttons
   19. Toast
   20. Footer
   21. Responsive break-points
   ============================================================ */

/* ============================================================
   1. CSS Reset & Variables
   ============================================================ */
@import url('https://fonts.googleapis.com/css2?family=Cairo:wght@400;500;600;700;800&family=Inter:wght@400;500;600;700&display=swap');

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

:root {
  /* Colors - Light mode (SaaS Notion-inspired) */
  --primary: #4F8CFF;          
  --primary-light: #EEF4FF;    
  --primary-dark: #3A70D6;     
  --accent: #6366F1;           
  
  --bg-main: #F9FAFB;          
  --bg-card: #FFFFFF;          
  --bg-card-rgb: 255, 255, 255;
  --bg-sidebar: #F3F4F6;       
  
  --text-primary: #111827;     
  --text-secondary: #4B5563;   
  --text-muted: #9CA3AF;       
  --border: #E5E7EB;           
  --border-light: #F3F4F6;
  --border-focus: rgba(79, 140, 255, 0.5);     
  
  /* Shadows */
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.05), 0 2px 4px -2px rgba(0,0,0,0.05);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.08), 0 4px 6px -4px rgba(0,0,0,0.05);
  --shadow-hover: 0 12px 24px -4px rgba(79, 140, 255, 0.15);
  
  /* Radii */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;

  /* Semantic colors */
  --success: #10B981;
  --warning: #F59E0B;
  --danger: #EF4444;
  --info: #3B82F6;

  /* Track badge colors */
  --sciences: #6366F1;
  --sciences-light: #EEF2FF;
  --math: #3B82F6;
  --math-light: #EFF6FF;
  --tech-math: #10B981;
  --tech-math-light: #ECFDF5;
  --literature: #F59E0B;
  --literature-light: #FFFBEB;
  --languages: #EF4444;
  --languages-light: #FEF2F2;

  /* Typography Scale */
  --font-arabic: 'Cairo', sans-serif;
  --font-english: 'Inter', sans-serif;
  --font-family: var(--font-arabic);
  
  --text-xs: 0.75rem;    /* 12px */
  --text-sm: 0.875rem;   /* 14px */
  --text-base: 1rem;     /* 16px */
  --text-lg: 1.125rem;   /* 18px */
  --text-xl: 1.25rem;    /* 20px */
  --text-2xl: 1.5rem;    /* 24px */
  --text-3xl: 1.875rem;  /* 30px */
  --text-4xl: 2.25rem;   /* 36px */
  --text-5xl: 3rem;      /* 48px */

  /* Animation */
  --transition-base: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-bounce: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);

  color-scheme: light dark;
}

[data-theme="dark"] {
  --bg-main: #141416;
  --bg-card: #1C1C1F;
  --bg-card-rgb: 28, 28, 31;
  --bg-sidebar: #222225;
  
  --text-primary: #F3F4F6;
  --text-secondary: #9CA3AF;
  --text-muted: #6B7280; 
  --border: #2A2A2E;
  --border-light: #222225;
  
  --primary-light: rgba(79, 140, 255, 0.15);
  
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.4);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.5);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.5);
  --shadow-hover: 0 12px 24px -4px rgba(0,0,0,0.5);
  
  --sciences-light: rgba(99, 102, 241, 0.2);
  --math-light: rgba(59, 130, 246, 0.2);
  --tech-math-light: rgba(16, 185, 129, 0.2);
  --literature-light: rgba(245, 158, 11, 0.2);
  --languages-light: rgba(239, 68, 68, 0.2);
}

html {
  scroll-behavior: smooth;
  direction: rtl; 
}

body {
  font-family: var(--font-family);
  background-color: var(--bg-main);
  color: var(--text-secondary);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

[dir="ltr"] {
  font-family: var(--font-english);
}

a {
  text-decoration: none;
  color: inherit;
  transition: var(--transition-base);
}

ul, ol {
  list-style: none;
}

button, input {
  font-family: inherit;
}

:focus-visible {
  outline: 2px solid var(--border-focus);
  outline-offset: 2px;
}

/* ============================================================
   2. Typography
   ============================================================ */
h1, h2, h3, h4, h5, h6 {
  color: var(--text-primary);
  font-weight: 700;
  line-height: 1.3;
  letter-spacing: -0.01em;
}

p {
  margin-bottom: 1rem;
}

.text-gradient {
  background: linear-gradient(135deg, var(--primary), var(--accent));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
  display: inline-block;
}

/* ============================================================
   3. Layout Utilities
   ============================================================ */
.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
}

.auto-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(var(--min-col, 280px), 1fr));
  gap: var(--grid-gap, 24px);
}

.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.gap-2 { gap: 0.5rem; }
.gap-4 { gap: 1rem; }
.gap-6 { gap: 1.5rem; }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.6rem 1.25rem;
  border-radius: var(--radius-md);
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  transition: var(--transition-base);
  font-size: var(--text-sm);
  gap: 0.5rem;
  user-select: none;
}
.btn:active {
  transform: scale(0.96);
}
.btn-primary {
  background-color: var(--primary);
  color: #fff;
  box-shadow: 0 2px 4px rgba(79, 140, 255, 0.2);
}
.btn-primary:hover {
  background-color: var(--primary-dark);
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(79, 140, 255, 0.3);
}
.btn-ghost {
  background-color: var(--bg-card);
  color: var(--text-primary);
  border: 1px solid var(--border);
}
.btn-ghost:hover {
  background-color: var(--bg-sidebar);
  border-color: var(--border-focus);
}
.btn-lg {
  padding: 0.85rem 1.75rem;
  font-size: var(--text-base);
}
.btn-sm {
  padding: 0.4rem 0.8rem;
  font-size: var(--text-xs);
  border-radius: var(--radius-sm);
}
.btn-icon {
  background: transparent;
  border: none;
  cursor: pointer;
  color: var(--text-secondary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  transition: var(--transition-base);
  position: relative;
}
.btn-icon:hover {
  background: var(--bg-sidebar);
  color: var(--primary);
  transform: scale(1.05);
}

/* Tags / Badges */
.badge {
  position: absolute;
  top: 2px;
  inset-inline-start: 2px;
  background: var(--danger);
  color: white;
  font-size: 0.65rem;
  font-weight: bold;
  padding: 2px 6px;
  border-radius: 99px;
  box-shadow: 0 2px 4px rgba(239, 68, 68, 0.3);
}

/* ============================================================
   4. Navbar
   ============================================================ */
.navbar {
  position: sticky;
  top: 0;
  z-index: 1000;
  background: rgba(var(--bg-card-rgb), 0.75);
  -webkit-backdrop-filter: blur(20px);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid rgba(var(--bg-card-rgb), 0.1);
  height: 72px; /* Slightly taller for breathing room */
  display: flex;
  align-items: center;
  transition: var(--transition-smooth);
}
.navbar.scrolled {
  box-shadow: var(--shadow-sm);
  background: rgba(var(--bg-card-rgb), 0.95);
  border-bottom: 1px solid var(--border);
}
.nav-container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.nav-logo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-weight: 800;
  font-size: var(--text-xl);
  color: var(--text-primary);
  letter-spacing: -0.02em;
}
.nav-logo .logo-icon {
  width: 36px;
  height: 36px;
  background: var(--primary);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  font-weight: 700;
  font-size: 20px;
  box-shadow: 0 4px 8px rgba(79, 140, 255, 0.3);
}
.logo-dz {
  color: var(--primary);
}
.nav-links {
  display: flex;
  gap: 2.5rem;
}
.nav-links li a {
  color: var(--text-secondary);
  font-weight: 600;
  font-size: var(--text-sm);
  position: relative;
}
.nav-links li a:hover {
  color: var(--primary);
}
/* Active Indicator (assuming inline style used in HTML) */
.nav-links li a[style*="var(--primary)"]::after {
  content: '';
  position: absolute;
  bottom: -6px;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--primary);
  border-radius: 2px;
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.search-wrapper {
  position: relative;
}
.nav-search {
  padding: 0.6rem 1.25rem;
  border-radius: 99px;
  border: 1px solid var(--border);
  background: var(--bg-sidebar);
  color: var(--text-primary);
  font-size: var(--text-sm);
  width: 220px;
  transition: var(--transition-bounce);
}
.nav-search:focus {
  width: 280px;
  outline: none;
  border-color: var(--primary);
  background: var(--bg-card);
  box-shadow: 0 0 0 4px var(--primary-light);
}
.hamburger {
  display: none;
  flex-direction: column;
  justify-content: space-around;
  width: 24px;
  height: 20px;
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 0;
}
.hamburger span {
  width: 100%;
  height: 2px;
  background: var(--text-primary);
  transition: var(--transition-base);
  border-radius: 2px;
}
.hamburger.active span:nth-child(1) {
  transform: translateY(9px) rotate(45deg);
}
.hamburger.active span:nth-child(2) {
  opacity: 0;
}
.hamburger.active span:nth-child(3) {
  transform: translateY(-9px) rotate(-45deg);
}

/* ============================================================
   5. Loader
   ============================================================ */
.loader-overlay {
  position: fixed;
  inset: 0;
  background: rgba(var(--bg-card-rgb), 0.98);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.4s ease;
}
.loader-content {
  text-align: center;
}
.loader-logo {
  width: 72px;
  height: 72px;
  background: var(--primary);
  color: white;
  border-radius: 20px;
  font-size: 36px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 2rem;
  box-shadow: 0 10px 20px rgba(79, 140, 255, 0.4);
  animation: logoPulse 2s infinite ease-in-out;
}
@keyframes logoPulse {
  0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(79, 140, 255, 0.4); }
  70% { transform: scale(1.05); box-shadow: 0 0 0 20px rgba(79, 140, 255, 0); }
  100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(79, 140, 255, 0); }
}
.loader-bar {
  width: 240px;
  height: 6px;
  background: var(--bg-sidebar);
  border-radius: 99px;
  margin: 0 auto 1.5rem;
  overflow: hidden;
}
.loader-progress {
  height: 100%;
  width: 0%;
  background: var(--primary);
  border-radius: 99px;
  animation: loadProgress 0.8s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}
@keyframes loadProgress {
  0% { width: 0%; }
  100% { width: 100%; }
}
.loader-content p {
  font-weight: 600;
  color: var(--text-secondary);
  font-size: var(--text-base);
}

/* ============================================================
   6. Hero Section
   ============================================================ */
.hero {
  position: relative;
  min-height: 85vh;
  display: flex;
  align-items: center;
  overflow: hidden;
  padding: 4rem 0;
  background: var(--bg-main);
}
.hero-bg-decoration {
  position: absolute;
  inset: 0;
  z-index: 0;
  background: radial-gradient(circle at 80% 20%, rgba(79, 140, 255, 0.1) 0%, transparent 40%),
              radial-gradient(circle at 20% 80%, rgba(99, 102, 241, 0.1) 0%, transparent 40%);
  filter: blur(60px);
}
.hero-container {
  display: flex;
  align-items: center;
  gap: 4rem;
  z-index: 1;
}
.hero-text {
  flex: 1.2;
  animation: fadeUp 0.8s cubic-bezier(0.16, 1, 0.3, 1);
  text-align: right;
}
.hero-image {
  flex: 1;
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1;
}
.image-wrapper {
  position: relative;
  width: 100%;
  max-width: 480px;
  animation: heroImageEntrance 1.2s cubic-bezier(0.16, 1, 0.3, 1) backwards;
  animation-delay: 0.2s;
}
.hero-img {
  width: 100%;
  height: auto;
  border-radius: var(--radius-xl);
  box-shadow: 
    0 20px 50px rgba(0,0,0,0.1),
    0 0 0 1px rgba(255,255,255,0.1);
  position: relative;
  z-index: 2;
  animation: float 6s ease-in-out infinite;
  display: block;
  border: 4px solid var(--bg-card);
}
.glow-effect {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 140%;
  height: 140%;
  background: radial-gradient(circle, var(--primary-light) 0%, transparent 70%);
  z-index: 1;
  animation: glowPulse 4s ease-in-out infinite;
  opacity: 0.6;
}

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(30px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes float {
  0%, 100% { transform: translateY(0) rotate(0.5deg); }
  50% { transform: translateY(-20px) rotate(-0.5deg); }
}

@keyframes glowPulse {
  0%, 100% { opacity: 0.4; transform: translate(-50%, -50%) scale(1); }
  50% { opacity: 0.7; transform: translate(-50%, -50%) scale(1.1); }
}

@keyframes heroImageEntrance {
  from { opacity: 0; transform: scale(0.9) translateX(-40px); }
  to { opacity: 1; transform: scale(1) translateX(0); }
}

.hero-school-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.5rem 1rem;
  background: var(--primary-light);
  color: var(--primary);
  border-radius: 99px;
  font-weight: 700;
  font-size: var(--text-xs);
  margin-bottom: 1.5rem;
  gap: 8px;
  border: 1px solid rgba(79, 140, 255, 0.2);
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.5rem 1.25rem;
  background: var(--bg-card);
  color: var(--success);
  border-radius: 99px;
  font-weight: 600;
  font-size: var(--text-sm);
  margin-bottom: 2rem;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
  margin-right: 12px;
}
.hero-title {
  font-size: var(--text-5xl);
  margin-bottom: 1.5rem;
  letter-spacing: -0.03em;
  font-weight: 800;
  line-height: 1.2;
}
.hero-subtitle {
  font-size: var(--text-lg);
  color: var(--text-secondary);
  max-width: 600px;
  margin-bottom: 3rem;
  line-height: 1.8;
}
.hero-actions {
  display: flex;
  gap: 1rem;
  margin-bottom: 4rem;
}
.hero-stats {
  display: flex;
  gap: 3rem;
  border-top: 1px dashed var(--border);
  padding-top: 2.5rem;
}
.stat {
  display: flex;
  flex-direction: column;
}
.stat strong {
  font-size: var(--text-3xl);
  color: var(--text-primary);
  line-height: 1.2;
  font-family: var(--font-english);
}
.stat span {
  font-size: var(--text-xs);
  color: var(--text-muted);
  font-weight: 500;
  margin-top: 0.25rem;
}

/* ============================================================
   7. Year Cards
   ============================================================ */
.section-header {
  text-align: center;
  margin-bottom: 4rem;
}
.section-header h2 {
  font-size: var(--text-3xl);
  margin-bottom: 0.75rem;
}
.section-header p {
  color: var(--text-secondary);
  font-size: var(--text-lg);
}
.year-select {
  padding: 6rem 0;
}
.year-cards {
  display: flex;
  gap: 2rem;
  justify-content: center;
  flex-wrap: wrap;
}
.year-card {
  flex: 1;
  min-width: 280px;
  max-width: 360px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 2.5rem 2rem;
  box-shadow: var(--shadow-md);
  transition: var(--transition-smooth);
  position: relative;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
/* Subte accent line at top instead of full left border */
.year-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: var(--primary);
  opacity: 0.8;
}
.year-card:nth-child(2)::before { background: var(--accent); }
.year-card:nth-child(3)::before { background: var(--warning); }

.year-card:hover {
  transform: translateY(-8px);
  box-shadow: var(--shadow-hover);
  border-color: var(--border-focus);
}

.year-card-icon {
  width: 64px;
  height: 64px;
  background: var(--primary-light);
  color: var(--primary);
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  margin-bottom: 1.5rem;
}
.year-card:nth-child(2) .year-card-icon {
  background: rgba(99, 102, 241, 0.1);
  color: var(--accent);
}
.year-card:nth-child(3) .year-card-icon {
  background: rgba(245, 158, 11, 0.1);
  color: var(--warning);
}

.year-card h3 {
  font-size: var(--text-2xl);
  margin-bottom: 0.5rem;
}
.year-card p {
  color: var(--text-secondary);
  font-size: var(--text-sm);
  margin-bottom: 2rem;
  flex-grow: 1;
}
.year-card-tracks {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
}
.year-card-tracks li {
  font-size: var(--text-xs);
  background: var(--bg-main);
  border: 1px solid var(--border);
  padding: 0.35rem 0.75rem;
  border-radius: 99px;
  color: var(--text-secondary);
  font-weight: 500;
}
.year-card-arrow {
  position: absolute;
  bottom: 2.5rem;
  inset-inline-end: 2rem;
  width: 40px;
  height: 40px;
  background: var(--primary);
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transform: translateX(10px) scale(0.8);
  transition: var(--transition-bounce);
}
.year-card:hover .year-card-arrow {
  opacity: 1;
  transform: translateX(0) scale(1);
}

/* Wide Year Card for BAC Exams */
.year-card-wide {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 2rem 2.5rem;
  box-shadow: var(--shadow-md);
  transition: var(--transition-smooth);
  position: relative;
  display: flex;
  align-items: center;
  gap: 2rem;
  overflow: hidden;
  width: 100%;
  margin-top: 2rem;
}
.year-card-wide::before {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  right: 0;
  width: 4px;
  background: var(--success);
  opacity: 0.8;
}
.year-card-wide:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-hover);
  border-color: var(--border-focus);
}
.year-card-wide .year-card-icon {
  width: 72px;
  height: 72px;
  background: rgba(16, 185, 129, 0.1);
  color: var(--success);
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  margin-bottom: 0;
  flex-shrink: 0;
}
.year-card-wide .year-card-content {
  flex: 1;
}
.year-card-wide h3 {
  font-size: var(--text-2xl);
  margin-bottom: 0.5rem;
}
.year-card-wide p {
  color: var(--text-secondary);
  font-size: var(--text-base);
  margin-bottom: 0;
}
.year-card-wide .year-card-arrow {
  width: 46px;
  height: 46px;
  background: var(--success);
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition-bounce);
  flex-shrink: 0;
}
.year-card-wide:hover .year-card-arrow {
  transform: translateX(-5px) scale(1.05);
}

@media (max-width: 768px) {
  .year-card-wide {
    flex-direction: column;
    text-align: center;
    padding: 2rem 1.5rem;
    gap: 1rem;
  }
}

/* ============================================================
   8. How It Works Section
   ============================================================ */
.how-it-works {
  padding: 6rem 0;
  background: var(--bg-sidebar);
}
.steps-container {
  display: flex;
  justify-content: space-between;
  position: relative;
  max-width: 900px;
  margin: 0 auto;
}
.step {
  text-align: center;
  flex: 1;
  position: relative;
  z-index: 1;
}
.step-number {
  width: 56px;
  height: 56px;
  background: var(--bg-card);
  color: var(--primary);
  border: 2px solid var(--primary-light);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-2xl);
  font-weight: 800;
  font-family: var(--font-english);
  margin: 0 auto 1.5rem;
  box-shadow: 0 0 0 8px var(--bg-sidebar);
  transition: var(--transition-base);
}
.step:hover .step-number {
  background: var(--primary);
  color: white;
  transform: scale(1.1);
  box-shadow: 0 0 0 12px rgba(79, 140, 255, 0.1);
}
.step h3 {
  font-size: var(--text-xl);
  margin-bottom: 0.75rem;
}
.step p {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  padding: 0 1.5rem;
}
.steps-line {
  position: absolute;
  top: 28px;
  left: 15%;
  right: 15%;
  height: 2px;
  background: repeating-linear-gradient(90deg, var(--border) 0, var(--border) 8px, transparent 8px, transparent 16px);
  z-index: 0;
}

/* ============================================================
   9. Featured Subjects
   ============================================================ */
.featured-subjects {
  padding: 6rem 0;
}
.subject-preview-card {
  display: block;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  transition: var(--transition-smooth);
  box-shadow: var(--shadow-sm);
}
.subject-preview-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-hover);
  border-color: var(--primary-light);
}
.subject-icon {
  width: 56px;
  height: 56px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  margin-bottom: 1.25rem;
}
.subject-preview-card h4 {
  font-size: var(--text-lg);
  margin-bottom: 0.5rem;
}
.subject-preview-card p {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  margin-bottom: 1.25rem;
  height: 44px;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
}
.subject-tags {
  display: flex;
  gap: 0.5rem;
}
.tag {
  font-size: var(--text-xs);
  padding: 0.35rem 0.6rem;
  background: var(--bg-sidebar);
  border-radius: 6px;
  color: var(--text-secondary);
  font-weight: 600;
  border: 1px solid var(--border);
}

/* ============================================================
   10. Page Header
   ============================================================ */
.page-header {
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  padding: 3rem 0;
  margin-bottom: 2rem;
}
.page-header-content {
  margin-top: 1rem;
}
.year-badge {
  display: inline-block;
  padding: 0.4rem 1rem;
  background: var(--primary-light);
  color: var(--primary-dark);
  border-radius: 99px;
  font-weight: 700;
  font-size: var(--text-sm);
  margin-bottom: 1.25rem;
  border: 1px solid rgba(79, 140, 255, 0.2);
}
.page-header h1 {
  font-size: var(--text-4xl);
  margin-bottom: 0.5rem;
}

/* ============================================================
   11. Track Cards
   ============================================================ */
.tracks-section {
  padding-bottom: 5rem;
}
.track-card {
  display: flex;
  flex-direction: column;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2rem;
  transition: var(--transition-smooth);
  box-shadow: var(--shadow-sm);
  min-height: 250px;
}
.track-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
  border-color: var(--border-focus);
}
.track-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 1.25rem;
}
.track-icon {
  width: 56px;
  height: 56px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
}
.track-subject-count {
  font-size: var(--text-xs);
  color: var(--text-muted);
  font-weight: 600;
  background: var(--bg-sidebar);
  padding: 0.3rem 0.6rem;
  border-radius: 99px;
  border: 1px solid var(--border);
}
.track-name {
  font-size: var(--text-xl);
  margin-bottom: 0.5rem;
}
.track-desc {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  flex-grow: 1;
  margin-bottom: 1.5rem;
}
.track-subjects-preview {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
}
.track-subjects-preview span {
  font-size: var(--text-xs);
  background: var(--bg-main);
  border: 1px solid var(--border);
  padding: 0.3rem 0.6rem;
  border-radius: 6px;
  color: var(--text-secondary);
}
.track-subjects-preview span.more {
  background: transparent;
  border-color: transparent;
  color: var(--text-muted);
}
.track-cta {
  font-weight: 600;
  color: var(--primary);
  font-size: var(--text-sm);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  border-top: 1px dashed var(--border);
  padding-top: 1.5rem;
}

/* ============================================================
   12. Subject Cards
   ============================================================ */
.subject-card {
  display: flex;
  flex-direction: column;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  transition: var(--transition-smooth);
  box-shadow: var(--shadow-sm);
}
.subject-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
  border-color: var(--primary-light);
}
.subject-card-icon {
  width: 56px;
  height: 56px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  margin-bottom: 1.25rem;
}
.subject-resource-counts {
  display: flex;
  gap: 1rem;
  margin: 1.25rem 0;
  font-size: var(--text-xs);
  color: var(--text-secondary);
  background: var(--bg-main);
  padding: 0.75rem;
  border-radius: var(--radius-md);
}
.subject-resource-counts span {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  cursor: help;
}
.subject-card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: auto;
  border-top: 1px dashed var(--border);
  padding-top: 1.5rem;
}
.subject-card-cta {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--primary);
}

/* ============================================================
   13. Tabs
   ============================================================ */
.tabs-wrapper {
  position: sticky;
  top: 72px; /* Navbar height */
  z-index: 990;
  background: rgba(var(--bg-card-rgb), 0.95);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 4px 6px -1px rgba(0,0,0,0.02);
  padding: 0.5rem 0;
}
.tabs-wrapper .container {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.tabs {
  display: flex;
  gap: 0.5rem;
  overflow-x: auto;
  -ms-overflow-style: none;
  scrollbar-width: none;
  padding: 0.5rem 0;
}
.tabs::-webkit-scrollbar {
  display: none;
}
.tab {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 1.25rem;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 99px;
  color: var(--text-secondary);
  font-weight: 600;
  font-size: var(--text-sm);
  cursor: pointer;
  white-space: nowrap;
  transition: var(--transition-base);
}
.tab:hover {
  background: var(--bg-sidebar);
  color: var(--text-primary);
}
.tab.active {
  background: var(--primary);
  color: white;
  box-shadow: 0 4px 8px rgba(79, 140, 255, 0.2);
}
.tab-count {
  background: var(--bg-sidebar);
  color: var(--text-muted);
  font-size: 0.7rem;
  padding: 0.1rem 0.5rem;
  border-radius: 99px;
  transition: inherit;
}
.tab.active .tab-count {
  background: rgba(255, 255, 255, 0.2);
  color: white;
}
.tab-search {
  padding: 0.5rem 0;
}
.tab-search input {
  padding: 0.6rem 1.25rem;
  border-radius: 99px;
  border: 1px solid var(--border);
  background: var(--bg-main);
  color: var(--text-primary);
  font-size: var(--text-sm);
  width: 200px;
  transition: var(--transition-base);
}
.tab-search input:focus {
  outline: none;
  border-color: var(--primary);
  background: var(--bg-card);
  box-shadow: 0 0 0 3px var(--primary-light);
  width: 250px;
}

/* ============================================================
   14. Tab Panels
   ============================================================ */
.tab-panel {
  display: none;
  padding: 2.5rem 0;
}
.tab-panel.active {
  display: block;
  animation: fadeInPanel 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes fadeInPanel {
  from { opacity: 0; transform: translateY(15px); }
  to { opacity: 1; transform: translateY(0); }
}
.panel-intro {
  margin-bottom: 2rem;
}
.panel-intro h2 {
  font-size: var(--text-2xl);
  margin-bottom: 0.5rem;
}
.chapter-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 2.5rem;
}
.filter-pill {
  padding: 0.5rem 1.25rem;
  border-radius: 99px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  font-size: var(--text-sm);
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition-base);
  box-shadow: var(--shadow-sm);
}
.filter-pill:hover {
  border-color: var(--primary-light);
  background: var(--bg-main);
  transform: translateY(-1px);
}
.filter-pill.active {
  background: var(--primary-light);
  color: var(--primary-dark);
  border-color: var(--primary);
  box-shadow: none;
}
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 5rem 2rem;
  text-align: center;
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  border: 2px dashed var(--border);
}
.empty-icon {
  font-size: 3.5rem;
  margin-bottom: 1.5rem;
  color: var(--text-muted);
  opacity: 0.5;
}
.empty-state h3 {
  font-size: var(--text-xl);
  margin-bottom: 0.5rem;
}
.empty-state p {
  color: var(--text-secondary);
}

/* ============================================================
   15. Channel Cards
   ============================================================ */
.channels-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1.5rem;
}
.channel-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: var(--transition-smooth);
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-sm);
}
.channel-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
  border-color: var(--primary-light);
}
.channel-thumbnail {
  height: 120px;
  background: linear-gradient(135deg, var(--bg-sidebar), var(--bg-main));
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}
.channel-avatar {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  font-weight: 700;
  border: 4px solid var(--bg-card);
  transform: translateY(30px);
  box-shadow: var(--shadow-sm);
}
.platform-badge {
  position: absolute;
  top: 12px;
  inset-inline-end: 12px;
  background: #FF0000;
  color: white;
  font-size: 0.7rem;
  font-weight: 800;
  padding: 4px 8px;
  border-radius: 6px;
  box-shadow: 0 2px 4px rgba(255, 0, 0, 0.3);
}
.channel-info {
  padding: 2.5rem 1.5rem 1.5rem;
  text-align: center;
  flex-grow: 1;
}
.channel-name {
  font-size: var(--text-lg);
  margin-bottom: 0.5rem;
}
.channel-desc {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  margin-bottom: 1.25rem;
}
.channel-meta {
  display: flex;
  justify-content: center;
  gap: 1.25rem;
  font-size: var(--text-sm);
  color: var(--text-muted);
  font-weight: 500;
}
.channel-actions {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--bg-main);
}

/* ============================================================
   16. Resource Items
   ============================================================ */
.resource-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.resource-item {
  display: flex;
  align-items: center;
  padding: 1.25rem 1.5rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  transition: var(--transition-smooth);
  gap: 1.5rem;
  box-shadow: var(--shadow-sm);
}
.resource-item:hover {
  border-color: var(--primary-light);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}
.resource-icon {
  width: 56px;
  height: 56px;
  background: var(--bg-main);
  color: var(--primary);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  flex-shrink: 0;
  border: 1px solid var(--border);
}
.resource-info {
  flex-grow: 1;
}
.resource-info h4 {
  font-size: var(--text-base);
  margin-bottom: 0.35rem;
}
.resource-info p {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
}
.resource-meta {
  display: flex;
  align-items: center;
  gap: 1rem;
  font-size: var(--text-xs);
  color: var(--text-muted);
  font-weight: 500;
}
.tag-chapter {
  background: var(--primary-light);
  color: var(--primary-dark);
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
}
.resource-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* Subject Header details */
.subject-header-content {
  display: flex;
  gap: 2.5rem;
  align-items: flex-start;
}
.subject-hero-icon {
  width: 100px;
  height: 100px;
  background: var(--bg-main);
  border-radius: var(--radius-xl);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 48px;
  flex-shrink: 0;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}
.subject-badges {
  margin-bottom: 1rem;
}
.badge-track {
  display: inline-block;
  padding: 0.35rem 1rem;
  border-radius: 99px;
  font-weight: 600;
  font-size: var(--text-sm);
  margin-inline-start: 0.5rem;
  border: 1px solid var(--border);
  background: var(--bg-card);
}
.subject-header-actions {
  margin-top: 1.5rem;
  display: flex;
  gap: 1rem;
}
.resource-stats-bar {
  display: flex;
  gap: 1rem;
  margin-top: 2.5rem;
  padding-top: 2.5rem;
  border-top: 1px dashed var(--border);
  flex-wrap: wrap;
}
.stat-pill {
  background: var(--bg-sidebar);
  padding: 0.6rem 1.25rem;
  border-radius: 99px;
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text-primary);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
}

/* ============================================================
   17. Breadcrumb
   ============================================================ */
.breadcrumb {
  margin-bottom: 2rem;
}
.breadcrumb ol {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: var(--text-sm);
  padding-inline-start: 0;
}
.breadcrumb a {
  color: var(--text-secondary);
  font-weight: 500;
}
.breadcrumb a:hover {
  color: var(--primary);
}
.breadcrumb .separator {
  color: var(--text-muted);
  font-size: 0.8em;
}
.breadcrumb [aria-current="page"] {
  color: var(--text-primary);
  font-weight: 700;
}

/* ============================================================
   18. Favorite Buttons
   ============================================================ */
.btn-favorite, .btn-favorite-sm {
  background: transparent;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  transition: var(--transition-bounce);
}
.btn-favorite-sm {
  width: 36px;
  height: 36px;
  font-size: 20px;
  border-radius: 50%;
  background: var(--bg-main);
}
.btn-favorite-sm:hover, .btn-favorite:hover {
  color: var(--danger);
  transform: scale(1.15) !important;
  background: var(--languages-light);
}
.btn-favorite-sm.favorited, .btn-favorite.favorited {
  color: var(--danger);
}

/* ============================================================
   19. Toast
   ============================================================ */
.toast {
  position: fixed;
  bottom: 32px;
  inset-inline-start: 32px;
  padding: 16px 24px;
  background: var(--text-primary);
  color: var(--bg-card);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  font-weight: 600;
  transform: translateY(24px);
  opacity: 0;
  transition: var(--transition-bounce);
  z-index: 9999;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.toast::before {
  content: '\f058'; /* fa-circle-check */
  font-family: 'Font Awesome 6 Free';
  font-weight: 900;
  color: var(--success);
  font-size: 1.2rem;
}
.toast.visible {
  transform: translateY(0);
  opacity: 1;
}

/* ============================================================
   20. Footer
   ============================================================ */
.footer {
  background: var(--bg-card);
  border-top: 1px solid var(--border);
  padding: 5rem 0 3rem;
  margin-top: 5rem;
}
.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 3rem;
  margin-bottom: 4rem;
}
.footer-col h5 {
  font-size: var(--text-lg);
  margin-bottom: 1.5rem;
}
.footer-col ul {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  padding-inline-start: 0;
}
.footer-col a {
  color: var(--text-secondary);
  font-size: var(--text-sm);
  font-weight: 500;
}
.footer-col a:hover {
  color: var(--primary);
  padding-inline-start: 4px; /* Slight slide on hover for SaaS feel */
}
.footer-bottom {
  text-align: center;
  padding-top: 2.5rem;
  border-top: 1px solid var(--border);
  font-size: var(--text-sm);
  color: var(--text-muted);
}

/* ============================================================
   21. Responsive break-points
   ============================================================ */
@media (max-width: 1024px) {
  .hero-title {
    font-size: var(--text-4xl);
  }
}

@media (max-width: 768px) {
  .nav-links {
    display: none;
    position: absolute;
    top: 72px;
    left: 0;
    right: 0;
    background: var(--bg-card);
    flex-direction: column;
    padding: 1.5rem 0;
    box-shadow: var(--shadow-md);
    border-bottom: 1px solid var(--border);
  }
  .nav-links.open {
    display: flex;
  }
  .nav-links li {
    width: 100%;
  }
  .nav-links li a {
    display: block;
    padding: 1rem 24px;
    border-bottom: 1px solid var(--border-light);
  }
  .nav-links li a[style*="var(--primary)"]::after {
    display: none; 
  }
  .nav-search {
    width: 160px;
  }
  .nav-search:focus {
    width: 200px;
  }
  .hamburger {
    display: flex;
  }

  .tabs-wrapper {
    top: 72px;
  }
  .tabs-wrapper .container {
    flex-direction: column;
    align-items: stretch;
  }
  .tab-search {
    padding: 1rem 24px;
    border-top: 1px solid var(--border);
  }
  .tab-search input {
    width: 100%;
  }
  .tab-search input:focus {
    width: 100%;
  }

  .steps-container {
    flex-direction: column;
    gap: 4rem;
  }
  .steps-line {
    display: none;
  }

  .subject-header-content {
    flex-direction: column;
  }
  .subject-hero-icon {
    width: 80px;
    height: 80px;
    font-size: 36px;
  }
  .resource-item {
    flex-direction: column;
    align-items: flex-start;
  }
  .resource-actions {
    width: 100%;
    margin-top: 1rem;
    justify-content: flex-end;
  }

  .footer-grid {
    grid-template-columns: 1fr;
    gap: 2rem;
  }
}

@media (max-width: 480px) {
  .hero-title {
    font-size: var(--text-3xl);
  }
  .hero-actions {
    flex-direction: column;
  }
  .hero-stats {
    flex-direction: column;
    gap: 2rem;
  }
  
  .nav-search {
    display: none;
  }

  .year-cards {
    flex-direction: column;
  }
  .year-card {
    max-width: 100%;
  }
}
/* Term Sections in Exams Tab */
.term-section {
    margin-bottom: 2.5rem;
    animation: fadeIn 0.5s ease-out;
}

.term-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1.25rem;
    padding-bottom: 0.75rem;
    border-bottom: 2px solid var(--border-light);
    position: relative;
}

.term-header::after {
    content: '';
    position: absolute;
    bottom: -2px;
    right: 0;
    width: 60px;
    height: 2px;
    background: var(--primary);
}

.term-header h3 {
    font-size: var(--text-lg);
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
}

.term-badge {
    padding: 0.25rem 0.75rem;
    background: var(--primary-light);
    color: var(--primary);
    border-radius: 99px;
    font-size: var(--text-xs);
    font-weight: 700;
}

.term-empty-card {
    background: rgba(var(--bg-card-rgb), 0.4);
    border: 1px dashed var(--border);
    border-radius: var(--radius-lg);
    padding: 2rem;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    transition: var(--transition-base);
}

.term-empty-card:hover {
    background: rgba(var(--bg-card-rgb), 0.6);
    border-color: var(--primary-light);
}

.term-empty-icon {
    font-size: 1.5rem;
    color: var(--text-muted);
    opacity: 0.5;
}

.term-empty-card p {
    color: var(--text-muted);
    font-size: var(--text-sm);
    margin: 0;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Responsive Overrides for Hero */
/* ============================================================
   22. Favorites Page & Tasks
   ============================================================ */
.fav-category-section {
    margin-bottom: 4rem;
    animation: fadeIn 0.6s ease-out backwards;
}

.section-title-wrap {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border);
}

.category-title {
    font-size: var(--text-xl);
    margin: 0;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.category-count {
    background: var(--primary-light);
    color: var(--primary);
    padding: 0.2rem 0.75rem;
    border-radius: 99px;
    font-size: var(--text-sm);
    font-weight: 700;
}

/* Tasks */
.task-input-group {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
    background: var(--bg-card);
    padding: 0.5rem;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
}

.task-input-group input {
    flex-grow: 1;
    border: none;
    background: transparent;
    padding: 0.5rem 1rem;
    font-size: var(--text-base);
    color: var(--text-primary);
    outline: none;
}

.tasks-list {
    display: grid;
    gap: 0.75rem;
}

.task-item {
    background: var(--bg-card);
    border: 1px solid var(--border);
    padding: 1rem 1.25rem;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: var(--transition-base);
    animation: slideInLeft 0.3s ease-out backwards;
}

.task-item:hover {
    border-color: var(--primary);
    transform: translateX(-4px);
    box-shadow: var(--shadow-sm);
}

.task-text {
    color: var(--text-primary);
    font-weight: 500;
}

.btn-task-delete {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0.5rem;
    border-radius: var(--radius-sm);
    transition: var(--transition-base);
}

.btn-task-delete:hover {
    color: var(--danger);
    background: var(--languages-light);
}

/* Floating Favorite for Channels */
.floating-fav {
    position: absolute;
    top: 10px;
    left: 10px;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(4px);
    box-shadow: var(--shadow-sm);
    border-radius: 50% !important;
    z-index: 10;
}

[data-theme="dark"] .floating-fav {
    background: rgba(var(--bg-card-rgb), 0.8);
}

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

