/* ===============================
   RESET MINIMAL
   =============================== */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
}

/* ===============================
   BASE
   =============================== */
body {
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  background: radial-gradient(circle at top, #1a1036, #08040f);
  color: #f2f2f2;
  min-height: 100vh;
}

a {
  color: #ffd166;
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

h1, h2, h3 {
  margin-top: 0;
  font-weight: 700;
}

/* ===============================
   HEADER
   =============================== */
header {
  text-align: center;
}

header h1 {
  color: #f4d37a;
  margin-bottom: .3rem;
}

header p {
  color: #e0e0e0;
}

/* ===============================
   CARTES (GÉNÉRAL)
   =============================== */
.card {
  background: linear-gradient(180deg, #1b1236, #120824);
  border-radius: 20px;
  padding: 1.8rem;
  margin-bottom: 2rem;
  box-shadow: 0 0 45px rgba(180,140,255,.35);
  color: #f1f1f1;
  transition: all .25s ease;
}

/* cartes internes (questions / réponses) */
.card .card {
  background: rgba(255,255,255,.03);
  box-shadow: none;
  margin-top: 1.2rem;
}

/* TITRES DE CARTE */
.card h2 {
  color: #f4d37a;
  font-size: 1.4rem;
  margin-bottom: .6rem;
}

.card h3 {
  color: #ffd166;
  margin-bottom: .4rem;
}

/* TEXTE */
.card p,
.card li,
.card span {
  color: #eaeaea;
  line-height: 1.6;
}

/* NIVEAU */
.card strong {
  color: #ffd166;
}

/* ===============================
   ACTION "ACCÉDER AU COURS"
   =============================== */
.course-action {
  display: inline-block;
  margin-top: 1.2rem;
  padding: 12px 20px;
  border-radius: 14px;
  background: linear-gradient(135deg, #9b5cff, #f4d37a);
  color: #120824 !important;
  font-weight: 800;
  text-decoration: none !important;
  transition: all .2s ease;
}

.course-action:hover {
  filter: brightness(1.1);
  box-shadow: 0 0 25px rgba(180,140,255,.7);
}

/* ===============================
   FORMULAIRES
   =============================== */
input,
textarea,
select {
  width: 100%;
  padding: 12px 14px;
  border-radius: 12px;
  border: none;
  background: #1c133a;
  color: #f2f2f2;
  font-size: .95rem;
}

input::placeholder,
textarea::placeholder {
  color: #9a90c9;
}

textarea {
  resize: vertical;
  min-height: 120px;
}

label {
  display: block;
  margin-bottom: .3rem;
  color: #ffd166;
  font-size: .85rem;
}

/* ===============================
   BOUTONS
   =============================== */
button,
.btn-primary {
  cursor: pointer;
  border: none;
  padding: 12px 20px;
  border-radius: 14px;
  background: linear-gradient(135deg, #9b5cff, #f4d37a);
  color: #120824;
  font-weight: 800;
  font-size: .95rem;
  transition: all .2s ease;
}

button:hover,
.btn-primary:hover {
  filter: brightness(1.1);
  box-shadow: 0 0 25px rgba(180,140,255,.7);
}

/* ===============================
   TABLES (ADMIN)
   =============================== */
table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 1rem;
}

th, td {
  padding: 12px;
  text-align: left;
}

th {
  color: #ffd166;
  border-bottom: 1px solid rgba(255,255,255,.15);
}

td {
  color: #eaeaea;
  border-bottom: 1px solid rgba(255,255,255,.08);
}

/* ===============================
   MESSAGES
   =============================== */
.success { color: #7cffb2; }
.warning { color: #ffd166; }
.error   { color: #ff6b6b; }

/* ===============================
   RESPONSIVE TABLET
   =============================== */
@media (max-width: 768px) {
  main {
    padding: 1.2rem !important;
  }

  .card {
    padding: 1.4rem;
  }

  header h1 {
    font-size: 1.4rem;
  }
}

/* ===============================
   RESPONSIVE MOBILE (FIX QUESTIONS)
   =============================== */
@media (max-width: 600px) {

  .card {
    padding: 1.2rem;
    margin-bottom: 1.2rem;
    border-radius: 16px;
  }

  .card .card {
    padding: 1rem;
    margin-top: 1rem;
  }

  h1 { font-size: 1.3rem; }
  h2 { font-size: 1.15rem; }
  h3 { font-size: 1rem; }

  textarea {
    min-height: 100px;
  }

  .btn-primary,
  .course-action {
    width: 100%;
    text-align: center;
  }
}

/* ===============================
   VIDÉO RESPONSIVE YOUTUBE SAFE
   =============================== */

.video-wrapper {
  position: relative;
  width: 100%;
  max-width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: 16px;
  overflow: hidden;
  background: #000;
  isolation: isolate;
  z-index: 1;
}

/* Sécurité pour les navigateurs plus anciens */
@supports not (aspect-ratio: 16 / 9) {
  .video-wrapper {
    height: 0;
    padding-top: 56.25%;
  }
}

/* iframe injectée par YouTube */
.video-wrapper iframe,
.video-wrapper > #player {
  position: absolute !important;
  inset: 0;
  width: 100% !important;
  height: 100% !important;
  border: 0;
  display: block;
  z-index: 2;
  pointer-events: auto !important;
}

/* Empêche une couche invisible de bloquer les clics YouTube */
.video-wrapper::before,
.video-wrapper::after {
  pointer-events: none !important;
}

/* Cas spécial : seulement pour une vraie vidéo verticale */
.video-wrapper.video-portrait {
  aspect-ratio: 9 / 16;
}

@supports not (aspect-ratio: 9 / 16) {
  .video-wrapper.video-portrait {
    height: 0;
    padding-top: 177.77%;
  }
}

/* ===============================
   BADGE NOTE / GRADE
   =============================== */
.badge-grade {
  display: inline-block;
  margin: 1rem auto;
  padding: 10px 18px;
  border-radius: 999px;
  background: linear-gradient(135deg, #f4d37a, #9b5cff);
  color: #120824;
  font-weight: 800;
  box-shadow: 0 0 25px rgba(180,140,255,.6);
}

/* ===============================
   LOGIN MODERNE (CARRÉ / CLEAN)
   =============================== */
.login-wrapper {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at top, #140b2e, #08040f);
  padding: 1rem;
}

.login-box {
  width: 100%;
  max-width: 420px;
  background: #0f0a1e;
  border-radius: 10px;
  padding: 2.2rem;
  box-shadow: 0 25px 60px rgba(0,0,0,.6);
}

.login-box h1 {
  margin: 0;
  text-align: center;
  font-size: 1.4rem;
  color: #f4d37a;
}

.login-subtitle {
  text-align: center;
  font-size: .9rem;
  color: #a8a3c9;
  margin-bottom: 1.8rem;
}

.login-box input {
  width: 100%;
  margin-bottom: 1rem;
  padding: 12px 14px;
  border-radius: 6px;
  border: none;
  background: #1a1433;
  color: #fff;
  font-size: .95rem;
}

.login-box input::placeholder {
  color: #8f89b5;
}

.login-box button {
  width: 100%;
  margin-top: .5rem;
  padding: 12px;
  border-radius: 6px;
  border: none;
  background: #9b5cff;
  color: #fff;
  font-weight: 700;
  font-size: .95rem;
  cursor: pointer;
  transition: background .2s ease;
}

.login-box button:hover {
  background: #b18cff;
}

/* ===============================
   SECTION PROGRESSION VISUELLE
   =============================== */
.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

.section-meta {
  display: flex;
  flex-direction: column;
  gap: .3rem;
}

.section-status {
  font-size: .8rem;
  font-weight: 700;
  color: #9b5cff;
}

.section-status.done {
  color: #7cffb2;
}

.section-status.locked {
  color: #ff6b6b;
}

.progress-bar {
  background: #1c133a;
  border-radius: 999px;
  height: 12px;
  overflow: hidden;
  margin-top: .6rem;
}

.progress-bar > div {
  height: 100%;
  background: linear-gradient(135deg,#9b5cff,#f4d37a);
  transition: width .4s ease;
}

.section-count {
  font-size: .85rem;
  color: #e0e0e0;
}