/* =========================================================
   Vidéos : accueil des vidéos, liste par matière, lecteur
   (réutilise la barre latérale, les tuiles et les onglets du reste du site)
   ========================================================= */

/* Accueil des vidéos : pas de barre latérale, comme l'accueil et la boutique */
body.page-videos .main-content { margin-left: 0; padding: 1.5rem 2rem 3rem; }
body.page-videos .hamburger-btn { display: none; }
body.page-videos .page-content { max-width: 1100px; }

.videos-hero { padding: 1rem 0 0.5rem; max-width: 760px; }
.videos-hero h1 { font-family: var(--font-display); font-size: clamp(1.7rem, 4.5vw, 2.7rem); line-height: 1.12; margin: 0.2rem 0 0.7rem; color: var(--color-text); }
.videos-hero .hero-subtitle { font-size: 1.02rem; color: var(--color-text-muted); margin: 0 0 1rem; }
.videos-hero .hero-stats { display: flex; flex-wrap: wrap; gap: 0.5rem 1.25rem; list-style: none; margin: 0; padding: 0; color: var(--color-text-muted); font-size: 0.9rem; }
.videos-hero .hero-stats li { display: inline-flex; align-items: center; gap: 0.4rem; }

body.page-videos .classes-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 0.9rem; }
.class-card.is-soon { opacity: 0.5; pointer-events: none; filter: grayscale(0.35); }

/* Liste des vidéos */
.video-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 0.85rem; }
.video-card {
  display: flex; align-items: center; gap: 0.85rem; padding: 0.8rem 0.9rem;
  background: #fff; border: 1px solid var(--color-border); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm); color: var(--color-text); text-decoration: none;
  transition: transform var(--transition-fast), box-shadow var(--transition-fast), border-color var(--transition-fast);
}
.video-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); border-color: var(--classe-accent, var(--color-primary)); }
.video-card-thumb {
  flex: none; display: flex; align-items: center; justify-content: center; width: 54px; height: 54px;
  border-radius: 14px; background: var(--classe-accent, var(--color-primary)); color: #fff; font-size: 1.7rem;
}
.video-card-body { display: flex; flex-direction: column; min-width: 0; gap: 0.15rem; }
.video-card-title { font-weight: 700; font-size: 0.95rem; line-height: 1.25; }
.video-card-meta { font-size: 0.78rem; color: var(--color-text-muted); }

