/* =========================================================================
   Course slider page styles
   ========================================================================= */

/* ---------- Hero ---------- */
.cours-hero {
  background: linear-gradient(180deg, var(--bg-sky) 0%, var(--bg) 100%);
  padding: var(--s-10) 0 var(--s-6);
  position: relative;
  overflow: hidden;
}
.cours-hero .dotgrid { position: absolute; inset: 0; opacity: 0.4; }
.cours-hero__inner { position: relative; z-index: 1; }
.cours-hero__title {
  font-size: clamp(32px, 5vw, 48px);
  font-weight: 800;
  letter-spacing: -0.03em;
  margin-top: var(--s-3);
}
[dir="rtl"] .cours-hero__title { letter-spacing: 0; }
.cours-hero__sub { color: var(--ink-500); margin-top: var(--s-3); font-size: var(--t-18); max-width: 60ch; }

/* ---------- Sticky level nav ---------- */
.level-nav {
  position: sticky;
  /* se cale juste sous l'en-tête fixe — hauteur réelle fournie par mobile-nav.js */
  top: var(--ma-header-bottom, 105px);
  z-index: 30;
  background: rgba(255,255,255,0.92);
  backdrop-filter: saturate(160%) blur(12px);
  border-bottom: 1px solid var(--line);
  padding: var(--s-3) 0;
}
.cycle-tabs {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}
.cycle-tab {
  border: 0;
  background: transparent;
  padding: 10px 16px;
  border-radius: var(--r-pill);
  font-size: var(--t-14);
  font-weight: 600;
  color: var(--ink-500);
  cursor: pointer;
  transition: background .15s, color .15s;
}
.cycle-tab:hover { background: var(--bg-soft); color: var(--ink-900); }
.cycle-tab.is-active {
  background: var(--ink-900);
  color: white;
}
@media (max-width: 540px) {
  .cycle-tab { padding: 8px 12px; font-size: var(--t-13); flex: 1; min-width: 0; }
}

.filiere-pills {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  scrollbar-width: none;
  padding: 4px 0;
}
.filiere-pills::-webkit-scrollbar { display: none; }
.filiere-pill {
  border: 1px solid var(--line);
  background: white;
  padding: 8px 14px;
  border-radius: var(--r-pill);
  font-size: var(--t-13);
  font-weight: 600;
  color: var(--ink-700);
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: all .15s;
}
.filiere-pill:hover {
  border-color: var(--ink-300);
  background: var(--bg-soft);
}
.filiere-pill.is-active {
  background: var(--bg-sky);
  color: var(--brand-blue-700);
  border-color: var(--brand-blue);
}
.filiere-pill__code {
  font-family: var(--font-mono);
  font-size: 11px;
  padding: 2px 6px;
  background: var(--bg-soft);
  border-radius: 4px;
  color: var(--ink-500);
}
.filiere-pill.is-active .filiere-pill__code {
  background: var(--brand-blue);
  color: white;
}

/* ---------- Slide viewport ---------- */
.slide-viewport {
  padding: var(--s-8) 0 var(--s-12);
  min-height: 60vh;
}

/* ---------- Level slide ---------- */
.level-slide {
  animation: slideIn .35s cubic-bezier(0.16, 1, 0.3, 1);
}
.level-slide.is-leaving {
  animation: slideOut .15s ease-in;
}
@keyframes slideIn {
  from { opacity: 0; transform: translateX(20px); }
  to { opacity: 1; transform: translateX(0); }
}
@keyframes slideOut {
  to { opacity: 0; transform: translateX(-20px); }
}
[dir="rtl"] .level-slide { animation-name: slideInRtl; }
[dir="rtl"] .level-slide.is-leaving { animation-name: slideOutRtl; }
@keyframes slideInRtl {
  from { opacity: 0; transform: translateX(-20px); }
  to { opacity: 1; transform: translateX(0); }
}
@keyframes slideOutRtl {
  to { opacity: 0; transform: translateX(20px); }
}

/* Slide header */
.slide-head {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: var(--s-5);
  align-items: end;
  padding-bottom: var(--s-5);
  margin-bottom: var(--s-8);
  border-bottom: 1px solid var(--line);
}
@media (max-width: 720px) { .slide-head { grid-template-columns: 1fr; gap: var(--s-3); } }

