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

:root {
  --bg-dark: #0a0f1e;
  --bg-card: #0f1a2e;
  --bg-card2: #111827;
  --bg-light: #f0f4ff;
  --blue: #3b82f6;
  --blue-light: #60a5fa;
  --blue-dark: #1d4ed8;
  --accent: #06b6d4;
  --green: #10b981;
  --orange: #f59e0b;
  --purple: #8b5cf6;
  --text: #e2e8f0;
  --text-muted: #94a3b8;
  --border: rgba(59,130,246,0.2);
  --radius: 12px;
  --shadow: 0 4px 24px rgba(0,0,0,0.3);
}

html { scroll-behavior: smooth; }

body {
  font-family: 'Inter', sans-serif;
  background: var(--bg-dark);
  color: var(--text);
  line-height: 1.6;
  overflow-x: hidden;
}

a { text-decoration: none; color: inherit; }

/* ===== NAVBAR ===== */
.navbar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 1000;
  background: rgba(10, 15, 30, 0.85);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
  transition: all 0.3s;
}
.navbar.scrolled { background: rgba(10,15,30,0.97); }

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

.nav-logo {
  display: flex; align-items: center; gap: 10px;
  font-weight: 700; font-size: 1.1rem;
}
.logo-icon { font-size: 1.4rem; color: var(--blue); }

.nav-links {
  display: flex; list-style: none; gap: 0.5rem;
}
.nav-link {
  padding: 6px 14px; border-radius: 8px;
  font-size: 0.9rem; font-weight: 500;
  color: var(--text-muted);
  transition: all 0.2s;
}
.nav-link:hover, .nav-link.active {
  color: var(--blue-light);
  background: rgba(59,130,246,0.1);
}

.hamburger {
  display: none; flex-direction: column; gap: 5px;
  background: none; border: none; cursor: pointer; padding: 4px;
}
.hamburger span {
  display: block; width: 24px; height: 2px;
  background: var(--text); border-radius: 2px;
  transition: all 0.3s;
}

/* ===== HERO ===== */
.hero {
  min-height: 100vh;
  display: flex; align-items: center;
  position: relative; overflow: hidden;
  padding: 100px 2rem 4rem;
}

.hero-bg {
  position: absolute; inset: 0;
  background: radial-gradient(ellipse at 20% 50%, rgba(29,78,216,0.15) 0%, transparent 60%),
              radial-gradient(ellipse at 80% 20%, rgba(6,182,212,0.08) 0%, transparent 50%);
}

.circuit-grid {
  position: absolute; inset: 0; opacity: 0.04;
  background-image:
    linear-gradient(var(--blue) 1px, transparent 1px),
    linear-gradient(90deg, var(--blue) 1px, transparent 1px);
  background-size: 50px 50px;
}

.hero-content {
  position: relative; z-index: 1;
  max-width: 600px;
  flex: 1;
  padding-right: 2rem;
}

.hero-badge {
  display: inline-block;
  background: rgba(59,130,246,0.15);
  border: 1px solid rgba(59,130,246,0.4);
  color: var(--blue-light);
  padding: 6px 16px; border-radius: 50px;
  font-size: 0.8rem; font-weight: 600;
  letter-spacing: 0.1em; text-transform: uppercase;
  margin-bottom: 1.5rem;
}

.hero-title {
  font-size: clamp(2.5rem, 6vw, 4rem);
  font-weight: 700; line-height: 1.1;
  margin-bottom: 0.5rem;
}
.highlight { color: var(--blue-light); }

.hero-subtitle {
  font-size: 1.2rem; color: var(--text-muted);
  margin-bottom: 1rem;
}
.hero-desc {
  font-size: 1rem; color: var(--text-muted);
  margin-bottom: 1.5rem; line-height: 1.8;
}
.hero-desc strong { color: var(--blue-light); }

.hero-badges {
  display: flex; flex-wrap: wrap; gap: 8px;
  margin-bottom: 2rem;
}
.badge {
  padding: 6px 14px; border-radius: 8px;
  font-size: 0.8rem; font-weight: 600;
}
.badge-bts {
  background: rgba(59,130,246,0.15);
  border: 1px solid rgba(59,130,246,0.4);
  color: var(--blue-light);
}
.badge-cpge {
  background: rgba(6,182,212,0.12);
  border: 1px solid rgba(6,182,212,0.4);
  color: var(--accent);
}

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

