/* ==========================================
   Najhin - نجحين - Math Education Website
   CSS Stylesheet
   ========================================== */

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

/* --- CSS Variables (Light Mode) --- */
:root {
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --primary-light: #3b82f6;
  --secondary: #0f172a;
  --accent: #f59e0b;
  --success: #10b981;
  --danger: #ef4444;

  --bg: #f8fafc;
  --bg-card: #ffffff;
  --bg-nav: #ffffff;
  --bg-footer: #0f172a;
  --bg-hero: linear-gradient(135deg, #1e3a8a 0%, #2563eb 50%, #3b82f6 100%);
  --bg-section-alt: #f1f5f9;

  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #94a3b8;
  --text-on-primary: #ffffff;
  --text-on-dark: #e2e8f0;

  --border: #e2e8f0;
  --border-focus: #2563eb;

  --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.10);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.12);
  --shadow-hover: 0 12px 40px rgba(37,99,235,0.18);

  --radius-sm: 8px;
  --radius-md: 16px;
  --radius-lg: 24px;
  --radius-xl: 32px;

  --transition: all 0.3s ease;
  --font: 'Cairo', sans-serif;
}

/* --- Dark Mode Variables --- */
[data-theme="dark"] {
  --bg: #0f172a;
  --bg-card: #1e293b;
  --bg-nav: #1e293b;
  --bg-footer: #020617;
  --bg-hero: linear-gradient(135deg, #0f172a 0%, #1e3a8a 50%, #1d4ed8 100%);
  --bg-section-alt: #1a2744;

  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --text-on-dark: #cbd5e1;

  --border: #334155;
  --border-focus: #3b82f6;

  --shadow-sm: 0 1px 3px rgba(0,0,0,0.3);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.4);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.5);
  --shadow-hover: 0 12px 40px rgba(59,130,246,0.25);
}

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

html {
  scroll-behavior: smooth;
  font-size: 16px;
}

body {
  font-family: var(--font);
  background-color: var(--bg);
  color: var(--text-primary);
  direction: rtl;
  text-align: right;
  transition: background-color 0.3s ease, color 0.3s ease;
  line-height: 1.7;
  overflow-x: hidden;
}

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

img {
  max-width: 100%;
  height: auto;
  display: block;
}

ul, ol {
  list-style: none;
}

button {
  font-family: var(--font);
  cursor: pointer;
  border: none;
  outline: none;
  transition: var(--transition);
}

input, textarea, select {
  font-family: var(--font);
  outline: none;
  border: none;
}

/* ==========================================
   NAVBAR
   ========================================== */
.navbar {
  background: var(--bg-nav);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 1000;
  box-shadow: var(--shadow-sm);
  transition: background-color 0.3s ease;
}

.nav-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 70px;
  gap: 1rem;
}

.nav-logo {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--primary);
  flex-shrink: 0;
}

.nav-logo .logo-icon {
  width: 40px;
  height: 40px;
  background: var(--primary);
  color: white;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
}

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

.nav-links a {
  padding: 0.5rem 1rem;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--text-secondary);
  white-space: nowrap;
}

.nav-links a:hover,
.nav-links a.active {
  color: var(--primary);
  background: rgba(37,99,235,0.08);
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}

.btn-theme-toggle {
  width: 42px;
  height: 42px;
  border-radius: var(--radius-sm);
  background: var(--bg-section-alt);
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  border: 1px solid var(--border);
}

