@import url('https://fonts.googleapis.com/css2?family=Syne:wght@400;600;700;800&family=DM+Sans:wght@300;400;500;600&display=swap');

:root {
  --bg: #0b1220;
  --bg2: #0f1a2e;
  --bg3: #142035;
  --surface: #162340;
  --surface2: #1c2d50;
  --border: #1e3356;
  --green: #22c55e;
  --green-dim: #16a34a;
  --green-glow: rgba(34,197,94,0.18);
  --green-glow2: rgba(34,197,94,0.08);
  --text: #e8f0fe;
  --text2: #8eafd4;
  --text3: #4d6a8f;
  --white: #ffffff;
  --radius: 14px;
  --radius-sm: 8px;
  --shadow: 0 4px 32px rgba(0,0,0,0.45);
  --shadow-green: 0 0 28px rgba(34,197,94,0.2);
  --transition: 0.25s cubic-bezier(0.4,0,0.2,1);
  --blue-accent: #3b82f6;
  --purple-accent: #a855f7;
  --pink-accent: #ec4899;
  --amber-accent: #f59e0b;

  /* Système d'ombres à plusieurs couches — remplace les box-shadow plates */
  --shadow-ambient: 0 1px 2px rgba(0,0,0,0.3), 0 12px 28px -8px rgba(0,0,0,0.5), 0 32px 64px -24px rgba(0,0,0,0.45);
  --shadow-lift: 0 1px 1px rgba(0,0,0,0.25), 0 8px 16px -4px rgba(0,0,0,0.4);
  --inner-hairline: inset 0 1px 0 rgba(255,255,255,0.045);
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
}

/* Respecte les préférences système : coupe les animations non essentielles */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}

html { color-scheme: dark; }

/* Grain subtil pour casser la platitude du dégradé de fond — très discret */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  opacity: 0.03;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* Firefox */
* { scrollbar-color: var(--green-dim) transparent; scrollbar-width: thin; }

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

html { scroll-behavior: smooth; }

/* ──────── LOADER INITIAL ────────── */
#page-loader {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(135deg, #0b1220 0%, #0f1a2e 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  opacity: 1;
  transition: opacity 0.6s ease;
}

#page-loader.hidden {
  opacity: 0;
  pointer-events: none;
}

.loader-content {
  text-align: center;
}

.loader-spinner {
  width: 50px;
  height: 50px;
  border: 3px solid rgba(34, 197, 94, 0.2);
  border-top: 3px solid #22c55e;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 20px;
}

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

.loader-text {
  color: #8eafd4;
  font-size: 0.9rem;
  font-weight: 500;
  margin-top: 10px;
}

/* ──────── BODY & BASE ────────── */
body {
  font-family: 'DM Sans', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
  position: relative;
}

/* Animated background gradient */
body::before {
  content: '';
  position: fixed;
  top: -200px;
  left: 50%;
  transform: translateX(-50%);
  width: 900px;
  height: 600px;
  background: radial-gradient(ellipse at center, rgba(34, 197, 94, 0.08) 0%, transparent 70%);
  pointer-events: none;
  z-index: 0;
  animation: gradientShift 8s ease-in-out infinite;
}

@keyframes gradientShift {
  0%, 100% { transform: translateX(-50%) translateY(0); opacity: 0.8; }
  50% { transform: translateX(-50%) translateY(20px); opacity: 1; }
}

/* ──────── NAVBAR IMPROVED ────────── */
nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: linear-gradient(180deg, rgba(11, 18, 32, 0.95) 0%, rgba(15, 26, 46, 0.8) 100%);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid rgba(34, 197, 94, 0.15);
  padding: 0 clamp(16px, 5vw, 64px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 68px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
  transition: all var(--transition);
}

.edtn-prompt-overlay {
  position: fixed;
  inset: 0;
  z-index: 100000;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(3, 10, 20, 0.78);
  backdrop-filter: blur(8px);
}