/* Lecteur */
.video-player {
  position: relative; width: 100%; max-width: 1000px; aspect-ratio: 16 / 9; background: #0f1b2d;
  border-radius: var(--radius-lg); overflow: hidden; box-shadow: var(--shadow-md);
}
.video-player iframe, .video-player video { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; background: #0f1b2d; }
.video-player:fullscreen { max-width: none; border-radius: 0; aspect-ratio: auto; }
.video-player:fullscreen video, .video-player:fullscreen iframe { background: #000; }
.video-player:-webkit-full-screen { max-width: none; width: 100%; height: 100%; border-radius: 0; aspect-ratio: auto; background: #000; }
.video-actions { display: flex; flex-wrap: wrap; gap: 0.6rem; margin: 0.9rem 0 0.4rem; }
.video-help { font-size: 0.85rem; color: var(--color-text-muted); margin: 0 0 1rem; max-width: 760px; }
.video-nav { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; max-width: 1000px; margin-top: 0.5rem; }
.video-nav a { font-weight: 600; font-size: 0.9rem; color: var(--classe-accent, var(--color-primary-dark)); }

@media (max-width: 767px) {
  body.page-videos .main-content { padding: 1rem 1rem 2rem; }
  .video-grid { grid-template-columns: 1fr; }
  body.page-videos .classes-grid { grid-template-columns: 1fr 1fr; }
  .video-player { border-radius: 10px; }
  .video-actions .btn { flex: 1 1 100%; justify-content: center; }
}

/* Cartes de classe des vidéos : le nom (ex. « Terminale ») ne doit pas repousser l'icône hors de la carte */
body.page-videos .class-card-head { flex-wrap: nowrap; }
body.page-videos .class-card-name { font-size: 1.35rem; }
body.page-videos .class-card-icon { flex: none; width: 2.4rem; height: 2.4rem; font-size: 1.3rem; }
@media (max-width: 767px) {
  body.page-videos .class-card { padding: 1.3em 1em 1em; }
  body.page-videos .class-card-name { font-size: 1.15rem; }
  body.page-videos .class-card-icon { width: 2rem; height: 2rem; font-size: 1.1rem; }
}

/* accès aux vidéos (compte / abonnés) */
.video-badge { display: inline-block; font-size: 0.68rem; font-weight: 700; padding: 0.08rem 0.45rem; border-radius: 99px; margin-left: 0.35rem; vertical-align: middle; white-space: nowrap; }
.video-badge-libre { background: #e7f5ea; color: #1b5e2f; }
.video-badge-compte { background: #e6efff; color: #1d4ed8; }
.video-badge-abonnes { background: #fff3cf; color: #7a5a00; }
.video-locked { max-width: 560px; margin: 1rem auto 1.5rem; text-align: center; padding: 1.6rem 1.2rem; background: var(--color-surface, #fbf7ee); border: 1px solid var(--color-border, #e6dcc7); border-radius: 16px; }
.video-locked-icon { font-size: 2.2rem; }
.video-locked h2 { margin: 0.3rem 0 0.4rem; font-size: 1.2rem; }
.video-locked p { margin: 0 0 0.8rem; color: var(--color-text-muted); line-height: 1.5; }

/* Fenêtre « créer un compte gratuit » pour un visiteur non connecté (assets/js/videos-gate.js) */
.videos-gate[hidden] { display: none; }
.videos-gate { position: fixed; inset: 0; z-index: 600; display: grid; place-items: center; padding: 1rem; }
.videos-gate-backdrop { position: absolute; inset: 0; background: rgba(16, 28, 48, 0.62); backdrop-filter: blur(2px); }
.videos-gate-box { position: relative; width: min(26rem, 100%); max-height: calc(100dvh - 2rem); overflow-y: auto; padding: 1.6rem 1.6rem 1.4rem; background: var(--color-surface, #fff); border-radius: 16px; box-shadow: 0 24px 60px rgba(0, 0, 0, 0.4); text-align: center; }
.videos-gate-x { position: absolute; top: 0.5rem; right: 0.6rem; width: 2.2rem; height: 2.2rem; border: 0; border-radius: 50%; background: transparent; font-size: 1.6rem; line-height: 1; color: var(--color-text-muted); cursor: pointer; }
.videos-gate-x:hover { background: var(--color-primary-light, #f0ebdd); color: var(--color-text); }
.videos-gate-icon { font-size: 2.3rem; margin: 0 0 0.3rem; }
.videos-gate-box h2 { margin: 0 0 0.5rem; font-size: 1.25rem; }
.videos-gate-box p { margin: 0 0 1.1rem; color: var(--color-text-muted); line-height: 1.5; }
.videos-gate-box .btn { width: 100%; justify-content: center; }
.videos-gate-later { display: block; margin: 0.7rem auto 0; background: none; border: 0; color: var(--color-text-muted); font: inherit; font-size: 0.85rem; text-decoration: underline; cursor: pointer; }
body.videos-gate-open { overflow: hidden; }
/* Sous 768px, la navigation (Accueil/Boutique/…) devient une bande fixe en bas d'écran (responsive.css,
   --tabbar-height) : réserver sa hauteur pour que le bas de la fenêtre (bouton « Plus tard ») ne se
   retrouve jamais caché dessous. */
@media (max-width: 767px) {
  .videos-gate { padding-bottom: calc(var(--tabbar-height, 60px) + env(safe-area-inset-bottom)); }
}
@media (max-width: 520px) {
  .videos-gate { align-items: end; padding-left: 0; padding-right: 0; padding-top: 0; }
  .videos-gate-box { width: 100%; max-height: 94dvh; border-radius: 16px 16px 0 0; }
}