.btn-theme-toggle:hover {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

.btn-menu {
  display: none;
  width: 42px;
  height: 42px;
  border-radius: var(--radius-sm);
  background: var(--bg-section-alt);
  color: var(--text-secondary);
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  border: 1px solid var(--border);
}

.mobile-menu {
  display: none;
  flex-direction: column;
  gap: 0.25rem;
  padding: 1rem 1.5rem;
  background: var(--bg-nav);
  border-top: 1px solid var(--border);
}

.mobile-menu.open {
  display: flex;
}

.mobile-menu a {
  padding: 0.75rem 1rem;
  border-radius: var(--radius-sm);
  font-weight: 600;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.mobile-menu a:hover,
.mobile-menu a.active {
  color: var(--primary);
  background: rgba(37,99,235,0.08);
}

/* ==========================================
   HERO SECTION
   ========================================== */
.hero {
  background: var(--bg-hero);
  padding: 5rem 1.5rem;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.hero::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -20%;
  width: 600px;
  height: 600px;
  background: rgba(255,255,255,0.04);
  border-radius: 50%;
  pointer-events: none;
}

.hero::after {
  content: '';
  position: absolute;
  bottom: -30%;
  right: -10%;
  width: 400px;
  height: 400px;
  background: rgba(255,255,255,0.04);
  border-radius: 50%;
  pointer-events: none;
}

.hero-content {
  max-width: 780px;
  margin: 0 auto;
  position: relative;
  z-index: 1;
}

.hero-badge {
  display: inline-block;
  background: rgba(255,255,255,0.15);
  color: white;
  padding: 0.4rem 1.2rem;
  border-radius: 50px;
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 1.5rem;
  border: 1px solid rgba(255,255,255,0.25);
  backdrop-filter: blur(10px);
}

.hero h1 {
  font-size: clamp(2rem, 5vw, 3.5rem);
  font-weight: 900;
  color: white;
  line-height: 1.2;
  margin-bottom: 1.2rem;
}

.hero h1 span {
  color: var(--accent);
}

.hero-subtitle {
  font-size: clamp(1rem, 2.5vw, 1.25rem);
  color: rgba(255,255,255,0.85);
  margin-bottom: 2.5rem;
  font-weight: 400;
}

/* Search Bar */
.search-container {
  max-width: 580px;
  margin: 0 auto 2rem;
  position: relative;
}

.search-wrapper {
  display: flex;
  background: white;
  border-radius: 50px;
  overflow: hidden;
  box-shadow: 0 8px 32px rgba(0,0,0,0.2);
}

.search-input {
  flex: 1;
  padding: 1rem 1.5rem;
  font-size: 1rem;
  font-family: var(--font);
  color: var(--secondary);
  background: transparent;
  direction: rtl;
}

.search-input::placeholder {
  color: #94a3b8;
}

.search-btn {
  padding: 0.8rem 1.5rem;
  background: var(--primary);
  color: white;
  font-size: 1rem;
  border-radius: 50px;
  margin: 4px;
}

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

/* Search Results Dropdown */
.search-results {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  left: 0;
  background: white;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  max-height: 320px;
  overflow-y: auto;
  z-index: 100;
  display: none;
}

.search-results.show {
  display: block;
}

.search-result-item {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.85rem 1.2rem;
  border-bottom: 1px solid #f1f5f9;
  cursor: pointer;
  transition: var(--transition);
}

.search-result-item:last-child {
  border-bottom: none;
}

.search-result-item:hover {
  background: #f0f7ff;
}

.search-result-item .result-icon {
  width: 36px;
  height: 36px;
  background: rgba(37,99,235,0.1);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--primary);
  flex-shrink: 0;
}

.search-result-item .result-info {
  text-align: right;
}

.search-result-item .result-title {
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--secondary);
}

.search-result-item .result-level {
  font-size: 0.8rem;
  color: #64748b;
}

.no-results {
  padding: 1.5rem;
  text-align: center;
  color: #64748b;
  font-size: 0.95rem;
}

.hero-cta-group {
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
}

/* ==========================================
   BUTTONS
   ========================================== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.8rem 1.8rem;
  border-radius: 50px;
  font-weight: 700;
  font-size: 1rem;
  font-family: var(--font);
  transition: var(--transition);
  cursor: pointer;
  border: 2px solid transparent;
}

.btn-primary {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
  box-shadow: 0 4px 16px rgba(37,99,235,0.35);
}

.btn-primary:hover {
  background: var(--primary-dark);
  border-color: var(--primary-dark);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(37,99,235,0.45);
}

.btn-outline {
  background: transparent;
  color: white;
  border-color: rgba(255,255,255,0.5);
}

.btn-outline:hover {
  background: rgba(255,255,255,0.15);
  border-color: white;
}

.btn-outline-primary {
  background: transparent;
  color: var(--primary);
  border-color: var(--primary);
}

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

.btn-sm {
  padding: 0.5rem 1.2rem;
  font-size: 0.9rem;
}

.btn-lg {
  padding: 1rem 2.2rem;
  font-size: 1.1rem;
}

/* ==========================================
   SECTIONS
   ========================================== */