.edtn-prompt-box {
  width: min(440px, 100%);
  padding: 28px;
  border: 1px solid rgba(34, 197, 94, 0.3);
  border-radius: var(--radius, 14px);
  background: linear-gradient(145deg, var(--surface2), var(--surface));
  color: var(--white);
  text-align: center;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.45);
  animation: edtnPromptIn 180ms ease-out;
}

.edtn-prompt-message { margin: 0; line-height: 1.8; color: var(--text); }
.edtn-prompt-actions { display: flex; justify-content: center; gap: 10px; margin-top: 24px; }
.edtn-prompt-actions button { border: 0; border-radius: var(--radius-sm, 8px); padding: 11px 20px; cursor: pointer; font: inherit; font-weight: 700; }
.edtn-prompt-cancel { background: var(--surface2); color: var(--text); }
.edtn-prompt-confirm { background: var(--green); color: var(--bg); }
@keyframes edtnPromptIn { from { opacity: 0; transform: translateY(8px) scale(.98); } to { opacity: 1; transform: none; } }

nav.scrolled {
  background: rgba(11, 18, 32, 0.98);
  border-bottom-color: rgba(34, 197, 94, 0.25);
  box-shadow: 0 8px 40px rgba(34, 197, 94, 0.1);
}

.nav-logo {
  font-family: 'Syne', sans-serif;
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--white);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 10px;
  transition: transform var(--transition);
}

.nav-logo:hover {
  transform: scale(1.05);
}

.nav-logo span {
  background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
  color: #0b1220;
  padding: 3px 9px;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  box-shadow: 0 0 12px rgba(34, 197, 94, 0.3);
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 4px;
  list-style: none;
}

.nav-links a {
  display: block;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  color: var(--text2);
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 500;
  transition: all var(--transition);
  position: relative;
}

.nav-links a::before {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--green);
  transform: scaleX(0);
  transform-origin: right;
  transition: transform var(--transition);
}

.nav-links a:hover,
.nav-links a.active {
  color: var(--green);
  background: rgba(34, 197, 94, 0.1);
}

.nav-links a:hover::before,
.nav-links a.active::before {
  transform: scaleX(1);
  transform-origin: left;
}

.nav-hamburger {
  display: none;
  flex-direction: column;
  gap: 5px;
  cursor: pointer;
  padding: 6px;
  transition: transform var(--transition);
}

.nav-hamburger:hover {
  transform: scale(1.1);
}

.nav-hamburger span {
  display: block;
  width: 24px;
  height: 2px;
  background: var(--text2);
  border-radius: 2px;
  transition: all var(--transition);
}

.nav-hamburger.open span:nth-child(1) {
  transform: rotate(45deg) translateY(10px);
}

.nav-hamburger.open span:nth-child(2) {
  opacity: 0;
}

.nav-hamburger.open span:nth-child(3) {
  transform: rotate(-45deg) translateY(-10px);
}

.mobile-menu {
  display: none;
  position: fixed;
  top: 68px;
  left: 0;
  right: 0;
  background: linear-gradient(180deg, rgba(11, 18, 32, 0.98) 0%, rgba(15, 26, 46, 0.95) 100%);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
  padding: 16px;
  z-index: 99;
  flex-direction: column;
  gap: 4px;
  animation: slideDown 0.3s ease;
}

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

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

.mobile-menu a {
  display: block;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  color: var(--text2);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  transition: all var(--transition);
}

.mobile-menu a:hover,
.mobile-menu a.active {
  color: var(--green);
  background: rgba(34, 197, 94, 0.15);
  transform: translateX(8px);
}

/* ──────── HERO SECTION ────────── */
.hero {
  position: relative;
  z-index: 1;
  padding: clamp(60px, 10vw, 120px) clamp(16px, 5vw, 64px) clamp(40px, 6vw, 80px);
  text-align: center;
  overflow: hidden;
}

.hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse 80% 60% at 50% 0%, rgba(34, 197, 94, 0.12) 0%, transparent 70%);
  pointer-events: none;
  animation: float 6s ease-in-out infinite;
}