/* ===== BUTTONS ===== */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 12px 28px; border-radius: 10px;
  font-weight: 600; font-size: 0.95rem;
  transition: all 0.25s; cursor: pointer; border: none;
}
.btn-primary {
  background: var(--blue);
  color: #fff;
}
.btn-primary:hover { background: var(--blue-dark); transform: translateY(-2px); box-shadow: 0 8px 24px rgba(59,130,246,0.35); }
.btn-secondary {
  background: transparent;
  color: var(--blue-light);
  border: 1.5px solid rgba(59,130,246,0.5);
}
.btn-secondary:hover { background: rgba(59,130,246,0.1); transform: translateY(-2px); }
.btn-full { width: 100%; }

/* ===== HERO VISUAL ===== */
.hero-visual {
  position: relative; z-index: 1;
  flex: 0 0 auto;
}
.circuit-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 2rem;
  text-align: center;
  box-shadow: var(--shadow), 0 0 60px rgba(59,130,246,0.08);
  min-width: 280px;
}
.circuit-icon img {
  width: 100%;
  height: 220px;
  object-fit: cover;
  border-radius: 10px;
  display: block;
  margin-bottom: 0.4rem;
}
.hero-img-credit {
  font-size: 0.72rem;
  color: var(--text-muted);
  text-align: right;
  margin-bottom: 1rem;
}
.circuit-stats { display: flex; flex-direction: column; gap: 1rem; }
.stat { display: flex; flex-direction: column; }
.stat-num { font-size: 1.8rem; font-weight: 700; color: var(--blue-light); }
.stat-label { font-size: 0.8rem; color: var(--text-muted); }

/* ===== SECTIONS ===== */
.section { padding: 6rem 2rem; }
.section-dark { background: var(--bg-card2); }

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

.section-header { text-align: center; margin-bottom: 3.5rem; }
.section-tag {
  display: inline-block;
  color: var(--blue-light);
  font-size: 0.8rem; font-weight: 600;
  letter-spacing: 0.12em; text-transform: uppercase;
  margin-bottom: 0.8rem;
}
.section-title {
  font-size: clamp(1.8rem, 4vw, 2.5rem);
  font-weight: 700; margin-bottom: 1rem;
}
.section-desc { color: var(--text-muted); font-size: 1rem; max-width: 560px; margin: 0 auto; }

/* ===== A PROPOS ===== */
.apropos-grid {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 3rem; align-items: start;
}
.photo-placeholder {
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 1rem;
  border: 3px solid rgba(59,130,246,0.4);
  box-shadow: 0 8px 32px rgba(59,130,246,0.15);
}
.photo-placeholder img {
  width: 100%;
  height: 280px;
  object-fit: cover;
  display: block;
}
.apropos-info-card { display: flex; flex-direction: column; gap: 0.8rem; }
.info-item {
  display: flex; align-items: center; gap: 10px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px; padding: 10px 14px;
  font-size: 0.85rem;
}
.info-icon { font-size: 1.1rem; }

.apropos-lead {
  font-size: 1.05rem; font-weight: 500;
  color: var(--text);
  margin-bottom: 1rem; line-height: 1.8;
}
.apropos-text p { color: var(--text-muted); margin-bottom: 1rem; line-height: 1.8; }
.competences { margin-top: 1.5rem; }
.competences h3 { font-size: 0.9rem; font-weight: 600; color: var(--text-muted); margin-bottom: 0.8rem; text-transform: uppercase; letter-spacing: 0.08em; }
.tags { display: flex; flex-wrap: wrap; gap: 8px; }
.tag {
  background: rgba(59,130,246,0.1);
  border: 1px solid rgba(59,130,246,0.25);
  color: var(--blue-light);
  padding: 5px 12px; border-radius: 8px;
  font-size: 0.8rem; font-weight: 500;
}

/* ===== TABS ===== */
.filiere-tabs {
  display: flex; gap: 0.5rem; margin-bottom: 2rem;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0;
}
.tab-btn {
  background: none; border: none;
  padding: 10px 24px; cursor: pointer;
  color: var(--text-muted); font-weight: 600;
  font-size: 0.95rem;
  border-bottom: 2px solid transparent;
  transition: all 0.2s;
  margin-bottom: -1px;
}
.tab-btn:hover { color: var(--blue-light); }
.tab-btn.active {
  color: var(--blue-light);
  border-bottom-color: var(--blue);
}