.section {
  padding: 5rem 1.5rem;
}

.section-alt {
  background: var(--bg-section-alt);
}

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

.section-header {
  text-align: center;
  margin-bottom: 3.5rem;
}

.section-label {
  display: inline-block;
  background: rgba(37,99,235,0.1);
  color: var(--primary);
  padding: 0.35rem 1rem;
  border-radius: 50px;
  font-size: 0.85rem;
  font-weight: 700;
  margin-bottom: 1rem;
}

.section-header h2 {
  font-size: clamp(1.6rem, 3.5vw, 2.5rem);
  font-weight: 800;
  color: var(--text-primary);
  margin-bottom: 0.75rem;
  line-height: 1.3;
}

.section-header p {
  font-size: 1.05rem;
  color: var(--text-secondary);
  max-width: 580px;
  margin: 0 auto;
}

/* ==========================================
   STATS SECTION
   ========================================== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
}

.stat-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 2.5rem 2rem;
  text-align: center;
  box-shadow: var(--shadow-md);
  border: 1px solid var(--border);
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: var(--primary);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.stat-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-hover);
}

.stat-icon {
  width: 64px;
  height: 64px;
  background: rgba(37,99,235,0.1);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.8rem;
  margin: 0 auto 1rem;
  color: var(--primary);
}

.stat-number {
  font-size: 2.8rem;
  font-weight: 900;
  color: var(--primary);
  line-height: 1;
  margin-bottom: 0.4rem;
}

.stat-label {
  font-size: 1rem;
  color: var(--text-secondary);
  font-weight: 600;
}

/* ==========================================
   LEVEL CARDS
   ========================================== */
.levels-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
}

.level-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 2.5rem 2rem;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-md);
  transition: var(--transition);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.level-card::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: var(--card-color, var(--primary));
  transition: var(--transition);
}

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

.level-card:hover::after {
  height: 6px;
}

.level-icon {
  width: 80px;
  height: 80px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.2rem;
  margin-bottom: 1.5rem;
  background: var(--card-bg, rgba(37,99,235,0.1));
  color: var(--card-color, var(--primary));
  transition: var(--transition);
}

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

.level-card h3 {
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--text-primary);
  margin-bottom: 0.75rem;
}

.level-card p {
  font-size: 0.95rem;
  color: var(--text-secondary);
  margin-bottom: 1.5rem;
  line-height: 1.6;
}

.level-meta {
  display: flex;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
  justify-content: center;
}

.level-meta .badge {
  padding: 0.3rem 0.8rem;
  border-radius: 50px;
  font-size: 0.8rem;
  font-weight: 600;
  background: var(--bg-section-alt);
  color: var(--text-secondary);
}

/* ==========================================
   LESSON CARDS
   ========================================== */
.lessons-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.5rem;
}

.lesson-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

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

.lesson-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
}

.lesson-number {
  width: 44px;
  height: 44px;
  background: rgba(37,99,235,0.1);
  color: var(--primary);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 1rem;
  flex-shrink: 0;
}

.lesson-badge {
  padding: 0.3rem 0.75rem;
  border-radius: 50px;
  font-size: 0.78rem;
  font-weight: 700;
  white-space: nowrap;
}

.badge-tronc {
  background: rgba(16,185,129,0.12);
  color: #059669;
}

.badge-1bac {
  background: rgba(37,99,235,0.12);
  color: #2563eb;
}

.badge-2bac {
  background: rgba(139,92,246,0.12);
  color: #7c3aed;
}

.lesson-card h3 {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.4;
}

.lesson-card p {
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.6;
  flex: 1;
}

.lesson-card-footer {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
}

.lesson-card-footer .btn {
  flex: 1;
  justify-content: center;
}

.lesson-icon-group {
  display: flex;
  gap: 0.5rem;
}

.lesson-icon-btn {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-sm);
  background: var(--bg-section-alt);
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  border: 1px solid var(--border);
  transition: var(--transition);
}