@keyframes float {
  0%, 100% { transform: translateY(0px); }
  50% { transform: translateY(10px); }
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 16px;
  border-radius: 999px;
  background: rgba(34, 197, 94, 0.1);
  border: 1px solid rgba(34, 197, 94, 0.3);
  color: var(--green);
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  margin-bottom: 24px;
  animation: fadeUp 0.6s ease both;
  backdrop-filter: blur(10px);
}

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

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

.hero h1 {
  font-family: 'Syne', sans-serif;
  font-size: clamp(2.2rem, 5.5vw, 4.2rem);
  font-weight: 800;
  line-height: 1.1;
  margin-bottom: 20px;
  animation: fadeUp 0.6s 0.1s ease both;
  background: linear-gradient(135deg, #ffffff 0%, #8eafd4 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero h1 em {
  font-style: normal;
  color: var(--green);
  position: relative;
}

.hero h1 em::before {
  content: '';
  position: absolute;
  inset: -4px -8px;
  background: rgba(34, 197, 94, 0.1);
  border-radius: 8px;
  z-index: -1;
}

.hero p {
  max-width: 600px;
  margin: 0 auto 40px;
  color: var(--text2);
  font-size: clamp(0.95rem, 2vw, 1.1rem);
  line-height: 1.7;
  animation: fadeUp 0.6s 0.2s ease both;
}

.hero-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
  animation: fadeUp 0.6s 0.3s ease both;
}

/* ──────── BUTTONS ────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 24px;
  border-radius: var(--radius-sm);
  font-family: 'DM Sans', sans-serif;
  font-size: 0.9rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  border: none;
  outline: none;
  transition: all var(--transition);
  position: relative;
  overflow: hidden;
}

.btn::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.1), transparent);
  opacity: 0;
  transition: opacity var(--transition);
}

.btn:hover::before {
  opacity: 1;
}

.btn-primary {
  background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
  color: #0b1220;
  box-shadow: 0 0 20px rgba(34, 197, 94, 0.3);
}

.btn-primary:hover {
  box-shadow: 0 0 30px rgba(34, 197, 94, 0.6);
  transform: translateY(-3px);
}

/* Le ghost reste neutre (slate) pour que le vert primaire garde toute sa force
   hiérarchique — deux boutons verts côte à côte se neutralisent visuellement. */
.btn-ghost {
  background: rgba(142, 175, 212, 0.05);
  color: var(--text2);
  border: 1px solid var(--border);
  backdrop-filter: blur(10px);
}

.btn-ghost:hover {
  border-color: rgba(142, 175, 212, 0.5);
  color: var(--text);
  background: rgba(142, 175, 212, 0.08);
  transform: translateY(-3px);
}

.btn-download {
  background: rgba(34, 197, 94, 0.1);
  color: var(--green);
  border: 1px solid rgba(34, 197, 94, 0.4);
  padding: 8px 18px;
  font-size: 0.82rem;
  border-radius: var(--radius-sm);
}

.btn-download:hover {
  background: var(--green);
  color: #0b1220;
  box-shadow: var(--shadow-green);
  transform: translateY(-1px);
}

.btn-download svg {
  width: 14px;
  height: 14px;
}

/* ──────── STATS SECTION ────────── */
.stats-row {
  display: flex;
  justify-content: center;
  gap: clamp(24px, 5vw, 64px);
  flex-wrap: wrap;
  padding: 48px clamp(16px, 5vw, 64px);
  border-top: 1px solid rgba(34, 197, 94, 0.1);
  border-bottom: 1px solid rgba(34, 197, 94, 0.1);
  background: linear-gradient(135deg, rgba(34, 197, 94, 0.03) 0%, transparent 100%);
  animation: fadeUp 0.6s 0.4s ease both;
}

.stat-item {
  text-align: center;
  position: relative;
}