.slide-head__cycle {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-500);
  margin-bottom: 6px;
}
.slide-head__title {
  font-size: clamp(28px, 4vw, 40px);
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.1;
  display: flex;
  align-items: baseline;
  gap: 12px;
  flex-wrap: wrap;
}
[dir="rtl"] .slide-head__title { letter-spacing: 0; line-height: 1.3; }
.slide-head__code {
  font-family: var(--font-mono);
  font-size: 0.55em;
  background: var(--brand-orange);
  color: white;
  padding: 4px 10px;
  border-radius: 6px;
  letter-spacing: 0.04em;
  font-weight: 700;
}
.slide-head__stats {
  display: flex;
  gap: var(--s-3);
  margin-top: var(--s-3);
  font-size: var(--t-14);
  color: var(--ink-500);
  flex-wrap: wrap;
}
.slide-head__stats b { color: var(--ink-900); font-weight: 700; }
.slide-head__stats span { display: inline-flex; align-items: center; gap: 4px; }
.slide-head__stats .dot-sep { width: 3px; height: 3px; background: var(--ink-300); border-radius: 50%; }

.slide-head__progress {
  background: white;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: var(--s-4) var(--s-5);
  min-width: 220px;
}
@media (max-width: 720px) { .slide-head__progress { min-width: 0; } }
.slide-head__progress-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-500);
  font-weight: 600;
  margin-bottom: 6px;
}
.slide-head__progress-value {
  font-family: var(--font-display);
  font-size: var(--t-24);
  font-weight: 800;
  letter-spacing: -0.02em;
}
.slide-head__progress-bar {
  height: 6px;
  background: var(--bg-soft);
  border-radius: 999px;
  margin-top: 8px;
  overflow: hidden;
}
.slide-head__progress-bar span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--brand-orange), #FFA94D);
}

/* Resume card (if current chapter exists) */
.resume-banner {
  background: var(--ink-900);
  color: white;
  border-radius: var(--r-lg);
  padding: var(--s-5) var(--s-6);
  display: flex;
  align-items: center;
  gap: var(--s-4);
  margin-bottom: var(--s-8);
  position: relative;
  overflow: hidden;
}
.resume-banner::before {
  content: "";
  position: absolute;
  width: 200px; height: 200px;
  background: var(--brand-orange);
  filter: blur(60px);
  opacity: 0.3;
  bottom: -100px; right: -40px;
  border-radius: 50%;
}
[dir="rtl"] .resume-banner::before { right: auto; left: -40px; }
.resume-banner__play {
  width: 48px; height: 48px;
  border-radius: 50%;
  background: var(--brand-orange);
  display: grid; place-items: center;
  flex-shrink: 0;
  position: relative;
  z-index: 1;
}
.resume-banner__body { flex: 1; position: relative; z-index: 1; }
.resume-banner__label {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--brand-orange);
}
.resume-banner__title {
  font-size: var(--t-18);
  font-weight: 700;
  margin-top: 2px;
}
.resume-banner .btn { position: relative; z-index: 1; flex-shrink: 0; }
@media (max-width: 540px) {
  .resume-banner { flex-direction: column; align-items: flex-start; }
  .resume-banner .btn { width: 100%; justify-content: center; }
}

/* Semesters */
.semester-block { margin-bottom: var(--s-10); }
.semester-block__head {
  display: flex;
  align-items: center;
  gap: var(--s-4);
  margin-bottom: var(--s-5);
}
.semester-block__num {
  width: 44px; height: 44px;
  border-radius: 12px;
  background: var(--bg-sky);
  color: var(--brand-blue-700);
  display: grid; place-items: center;
  font-family: var(--font-display);
  font-size: var(--t-18);
  font-weight: 800;
  flex-shrink: 0;
}
.semester-block__num--ds { background: #FEEEDD; color: var(--brand-orange-600); font-size: var(--t-14); }
.semester-block__title {
  font-size: var(--t-22, 22px);
  font-weight: 800;
  letter-spacing: -0.01em;
}
[dir="rtl"] .semester-block__title { letter-spacing: 0; }
.semester-block__sub { color: var(--ink-500); font-size: var(--t-13); margin-top: 2px; }

/* Chapter grid */
.chapter-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--s-3);
}
@media (max-width: 720px) { .chapter-grid { grid-template-columns: 1fr; } }