.tab-content { display: none; }
.tab-content.active { display: block; }

.filiere-header {
  margin-bottom: 2rem; padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border);
}
.filiere-header h3 { font-size: 1.2rem; font-weight: 600; margin-bottom: 0.3rem; }
.filiere-header p { color: var(--text-muted); font-size: 0.9rem; }

/* ===== MODULE CARDS ===== */
.modules-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1.5rem;
}
.module-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: transform 0.25s, box-shadow 0.25s, border-color 0.25s;
}
.module-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 32px rgba(59,130,246,0.15);
  border-color: rgba(59,130,246,0.5);
}
.module-icon {
  font-size: 1.8rem; padding: 1.2rem 1.5rem 0;
}
.module-body { padding: 0.8rem 1.5rem 1.5rem; }
.module-year {
  display: inline-block;
  background: rgba(59,130,246,0.12);
  color: var(--blue-light);
  border-radius: 6px; padding: 2px 10px;
  font-size: 0.75rem; font-weight: 600;
  margin-bottom: 0.6rem;
}
.cpge-card .module-year {
  background: rgba(6,182,212,0.12);
  color: var(--accent);
}
.module-body h4 { font-size: 1rem; font-weight: 600; margin-bottom: 0.8rem; }
.module-body ul { list-style: none; margin-bottom: 1.2rem; }
.module-body ul li {
  color: var(--text-muted); font-size: 0.85rem;
  padding: 3px 0 3px 14px; position: relative;
}
.module-body ul li::before {
  content: ''; position: absolute; left: 0; top: 11px;
  width: 5px; height: 5px; border-radius: 50%;
  background: var(--blue);
}
.module-links { display: flex; gap: 8px; flex-wrap: wrap; }
.module-links a {
  padding: 4px 12px; border-radius: 6px;
  font-size: 0.78rem; font-weight: 600;
  transition: all 0.2s;
}
.link-cours { background: rgba(59,130,246,0.15); color: var(--blue-light); }
.link-cours:hover { background: rgba(59,130,246,0.3); }
.link-td { background: rgba(16,185,129,0.15); color: var(--green); }
.link-td:hover { background: rgba(16,185,129,0.3); }
.link-tp { background: rgba(245,158,11,0.15); color: var(--orange); }
.link-tp:hover { background: rgba(245,158,11,0.3); }
.link-colle { background: rgba(139,92,246,0.15); color: var(--purple); }
.link-colle:hover { background: rgba(139,92,246,0.3); }

/* ===== RESSOURCES ===== */
.ressources-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.5rem;
}
.ressource-cat {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.cat-header {
  display: flex; align-items: center; gap: 12px;
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--border);
}
.cat-header h3 { font-size: 1rem; font-weight: 600; }
.cat-icon { font-size: 1.4rem; }
.cat-cours { background: linear-gradient(135deg, rgba(59,130,246,0.15), transparent); }
.cat-td { background: linear-gradient(135deg, rgba(16,185,129,0.15), transparent); }
.cat-tp { background: linear-gradient(135deg, rgba(245,158,11,0.15), transparent); }
.cat-annales { background: linear-gradient(135deg, rgba(139,92,246,0.15), transparent); }

.ressource-list { list-style: none; padding: 0.5rem 0; }
.ressource-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 1.5rem;
  transition: background 0.2s;
}
.ressource-item:hover { background: rgba(255,255,255,0.03); }
.res-type {
  font-size: 0.68rem; font-weight: 700;
  padding: 2px 7px; border-radius: 4px;
  flex-shrink: 0;
}
.res-pdf { background: rgba(239,68,68,0.2); color: #f87171; }
.res-zip { background: rgba(245,158,11,0.2); color: var(--orange); }
.res-name { flex: 1; font-size: 0.82rem; color: var(--text-muted); }
.res-dl {
  font-size: 1rem; color: var(--blue-light);
  width: 28px; height: 28px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 6px;
  transition: background 0.2s;
  flex-shrink: 0;
}
.res-dl:hover { background: rgba(59,130,246,0.2); }

/* ===== CONTACT ===== */
.contact-grid {
  display: grid;
  grid-template-columns: 1fr 1.4fr;
  gap: 3rem; align-items: start;
}
.contact-infos { display: flex; flex-direction: column; gap: 1rem; }
.contact-card {
  display: flex; align-items: flex-start; gap: 1rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.2rem 1.5rem;
  transition: border-color 0.2s;
}
.contact-card:hover { border-color: rgba(59,130,246,0.5); }
.contact-icon { font-size: 1.6rem; flex-shrink: 0; }
.contact-card h4 { font-size: 0.85rem; font-weight: 600; color: var(--blue-light); margin-bottom: 0.2rem; }
.contact-card p { font-size: 0.85rem; color: var(--text-muted); }

.contact-form {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2rem;
}
.form-group { margin-bottom: 1.2rem; }
.form-group label {
  display: block; font-size: 0.85rem; font-weight: 500;
  margin-bottom: 0.5rem; color: var(--text);
}
.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 8px;
  padding: 10px 14px;
  color: var(--text);
  font-size: 0.9rem;
  font-family: inherit;
  transition: border-color 0.2s, box-shadow 0.2s;
  outline: none;
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(59,130,246,0.15);
}
.form-group select { cursor: pointer; }
.form-group textarea { resize: vertical; }
.form-group input::placeholder,
.form-group textarea::placeholder { color: var(--text-muted); }