.stat-item:not(:last-child)::after {
  content: '';
  position: absolute;
  right: -50%;
  top: 50%;
  transform: translateY(-50%);
  width: 1px;
  height: 50%;
  background: rgba(34, 197, 94, 0.1);
}

.stat-num {
  font-family: 'Syne', sans-serif;
  font-size: 2.2rem;
  font-weight: 800;
  color: var(--white);
  display: block;
  font-variant-numeric: tabular-nums;
  animation: countUp 1s ease;
}

.stat-num span {
  color: var(--green);
}

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

.stat-label {
  font-size: 0.8rem;
  color: var(--text3);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-top: 4px;
}

/* ──────── SECTION ────────── */
.section {
  position: relative;
  z-index: 1;
  padding: clamp(48px, 8vw, 96px) clamp(16px, 5vw, 64px);
}

.section-header {
  margin-bottom: 40px;
  animation: fadeUp 0.6s ease;
}

.section-tag {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--green);
  margin-bottom: 10px;
  display: block;
}

.section-header h2 {
  font-family: 'Syne', sans-serif;
  font-size: clamp(1.6rem, 3.5vw, 2.4rem);
  font-weight: 800;
  color: var(--white);
  margin-bottom: 8px;
  background: linear-gradient(135deg, #ffffff 0%, #8eafd4 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.section-header p {
  color: var(--text2);
  font-size: 0.95rem;
  max-width: 480px;
}

/* ──────── SUBJECT CARDS ────────── */
.subjects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 20px;
}

.subject-card {
  background: linear-gradient(135deg, rgba(22, 35, 64, 0.8) 0%, rgba(28, 45, 80, 0.5) 100%);
  border: 1px solid rgba(34, 197, 94, 0.15);
  border-radius: var(--radius);
  padding: 28px;
  text-decoration: none;
  color: inherit;
  display: flex;
  flex-direction: column;
  gap: 14px;
  transition: all var(--transition);
  position: relative;
  overflow: hidden;
  animation: fadeUp 0.5s ease both;
  backdrop-filter: blur(10px);
}

.subject-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(34, 197, 94, 0.08) 0%, transparent 60%);
  opacity: 0;
  transition: opacity var(--transition);
}

.subject-card::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: var(--radius);
  padding: 1px;
  background: linear-gradient(135deg, rgba(34, 197, 94, 0.3) 0%, transparent 100%);
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  opacity: 0;
  transition: opacity var(--transition);
}

.subject-card:hover {
  border-color: rgba(34, 197, 94, 0.4);
  transform: translateY(-6px);
  box-shadow: 0 0 40px rgba(34, 197, 94, 0.16), var(--shadow-ambient), var(--inner-hairline);
}

.subject-card:hover::before {
  opacity: 1;
}

.subject-card:hover::after {
  opacity: 1;
}

.subject-icon {
  width: 52px;
  height: 52px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  position: relative;
  z-index: 1;
  transition: all var(--transition);
}

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

.subject-card h3 {
  font-family: 'Syne', sans-serif;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--white);
  position: relative;
  z-index: 1;
}

.subject-card p {
  font-size: 0.85rem;
  color: var(--text2);
  line-height: 1.6;
  position: relative;
  z-index: 1;
}

.subject-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.78rem;
  color: var(--text3);
  position: relative;
  z-index: 1;
}

.subject-meta span {
  display: flex;
  align-items: center;
  gap: 4px;
}

.subject-arrow {
  margin-top: auto;
  color: var(--green);
  font-size: 1.2rem;
  transition: all var(--transition);
  position: relative;
  z-index: 1;
}

.subject-card:hover .subject-arrow {
  transform: translateX(8px);
}

/* ──────── PAGE HERO ────────── */
.page-hero {
  padding: clamp(40px, 7vw, 80px) clamp(16px, 5vw, 64px) clamp(32px, 5vw, 56px);
  position: relative;
  z-index: 1;
  border-bottom: 1px solid rgba(34, 197, 94, 0.1);
}

.breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8rem;
  color: var(--text3);
  margin-bottom: 20px;
}

.breadcrumb a {
  color: var(--text3);
  text-decoration: none;
  transition: color var(--transition);
}

.breadcrumb a:hover {
  color: var(--green);
}

.breadcrumb svg {
  width: 12px;
  height: 12px;
}

.page-hero-inner {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
}

.page-hero-text h1 {
  font-family: 'Syne', sans-serif;
  font-size: clamp(1.8rem, 4vw, 3rem);
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  background: linear-gradient(135deg, #ffffff 0%, #8eafd4 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.page-icon {
  width: 56px;
  height: 56px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
  flex-shrink: 0;
  background: rgba(34, 197, 94, 0.1);
  border: 1px solid rgba(34, 197, 94, 0.2);
  transition: all var(--transition);
}

.page-hero-text:hover .page-icon {
  transform: scale(1.1) rotate(-5deg);
  background: rgba(34, 197, 94, 0.15);
}

.page-hero-text p {
  color: var(--text2);
  margin-top: 12px;
  font-size: 0.95rem;
  max-width: 520px;
  line-height: 1.7;
}

.page-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
}

.tag {
  padding: 5px 12px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  background: rgba(34, 197, 94, 0.08);
  border: 1px solid rgba(34, 197, 94, 0.25);
  color: var(--green);
  transition: all var(--transition);
  cursor: default;
}

.tag:hover {
  background: rgba(34, 197, 94, 0.15);
  border-color: rgba(34, 197, 94, 0.4);
  transform: translateY(-2px);
}

/* ──────── SEARCH & FILTER ────────── */
.toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 24px clamp(16px, 5vw, 64px);
  flex-wrap: wrap;
  position: sticky;
  top: 68px;
  z-index: 90;
  background: rgba(11, 18, 32, 0.95);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid rgba(34, 197, 94, 0.1);
}

.search-wrap {
  position: relative;
  flex: 1;
  min-width: 220px;
}

.search-wrap svg {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text3);
  width: 16px;
  height: 16px;
  pointer-events: none;
}

.search-input {
  width: 100%;
  background: rgba(22, 35, 64, 0.6);
  border: 1px solid rgba(34, 197, 94, 0.2);
  border-radius: var(--radius-sm);
  padding: 10px 14px 10px 38px;
  color: var(--text);
  font-family: 'DM Sans', sans-serif;
  font-size: 0.875rem;
  outline: none;
  transition: all var(--transition);
  backdrop-filter: blur(10px);
}

.search-input:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.15);
  background: rgba(22, 35, 64, 0.8);
}

.search-input::placeholder {
  color: var(--text3);
}

.filter-tabs {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.filter-btn {
  padding: 9px 16px;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  font-weight: 600;
  background: rgba(34, 197, 94, 0.05);
  border: 1px solid rgba(34, 197, 94, 0.2);
  color: var(--text2);
  cursor: pointer;
  transition: all var(--transition);
  font-family: 'DM Sans', sans-serif;
}

.filter-btn:hover,
.filter-btn.active {
  background: var(--green);
  border-color: var(--green);
  color: #0b1220;
  transform: translateY(-2px);
}

/* ──────── CONTENT SECTION ────────── */
.content-section {
  padding: clamp(32px, 5vw, 56px) clamp(16px, 5vw, 64px);
}

.content-section + .content-section {
  border-top: 1px solid rgba(34, 197, 94, 0.1);
}

.content-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 12px;
}

.content-section-header h2 {
  font-family: 'Syne', sans-serif;
  font-size: 1.25rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 10px;
}

.content-section-header h2::before {
  content: '';
  display: block;
  width: 4px;
  height: 22px;
  background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
  border-radius: 2px;
}

.count-badge {
  font-size: 0.75rem;
  font-weight: 600;
  background: rgba(34, 197, 94, 0.15);
  color: var(--green);
  padding: 3px 10px;
  border-radius: 999px;
  border: 1px solid rgba(34, 197, 94, 0.3);
}