.lesson-icon-btn:hover {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

/* ==========================================
   LEVEL PAGE HEADER
   ========================================== */
.page-header {
  background: var(--bg-hero);
  padding: 4rem 1.5rem;
  text-align: center;
  color: white;
}

.breadcrumb {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  justify-content: center;
  margin-bottom: 1.5rem;
  font-size: 0.9rem;
  color: rgba(255,255,255,0.7);
}

.breadcrumb a {
  color: rgba(255,255,255,0.7);
}

.breadcrumb a:hover {
  color: white;
}

.breadcrumb .separator {
  font-size: 0.7rem;
  opacity: 0.5;
}

.page-header h1 {
  font-size: clamp(1.8rem, 4vw, 3rem);
  font-weight: 900;
  margin-bottom: 1rem;
}

.page-header p {
  font-size: 1.1rem;
  opacity: 0.85;
  max-width: 600px;
  margin: 0 auto;
}

/* ==========================================
   LESSON PAGE
   ========================================== */
.lesson-page {
  max-width: 900px;
  margin: 0 auto;
  padding: 3rem 1.5rem;
}

.lesson-header {
  margin-bottom: 2rem;
}

.lesson-header .breadcrumb {
  justify-content: flex-end;
  margin-bottom: 1.25rem;
  color: var(--text-muted);
}

.lesson-header .breadcrumb a {
  color: var(--text-muted);
}

.lesson-header h1 {
  font-size: clamp(1.6rem, 3.5vw, 2.5rem);
  font-weight: 900;
  color: var(--text-primary);
  margin-bottom: 1rem;
  line-height: 1.3;
}

.lesson-meta-row {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  align-items: center;
}

.lesson-meta-row .lesson-badge {
  font-size: 0.85rem;
}

.lesson-desc {
  font-size: 1.05rem;
  color: var(--text-secondary);
  line-height: 1.75;
  margin: 1.5rem 0 2rem;
}

/* Video Section */
.video-section {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-md);
  margin-bottom: 2rem;
}

.video-label {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border);
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.video-label i {
  color: var(--danger);
}

.video-wrapper {
  position: relative;
  padding-bottom: 56.25%;
  height: 0;
  overflow: hidden;
}

.video-wrapper iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: none;
}

.video-placeholder {
  padding: 4rem 2rem;
  text-align: center;
  background: var(--bg-section-alt);
}

.video-placeholder i {
  font-size: 4rem;
  color: var(--danger);
  margin-bottom: 1rem;
}

.video-placeholder p {
  color: var(--text-secondary);
  font-size: 1rem;
}

/* PDF Section */
.pdf-section {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-md);
  margin-bottom: 2rem;
}