.chapter-card {
  background: white;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: var(--s-4) var(--s-5);
  display: grid;
  grid-template-columns: 40px 1fr auto auto;
  gap: var(--s-3);
  align-items: center;
  text-decoration: none;
  color: inherit;
  transition: transform .15s, box-shadow .15s, border-color .15s;
}
.chapter-card:hover {
  transform: translateY(-2px);
  border-color: var(--line-strong);
  box-shadow: var(--sh-sm);
}
.chapter-card__num {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-400);
  letter-spacing: 0.06em;
  width: 32px;
}
.chapter-card__status {
  width: 22px; height: 22px;
  border-radius: 50%;
  border: 2px solid var(--line-strong);
  background: white;
  flex-shrink: 0;
  display: grid;
  place-items: center;
}
.chapter-card.is-done .chapter-card__status {
  background: var(--success);
  border-color: var(--success);
  color: white;
  font-size: 11px;
  font-weight: 700;
}
.chapter-card.is-done .chapter-card__status::after { content: "✓"; }
.chapter-card.is-current .chapter-card__status {
  border-color: var(--brand-orange);
}
.chapter-card.is-current .chapter-card__status::after {
  content: "";
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--brand-orange);
}
.chapter-card.is-current {
  border-color: var(--brand-orange);
  background: linear-gradient(to right, rgba(245,130,32,0.04), white 40%);
}
[dir="rtl"] .chapter-card.is-current { background: linear-gradient(to left, rgba(245,130,32,0.04), white 40%); }

.chapter-card__title {
  font-size: var(--t-15);
  font-weight: 600;
  line-height: 1.3;
}
.chapter-card__meta {
  font-size: 11px;
  color: var(--ink-400);
  font-family: var(--font-mono);
  letter-spacing: 0.04em;
}
.chapter-card__chev {
  color: var(--ink-400);
  font-size: 18px;
  transition: transform .15s;
}
.chapter-card:hover .chapter-card__chev { transform: translateX(3px); }
[dir="rtl"] .chapter-card__chev { transform: scaleX(-1); }
[dir="rtl"] .chapter-card:hover .chapter-card__chev { transform: scaleX(-1) translateX(3px); }

/* DS grid */
.ds-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--s-3);
}
@media (max-width: 720px) { .ds-grid { grid-template-columns: repeat(2, 1fr); } }
.ds-card {
  background: white;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: var(--s-4);
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
  text-decoration: none;
  color: inherit;
  transition: transform .15s, border-color .15s, box-shadow .15s;
}
.ds-card:hover {
  transform: translateY(-2px);
  border-color: var(--brand-orange);
  box-shadow: var(--sh-sm);
}
.ds-card__ic {
  width: 36px; height: 36px;
  border-radius: 10px;
  background: #FEEEDD;
  color: var(--brand-orange-600);
  display: grid; place-items: center;
  font-size: 16px;
}
.ds-card__title { font-size: var(--t-14); font-weight: 700; }
.ds-card__meta { font-size: 11px; color: var(--ink-500); }

/* ---------- Slide nav ---------- */
.slide-nav {
  margin-top: var(--s-10);
  padding-top: var(--s-6);
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--s-3);
}
.slide-nav__btn {
  border: 1px solid var(--line);
  background: white;
  border-radius: var(--r-md);
  padding: var(--s-3) var(--s-4);
  display: flex;
  align-items: center;
  gap: var(--s-3);
  font: inherit;
  color: inherit;
  cursor: pointer;
  text-align: start;
  transition: all .15s;
  min-width: 0;
  flex: 1;
  max-width: 260px;
}
.slide-nav__btn:hover {
  border-color: var(--brand-blue);
  background: var(--bg-sky);
  transform: translateY(-1px);
}
.slide-nav__btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
}
.slide-nav__btn--next { justify-content: flex-end; text-align: end; }
.slide-nav__label {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.slide-nav__label small {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-500);
  font-weight: 600;
}
.slide-nav__label b {
  font-size: var(--t-14);
  font-weight: 700;
  margin-top: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 200px;
}
.arr-rev, .arr-fwd {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--bg-soft);
  display: grid; place-items: center;
  font-size: 18px;
  color: var(--ink-900);
  flex-shrink: 0;
  font-weight: 700;
  transition: background .15s;
}
.slide-nav__btn:hover .arr-rev, .slide-nav__btn:hover .arr-fwd {
  background: var(--brand-blue);
  color: white;
}
[dir="rtl"] .arr-rev { transform: scaleX(-1); }
[dir="rtl"] .arr-fwd { transform: scaleX(-1); }

.slide-counter {
  font-family: var(--font-mono);
  font-size: var(--t-14);
  font-weight: 600;
  color: var(--ink-500);
  text-align: center;
  flex-shrink: 0;
  padding: 0 var(--s-2);
}
.slide-counter span:first-child { color: var(--ink-900); font-weight: 700; font-size: var(--t-16); }

@media (max-width: 540px) {
  .slide-nav__label b { max-width: 100px; font-size: var(--t-13); }
  .slide-nav__btn { padding: var(--s-2) var(--s-3); }
  .arr-rev, .arr-fwd { width: 32px; height: 32px; }
}