/* ──────── ITEM CARDS ────────── */
.items-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

.item-card {
  background: linear-gradient(135deg, rgba(22, 35, 64, 0.7) 0%, rgba(28, 45, 80, 0.4) 100%);
  border: 1px solid rgba(34, 197, 94, 0.15);
  border-radius: var(--radius);
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: all var(--transition);
  position: relative;
  overflow: hidden;
  backdrop-filter: blur(10px);
  animation: fadeUp 0.5s ease both;
}

.item-card::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--green), transparent);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform var(--transition);
}

.item-card:hover {
  border-color: rgba(34, 197, 94, 0.3);
  transform: translateY(-4px);
  box-shadow: 0 0 30px rgba(34, 197, 94, 0.12), var(--shadow-ambient), var(--inner-hairline);
}

.item-card:focus-visible,
.subject-card:focus-visible,
.download-btn:focus-visible,
.filter-btn:focus-visible {
  outline: 2px solid var(--green);
  outline-offset: 2px;
}

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

.item-type {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 3px 10px;
  border-radius: 999px;
  display: inline-block;
  width: fit-content;
  transition: all var(--transition);
}

.type-course {
  background: rgba(34, 197, 94, 0.15);
  color: var(--green);
}

.type-exercise {
  background: rgba(59, 130, 246, 0.15);
  color: #60a5fa;
}

.type-series {
  background: rgba(245, 158, 11, 0.15);
  color: #fbbf24;
}

.item-card h3 {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--white);
  line-height: 1.4;
}

.item-card p {
  font-size: 0.83rem;
  color: var(--text2);
  line-height: 1.6;
  flex: 1;
}

.item-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 4px;
}

.item-meta {
  font-size: 0.75rem;
  color: var(--text3);
  display: flex;
  align-items: center;
  gap: 6px;
}

.item-meta svg {
  width: 13px;
  height: 13px;
}

/* ──────── EMPTY STATE ────────── */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text3);
  display: none;
  flex-direction: column;
  align-items: center;
}

.empty-state svg {
  width: 48px;
  height: 48px;
  margin-bottom: 16px;
  color: var(--text3);
}

.empty-state p {
  font-size: 0.9rem;
}

/* ──────── FOOTER ────────── */
footer {
  position: relative;
  z-index: 1;
  border-top: 1px solid rgba(34, 197, 94, 0.1);
  background: linear-gradient(135deg, rgba(15, 26, 46, 0.6) 0%, rgba(20, 32, 53, 0.4) 100%);
  backdrop-filter: blur(10px);
  padding: clamp(32px, 5vw, 56px) clamp(16px, 5vw, 64px) 24px;
}

.footer-inner {
  display: grid;
  grid-template-columns: 1.5fr repeat(3, 1fr);
  gap: 40px;
  margin-bottom: 40px;
}

.footer-brand p {
  font-size: 0.85rem;
  color: var(--text2);
  line-height: 1.7;
  margin-top: 12px;
  max-width: 260px;
}

.footer-col h4 {
  font-family: 'Syne', sans-serif;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text3);
  margin-bottom: 16px;
}

.footer-col ul {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.footer-col a {
  font-size: 0.875rem;
  color: var(--text2);
  text-decoration: none;
  transition: all var(--transition);
  position: relative;
}

.footer-col a::before {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 0;
  height: 1px;
  background: var(--green);
  transition: width var(--transition);
}

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

.footer-col a:hover::before {
  width: 100%;
}

.footer-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 24px;
  border-top: 1px solid rgba(34, 197, 94, 0.1);
  font-size: 0.8rem;
  color: var(--text3);
  flex-wrap: wrap;
  gap: 12px;
}

.footer-bottom span {
  color: var(--green);
}

/* ──────── CONTACT FORM ────────── */
.contact-grid {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 24px;
}