.form-success {
  display: none;
  margin-top: 1rem;
  background: rgba(16,185,129,0.1);
  border: 1px solid rgba(16,185,129,0.3);
  color: var(--green);
  border-radius: 8px; padding: 12px 16px;
  font-size: 0.9rem; text-align: center;
}

/* ===== FOOTER ===== */
.footer {
  background: #060b14;
  border-top: 1px solid var(--border);
  padding: 2rem;
}
.footer-content {
  max-width: 1200px; margin: 0 auto;
  display: flex; align-items: center;
  justify-content: space-between; flex-wrap: wrap; gap: 1rem;
}
.footer-brand {
  display: flex; align-items: center; gap: 8px;
  font-weight: 600; font-size: 0.95rem;
}
.footer-links {
  display: flex; gap: 1.5rem; flex-wrap: wrap;
}
.footer-links a {
  font-size: 0.85rem; color: var(--text-muted);
  transition: color 0.2s;
}
.footer-links a:hover { color: var(--blue-light); }
.footer-copy { color: var(--text-muted); font-size: 0.8rem; }

/* ===== RESPONSIVE ===== */
@media (max-width: 900px) {
  .hero { flex-direction: column; text-align: center; padding-top: 120px; }
  .hero-content { padding-right: 0; margin-bottom: 2rem; }
  .hero-actions { justify-content: center; }
  .hero-badges { justify-content: center; }
  .hero-visual { width: 100%; display: flex; justify-content: center; }
  .circuit-card { min-width: auto; width: 100%; max-width: 380px; }
  .circuit-stats { flex-direction: row; justify-content: space-around; }

  .apropos-grid { grid-template-columns: 1fr; }
  .apropos-photo { display: flex; gap: 1.5rem; align-items: flex-start; }
  .photo-placeholder { min-width: 160px; }

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

@media (max-width: 640px) {
  .nav-links { display: none; flex-direction: column; position: fixed; top: 68px; left: 0; right: 0;
    background: rgba(10,15,30,0.98); padding: 1rem; border-bottom: 1px solid var(--border); }
  .nav-links.open { display: flex; }
  .hamburger { display: flex; }

  .section { padding: 4rem 1.2rem; }
  .hero { padding: 100px 1.2rem 3rem; }
  .modules-grid { grid-template-columns: 1fr; }
  .ressources-grid { grid-template-columns: 1fr; }
  .footer-content { flex-direction: column; text-align: center; }
  .footer-links { justify-content: center; }
  .apropos-photo { flex-direction: column; }
  .filiere-tabs { flex-wrap: wrap; }
}

/* ===== ANIMATIONS ===== */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(24px); }
  to { opacity: 1; transform: translateY(0); }
}
.hero-content > * { animation: fadeInUp 0.6s ease both; }
.hero-badge { animation-delay: 0.1s; }
.hero-title { animation-delay: 0.2s; }
.hero-subtitle { animation-delay: 0.3s; }
.hero-desc { animation-delay: 0.35s; }
.hero-badges { animation-delay: 0.4s; }
.hero-actions { animation-delay: 0.5s; }
.hero-visual { animation: fadeInUp 0.7s 0.3s ease both; }

.module-card, .ressource-cat, .contact-card {
  animation: fadeInUp 0.5s ease both;
}