.pdf-section h3 {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 1.25rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.pdf-section h3 i {
  color: var(--danger);
}

.pdf-actions {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

/* Related Lessons */
.related-section {
  margin-bottom: 2rem;
}

.related-section h3 {
  font-size: 1.3rem;
  font-weight: 800;
  color: var(--text-primary);
  margin-bottom: 1.5rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* ==========================================
   CTA SECTION
   ========================================== */
.cta-section {
  background: var(--bg-hero);
  padding: 5rem 1.5rem;
  text-align: center;
  color: white;
}

.cta-section h2 {
  font-size: clamp(1.6rem, 3.5vw, 2.5rem);
  font-weight: 900;
  margin-bottom: 1rem;
}

.cta-section p {
  font-size: 1.1rem;
  opacity: 0.85;
  margin-bottom: 2.5rem;
  max-width: 540px;
  margin-left: auto;
  margin-right: auto;
}

.cta-group {
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
}

/* ==========================================
   FOOTER
   ========================================== */
.footer {
  background: var(--bg-footer);
  color: var(--text-on-dark);
  padding: 4rem 1.5rem 2rem;
}

.footer-grid {
  max-width: 1200px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 3rem;
  padding-bottom: 3rem;
  border-bottom: 1px solid rgba(255,255,255,0.1);
  margin-bottom: 2rem;
}

.footer-brand .nav-logo {
  color: white;
  margin-bottom: 1rem;
}

.footer-brand p {
  font-size: 0.95rem;
  color: rgba(255,255,255,0.6);
  line-height: 1.7;
}

.footer-col h4 {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 1.25rem;
  color: white;
}

.footer-col ul {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.footer-col ul li a {
  color: rgba(255,255,255,0.6);
  font-size: 0.9rem;
  transition: var(--transition);
}

.footer-col ul li a:hover {
  color: white;
  padding-right: 0.25rem;
}

.footer-bottom {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
}

.footer-bottom p {
  font-size: 0.85rem;
  color: rgba(255,255,255,0.45);
}

.footer-social {
  display: flex;
  gap: 0.75rem;
}

.footer-social a {
  width: 36px;
  height: 36px;
  background: rgba(255,255,255,0.08);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(255,255,255,0.6);
  font-size: 0.9rem;
  transition: var(--transition);
}

.footer-social a:hover {
  background: var(--primary);
  color: white;
}

/* ==========================================
   FILTER BAR (Level Pages)
   ========================================== */
.filter-bar {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 2rem;
  flex-wrap: wrap;
}

.filter-bar .filter-label {
  font-weight: 700;
  color: var(--text-secondary);
  white-space: nowrap;
}

.filter-tabs {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.filter-tab {
  padding: 0.5rem 1.2rem;
  border-radius: 50px;
  font-weight: 600;
  font-size: 0.9rem;
  border: 2px solid var(--border);
  background: var(--bg-card);
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition);
}

.filter-tab.active,
.filter-tab:hover {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

/* ==========================================
   EMPTY STATE
   ========================================== */
.empty-state {
  text-align: center;
  padding: 5rem 2rem;
  color: var(--text-muted);
}

.empty-state i {
  font-size: 4rem;
  margin-bottom: 1.5rem;
  display: block;
}

.empty-state h3 {
  font-size: 1.3rem;
  font-weight: 700;
  margin-bottom: 0.75rem;
  color: var(--text-secondary);
}

/* ==========================================
   SCROLL TO TOP
   ========================================== */
.scroll-top {
  position: fixed;
  bottom: 2rem;
  left: 1.5rem;
  width: 48px;
  height: 48px;
  background: var(--primary);
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-md);
  cursor: pointer;
  transition: var(--transition);
  opacity: 0;
  pointer-events: none;
  z-index: 999;
  font-size: 1.1rem;
}

.scroll-top.show {
  opacity: 1;
  pointer-events: all;
}

.scroll-top:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-hover);
}

/* ==========================================
   UTILITIES
   ========================================== */
.text-center { text-align: center; }
.text-primary { color: var(--primary) !important; }
.text-success { color: var(--success) !important; }
.text-danger { color: var(--danger) !important; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.gap-1 { gap: 0.5rem; }
.flex { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.w-full { width: 100%; }

/* Loading Spinner */
.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 3rem auto;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ==========================================
   RESPONSIVE - TABLET
   ========================================== */
@media (max-width: 1024px) {
  .levels-grid {
    grid-template-columns: repeat(2, 1fr);
  }

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

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

/* ==========================================
   RESPONSIVE - MOBILE
   ========================================== */
@media (max-width: 768px) {
  .nav-links {
    display: none;
  }

  .btn-menu {
    display: flex;
  }

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

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

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

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

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

  .hero {
    padding: 3.5rem 1.25rem;
  }

  .section {
    padding: 3.5rem 1.25rem;
  }

  .cta-section {
    padding: 3.5rem 1.25rem;
  }

  .hero-cta-group {
    flex-direction: column;
    align-items: center;
  }

  .search-wrapper {
    flex-direction: row;
  }

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

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

  .lesson-meta-row {
    flex-direction: column;
    align-items: flex-start;
  }

  .lesson-card-footer {
    flex-wrap: wrap;
  }

  .filter-bar {
    flex-direction: column;
    align-items: flex-start;
  }
}

@media (max-width: 480px) {
  .nav-logo span {
    display: none;
  }

  .stat-number {
    font-size: 2.2rem;
  }

  .stat-card {
    padding: 1.75rem 1.25rem;
  }

  .level-card {
    padding: 1.75rem 1.25rem;
  }
}