.contact-card {
  background: linear-gradient(135deg, rgba(22, 35, 64, 0.8) 0%, rgba(28, 45, 80, 0.5) 100%);
  border: 1px solid rgba(34, 197, 94, 0.15);
  border-radius: var(--radius);
  padding: 32px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  backdrop-filter: blur(10px);
}

.contact-card h3 {
  font-family: 'Syne', sans-serif;
  font-size: 1.2rem;
  color: var(--white);
}

.input-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.input-group label {
  color: var(--text2);
  font-size: 0.85rem;
}

.input-group input,
.input-group textarea {
  width: 100%;
  background: rgba(11, 18, 32, 0.6);
  border: 1px solid rgba(34, 197, 94, 0.2);
  border-radius: var(--radius-sm);
  color: var(--text);
  padding: 14px;
  font-family: 'DM Sans', sans-serif;
  font-size: 0.95rem;
  outline: none;
  transition: all var(--transition);
  backdrop-filter: blur(10px);
}

.input-group input:focus,
.input-group textarea:focus {
  border-color: var(--green);
  background: rgba(11, 18, 32, 0.8);
  box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.15);
}

.input-group textarea {
  min-height: 160px;
  resize: vertical;
}

.form-actions {
  display: flex;
  justify-content: flex-end;
}

/* ──────── ANIMATIONS ────────── */
@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(24px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

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

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

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

.animate {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.5s ease, transform 0.5s ease;
}

.animate.visible {
  opacity: 1;
  transform: translateY(0);
}

/* ──────── RESPONSIVE ────────── */
@media (max-width: 900px) {
  .footer-inner {
    grid-template-columns: 1fr 1fr;
  }

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

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

  .nav-hamburger {
    display: flex;
  }

  .footer-inner {
    grid-template-columns: 1fr;
  }

  .page-hero-inner {
    flex-direction: column;
  }

  .toolbar {
    position: static;
  }

  .stats-row {
    gap: clamp(16px, 5vw, 32px);
  }

  .stat-item:not(:last-child)::after {
    display: none;
  }

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

/* ──────── SCROLLBAR ────────── */
::-webkit-scrollbar {
  width: 8px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(34, 197, 94, 0.3);
  border-radius: 4px;
  transition: all var(--transition);
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(34, 197, 94, 0.6);
}

/* ──────── GRID LINE DECORATION ────────── */
.grid-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  background-image:
    linear-gradient(rgba(34, 197, 94, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(34, 197, 94, 0.05) 1px, transparent 1px);
  background-size: 48px 48px;
  pointer-events: none;
  mask-image: radial-gradient(ellipse 80% 80% at 50% 0%, black 0%, transparent 70%);
}

/* ──────── SCROLL TO TOP ────────── */
#scroll-top {
  position: fixed;
  bottom: 20px;
  right: 20px;
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
  color: #0b1220;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  font-size: 1.2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transform: scale(0);
  transition: all var(--transition);
  z-index: 99;
  box-shadow: 0 0 20px rgba(34, 197, 94, 0.3);
}

#scroll-top.visible {
  opacity: 1;
  visibility: visible;
  transform: scale(1);
}

#scroll-top:hover {
  box-shadow: 0 0 30px rgba(34, 197, 94, 0.6);
  transform: scale(1.1);
}

/* ──────── PROGRESS BAR ────────── */
#progress-bar {
  position: fixed;
  top: 0;
  left: 0;
  height: 3px;
  background: linear-gradient(90deg, #22c55e 0%, #16a34a 100%);
  z-index: 101;
  transition: width 0.1s ease;
  box-shadow: 0 0 10px rgba(34, 197, 94, 0.5);
}

/* ──────── TOAST NOTIFICATION ────────── */
#toast {
  position: fixed;
  bottom: 20px;
  left: 20px;
  background: linear-gradient(135deg, rgba(22, 35, 64, 0.95) 0%, rgba(28, 45, 80, 0.9) 100%);
  color: var(--text);
  padding: 14px 20px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(34, 197, 94, 0.3);
  backdrop-filter: blur(10px);
  z-index: 1000;
  opacity: 0;
  transform: translateX(-400px);
  transition: all var(--transition);
  box-shadow: 0 0 20px rgba(34, 197, 94, 0.2);
}

#toast.show {
  opacity: 1;
  transform: translateX(0);
}

/* ──────── COOKIE BANNER ────────── */
#cookie-banner {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9999;
  width: calc(100% - 48px);
  max-width: 780px;
  display: flex;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
  padding: 20px 24px;
  border: 1px solid rgba(34, 197, 94, 0.25);
  border-radius: var(--radius);
  background: linear-gradient(135deg, rgba(15, 23, 42, 0.96) 0%, rgba(17, 24, 39, 0.96) 100%);
  box-shadow: 0 10px 45px rgba(0, 0, 0, 0.45), 0 0 0 1px rgba(148, 163, 184, 0.08);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  animation: cookieSlideUp 0.4s cubic-bezier(0.4, 0, 0.2, 1) both;
}

@keyframes cookieSlideUp {
  from { opacity: 0; transform: translateX(-50%) translateY(18px); }
  to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

#cookie-banner.hide {
  animation: cookieSlideDown 0.3s ease forwards;
}

@keyframes cookieSlideDown {
  from { opacity: 1; transform: translateX(-50%) translateY(0); }
  to { opacity: 0; transform: translateX(-50%) translateY(18px); }
}

.cookie-inner {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.cookie-left {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  flex: 1;
  min-width: 260px;
}

.cookie-icon {
  font-size: 2rem;
  flex-shrink: 0;
}

.cookie-text {
  flex: 1;
  min-width: 220px;
}

.cookie-text h4 {
  color: var(--white);
  font-family: 'Syne', sans-serif;
  font-size: 0.95rem;
  font-weight: 700;
  margin-bottom: 4px;
}

.cookie-text p {
  font-size: 0.82rem;
  color: var(--text2);
  line-height: 1.5;
  margin-bottom: 0;
}

.cookie-text a {
  color: var(--green);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.cookie-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-shrink: 0;
  flex-wrap: wrap;
}

.btn-cookie-accept,
.btn-cookie-decline {
  flex: 1;
  min-width: 110px;
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  transition: all var(--transition);
}

.btn-cookie-accept {
  background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
  color: #0b1220;
  border: none;
}

.btn-cookie-accept:hover {
  transform: translateY(-1px);
  box-shadow: 0 0 18px rgba(34, 197, 94, 0.35);
}

.btn-cookie-decline {
  background: transparent;
  border: 1px solid rgba(148, 163, 184, 0.25);
  color: var(--text3);
}

.btn-cookie-decline:hover {
  background: rgba(148, 163, 184, 0.08);
  border-color: rgba(148, 163, 184, 0.4);
  color: var(--text2);
}

/* ──────── SUPPORT RTL (pages en arabe) ────────── */
[dir="rtl"] {
  text-align: right;
}

[dir="rtl"] .item-card,
[dir="rtl"] .subject-card,
[dir="rtl"] .contact-card {
  text-align: right;
}

[dir="rtl"] .content-section-header h2::before {
  order: 1;
  margin-left: 10px;
  margin-right: 0;
}

[dir="rtl"] .breadcrumb,
[dir="rtl"] .nav-links,
[dir="rtl"] .hero-actions,
[dir="rtl"] .cookie-actions,
[dir="rtl"] .item-meta,
[dir="rtl"] .subject-meta {
  flex-direction: row-reverse;
}

[dir="rtl"] .search-wrap svg {
  left: auto;
  right: 12px;
}

[dir="rtl"] .search-input {
  padding: 10px 38px 10px 14px;
}

[dir="rtl"] .subject-card:hover .subject-arrow,
[dir="rtl"] .item-card:hover .subject-arrow {
  transform: translateX(-6px) scaleX(-1);
}

[dir="rtl"] .footer-col a::before {
  left: auto;
  right: 0;
}

