/* ================================================
   FamilyStream — main.css
   Styles globaux du site (pages protégées)
   Thème sombre & violet, style streaming moderne
   ================================================ */

/* ── Variables globales ───────────────────────── */
:root {
  /* Couleurs */
  --clr-bg:         #0d0b14;
  --clr-surface:    #13101f;
  --clr-surface-2:  #1a1629;
  --clr-border:     #2a2040;
  --clr-purple:     #8b5cf6;
  --clr-purple-dk:  #6d28d9;
  --clr-purple-lt:  #a78bfa;
  --clr-purple-xlt: #c4b5fd;
  --clr-text:       #e8e0f5;
  --clr-muted:      #7c6fa0;
  --clr-muted-lt:   #a094c4;
  --clr-error:      #f87171;
  --clr-star:       #fbbf24;

  /* Genres */
  --clr-genre-famille:       #a855f7;
  --clr-genre-action:        #ef4444;
  --clr-genre-dessin-anime:  #f59e0b;
  --clr-genre-comedie:       #22c55e;
  --clr-genre-drame:         #3b82f6;
  --clr-genre-sf:            #06b6d4;
  --clr-genre-thriller:      #f97316;

  /* Layout */
  --nav-height:   68px;
  --sidebar-w:    220px;
  --radius-sm:    8px;
  --radius-md:    12px;
  --radius-lg:    18px;
  --radius-xl:    24px;

  /* Transitions */
  --t-fast: 0.15s ease;
  --t-mid:  0.25s ease;
  --t-slow: 0.4s ease;
}

/* ── Reset minimal ───────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  scroll-behavior: smooth;
  scrollbar-width: thin;
  scrollbar-color: var(--clr-purple-dk) var(--clr-surface);
}

body {
  background: var(--clr-bg);
  color: var(--clr-text);
  font-family: 'DM Sans', sans-serif;
  font-size: 15px;
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
}

::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--clr-surface); }
::-webkit-scrollbar-thumb { background: var(--clr-purple-dk); border-radius: 3px; }

/* ── Typographie ─────────────────────────────── */
h1, h2, h3, h4 {
  font-family: 'Syne', sans-serif;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.3px;
}

a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }
button { font-family: inherit; cursor: pointer; }

/* ── Navigation principale ───────────────────── */
.nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--nav-height);
  background: linear-gradient(
    to bottom,
    rgba(13, 11, 20, 0.98) 0%,
    rgba(13, 11, 20, 0.85) 80%,
    transparent 100%
  );
  backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(42, 32, 64, 0.5);
  display: flex;
  align-items: center;
  padding: 0 28px;
  gap: 32px;
  z-index: 1000;
}

/* Logo */
.nav-logo {
  display: flex;
  align-items: center;
  gap: 9px;
  flex-shrink: 0;
}

.nav-logo-icon {
  width: 34px; height: 34px;
  background: linear-gradient(135deg, var(--clr-purple), var(--clr-purple-dk));
  border-radius: 9px;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px;
  box-shadow: 0 3px 12px rgba(139, 92, 246, 0.4);
  flex-shrink: 0;
}

.nav-logo-text {
  font-family: 'Syne', sans-serif;
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -0.3px;
}

.nav-logo-text span { color: var(--clr-purple-lt); }

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

.nav-links a {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  color: var(--clr-muted);
  transition: color var(--t-mid), background var(--t-mid);
}

.nav-links a:hover,
.nav-links a.active {
  color: var(--clr-text);
  background: rgba(139, 92, 246, 0.15);
}

.nav-links a.active { color: var(--clr-purple-lt); }

/* Barre de recherche nav */
.nav-search {
  flex: 1;
  max-width: 360px;
  position: relative;
  margin-left: auto;
}

.nav-search input {
  width: 100%;
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--clr-border);
  border-radius: 50px;
  padding: 9px 16px 9px 40px;
  color: var(--clr-text);
  font-family: inherit;
  font-size: 14px;
  outline: none;
  transition: border-color var(--t-mid), background var(--t-mid), box-shadow var(--t-mid);
}

.nav-search input:focus {
  border-color: var(--clr-purple);
  background: rgba(139, 92, 246, 0.08);
  box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.15);
}

.nav-search input::placeholder { color: var(--clr-muted); }

.nav-search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--clr-muted);
  pointer-events: none;
}

/* Bouton déconnexion */
.nav-logout {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  background: rgba(139, 92, 246, 0.12);
  border: 1px solid rgba(139, 92, 246, 0.25);
  border-radius: 50px;
  color: var(--clr-purple-lt);
  font-size: 13px;
  font-weight: 500;
  transition: background var(--t-mid), border-color var(--t-mid);
  flex-shrink: 0;
}

.nav-logout:hover {
  background: rgba(139, 92, 246, 0.22);
  border-color: rgba(139, 92, 246, 0.45);
}

/* ── Layout principal ────────────────────────── */
.page-wrapper {
  padding-top: var(--nav-height);
  min-height: 100vh;
}

.container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 28px;
}

/* ── HERO BANNER ─────────────────────────────── */
.hero {
  position: relative;
  height: 75vh;
  min-height: 500px;
  display: flex;
  align-items: flex-end;
  overflow: hidden;
}

.hero-bg {
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, #1a0a3e 0%, #0d0b14 60%);
  /* L'image de fond est injectée via JS */
  background-size: cover;
  background-position: center top;
}

/* Dégradés de fondu sur le hero */
.hero-bg::after {
  content: '';
  position: absolute;
  inset: 0;
  background:
    linear-gradient(to bottom, transparent 20%, var(--clr-bg) 100%),
    linear-gradient(to right, rgba(13,11,20,0.85) 35%, transparent 70%);
}

.hero-content {
  position: relative;
  z-index: 1;
  padding: 0 28px 52px;
  max-width: 600px;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(139, 92, 246, 0.2);
  border: 1px solid rgba(139, 92, 246, 0.4);
  border-radius: 50px;
  padding: 5px 14px;
  font-size: 12px;
  font-weight: 600;
  color: var(--clr-purple-lt);
  letter-spacing: 0.5px;
  text-transform: uppercase;
  margin-bottom: 16px;
}

.hero-title {
  font-size: clamp(28px, 5vw, 50px);
  font-weight: 800;
  line-height: 1.1;
  margin-bottom: 14px;
  text-shadow: 0 2px 20px rgba(0,0,0,0.5);
}

.hero-meta {
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: 13px;
  color: var(--clr-muted-lt);
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.hero-meta .dot { width: 4px; height: 4px; background: var(--clr-muted); border-radius: 50%; }

.hero-desc {
  font-size: 15px;
  color: var(--clr-muted-lt);
  line-height: 1.7;
  margin-bottom: 26px;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.hero-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

/* Bouton lecture principal */
.btn-play {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 13px 28px;
  background: var(--clr-purple);
  border: none;
  border-radius: 50px;
  color: #fff;
  font-family: 'Syne', sans-serif;
  font-size: 15px;
  font-weight: 700;
  transition: background var(--t-mid), transform var(--t-mid), box-shadow var(--t-mid);
  box-shadow: 0 4px 20px rgba(139, 92, 246, 0.45);
}

.btn-play:hover {
  background: var(--clr-purple-lt);
  transform: translateY(-2px);
  box-shadow: 0 8px 28px rgba(139, 92, 246, 0.55);
}

/* Bouton infos secondaire */
.btn-info {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 13px 24px;
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 50px;
  color: var(--clr-text);
  font-size: 15px;
  font-weight: 500;
  transition: background var(--t-mid), border-color var(--t-mid);
}

.btn-info:hover {
  background: rgba(255,255,255,0.16);
  border-color: rgba(255,255,255,0.25);
}

/* ── SECTIONS DE CONTENU ─────────────────────── */
.content-section {
  margin-bottom: 48px;
}

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

.section-title {
  font-family: 'Syne', sans-serif;
  font-size: 20px;
  font-weight: 700;
  color: var(--clr-text);
  display: flex;
  align-items: center;
  gap: 10px;
}

.section-title-icon {
  font-size: 18px;
}

.section-link {
  font-size: 13px;
  color: var(--clr-purple-lt);
  font-weight: 500;
  transition: color var(--t-fast);
  display: flex;
  align-items: center;
  gap: 4px;
}

.section-link:hover { color: var(--clr-purple-xlt); }

/* ── GRILLE DE CARTES VIDÉO ──────────────────── */
.video-row {
  display: grid;
  /* Colonnes adaptatives min 180px */
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 16px;
}

/* Grille plus compacte pour la vue genre */
.video-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 20px;
}

/* ── CARTE VIDÉO ─────────────────────────────── */
.video-card {
  position: relative;
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--clr-surface);
  cursor: pointer;
  transition: transform var(--t-mid), box-shadow var(--t-mid);
  group: true; /* pour les pseudo-effets */
}

.video-card:hover {
  transform: translateY(-6px) scale(1.02);
  box-shadow: 0 16px 40px rgba(0,0,0,0.5), 0 0 0 1px rgba(139,92,246,0.3);
  z-index: 2;
}

/* Thumbnail */
.card-thumb {
  position: relative;
  aspect-ratio: 16/9;
  overflow: hidden;
  background: var(--clr-surface-2);
}

.card-thumb img {
  width: 100%; height: 100%;
  object-fit: cover;
  transition: transform var(--t-slow);
}

.video-card:hover .card-thumb img { transform: scale(1.08); }

/* Overlay au survol */
.card-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to bottom, transparent 40%, rgba(13,11,20,0.9) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity var(--t-mid);
}

.video-card:hover .card-overlay { opacity: 1; }

.card-play-btn {
  width: 48px; height: 48px;
  background: rgba(139, 92, 246, 0.9);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  backdrop-filter: blur(4px);
  transform: scale(0.8);
  transition: transform var(--t-mid), background var(--t-mid);
  box-shadow: 0 4px 16px rgba(139,92,246,0.5);
}

.video-card:hover .card-play-btn {
  transform: scale(1);
  background: var(--clr-purple);
}

/* Badge genre sur la carte */
.card-genre-badge {
  position: absolute;
  top: 10px;
  left: 10px;
  background: rgba(13, 11, 20, 0.75);
  border-radius: 50px;
  padding: 3px 10px;
  font-size: 11px;
  font-weight: 600;
  color: var(--clr-purple-xlt);
  backdrop-filter: blur(4px);
  border: 1px solid rgba(139,92,246,0.2);
}

/* Placeholder image manquante */
.card-thumb-placeholder {
  width: 100%; height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--clr-surface-2), var(--clr-surface));
  font-size: 40px;
  color: var(--clr-border);
}

/* Corps de la carte */
.card-body {
  padding: 12px 14px 14px;
}

.card-title {
  font-family: 'Syne', sans-serif;
  font-size: 14px;
  font-weight: 700;
  color: var(--clr-text);
  margin-bottom: 5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.card-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  color: var(--clr-muted);
  gap: 8px;
}

.card-rating {
  display: flex;
  align-items: center;
  gap: 2px;
  color: var(--clr-star);
  font-size: 12px;
}

/* ── BADGES GENRES (navigation genre) ────────── */
.genre-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 32px;
}

.genre-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 18px;
  border-radius: 50px;
  background: var(--clr-surface);
  border: 1px solid var(--clr-border);
  color: var(--clr-muted-lt);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background var(--t-mid), border-color var(--t-mid), color var(--t-mid), transform var(--t-fast);
}

.genre-pill:hover {
  background: var(--clr-surface-2);
  border-color: var(--clr-purple);
  color: var(--clr-text);
  transform: translateY(-2px);
}

.genre-pill.active {
  background: rgba(139, 92, 246, 0.2);
  border-color: var(--clr-purple);
  color: var(--clr-purple-xlt);
}

.genre-pill-icon { font-size: 16px; }

/* ── PAGE TITRE / EN-TÊTE DE SECTION ─────────── */
.page-header {
  padding: 40px 0 32px;
  border-bottom: 1px solid var(--clr-border);
  margin-bottom: 36px;
}

.page-header h1 {
  font-size: 32px;
  font-weight: 800;
  margin-bottom: 6px;
}

.page-header p {
  color: var(--clr-muted);
  font-size: 15px;
}

/* ── BARRE DE RECHERCHE (page dédiée) ────────── */
.search-bar-wrap {
  position: relative;
  margin-bottom: 28px;
}

.search-bar-wrap input {
  width: 100%;
  background: var(--clr-surface);
  border: 1px solid var(--clr-border);
  border-radius: var(--radius-lg);
  padding: 16px 24px 16px 52px;
  color: var(--clr-text);
  font-family: inherit;
  font-size: 16px;
  outline: none;
  transition: border-color var(--t-mid), box-shadow var(--t-mid);
}

.search-bar-wrap input:focus {
  border-color: var(--clr-purple);
  box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.2);
}

.search-bar-wrap input::placeholder { color: var(--clr-muted); }

.search-bar-icon {
  position: absolute;
  left: 18px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--clr-muted);
  pointer-events: none;
  font-size: 18px;
}

/* Filtres de recherche */
.search-filters {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 28px;
}

.filter-btn {
  padding: 7px 16px;
  border-radius: 50px;
  background: var(--clr-surface);
  border: 1px solid var(--clr-border);
  color: var(--clr-muted);
  font-size: 13px;
  font-weight: 500;
  transition: all var(--t-mid);
}

.filter-btn:hover, .filter-btn.active {
  background: rgba(139,92,246,0.15);
  border-color: var(--clr-purple);
  color: var(--clr-purple-lt);
}

/* ── RÉSULTATS VIDES ─────────────────────────── */
.empty-state {
  text-align: center;
  padding: 80px 20px;
  color: var(--clr-muted);
}

.empty-state-icon {
  font-size: 56px;
  margin-bottom: 16px;
  opacity: 0.5;
}

.empty-state h3 {
  font-size: 20px;
  font-weight: 700;
  color: var(--clr-muted-lt);
  margin-bottom: 8px;
}

.empty-state p { font-size: 14px; }

/* ── PAGE LECTEUR VIDÉO ──────────────────────── */
.player-container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 32px 28px 60px;
}

.player-wrap {
  position: relative;
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: #000;
  box-shadow: 0 24px 60px rgba(0,0,0,0.7), 0 0 0 1px rgba(139,92,246,0.2);
  margin-bottom: 28px;
  aspect-ratio: 16/9;
}

.player-wrap video {
  width: 100%;
  height: 100%;
  display: block;
}

/* Infos du film sous le lecteur */
.player-info { margin-bottom: 32px; }

.player-title {
  font-size: 28px;
  font-weight: 800;
  margin-bottom: 10px;
}

.player-meta {
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: 14px;
  color: var(--clr-muted-lt);
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.player-meta .dot { width: 4px; height: 4px; background: var(--clr-muted); border-radius: 50%; }

.player-desc {
  font-size: 15px;
  color: var(--clr-muted-lt);
  line-height: 1.7;
  max-width: 750px;
}

/* Genres du film (player) */
.player-genres {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 14px;
}

.player-genre-tag {
  padding: 5px 14px;
  border-radius: 50px;
  border: 1px solid var(--clr-border);
  background: var(--clr-surface);
  font-size: 12px;
  font-weight: 600;
  color: var(--clr-purple-lt);
}

/* ── ÉTOILES DE NOTATION ─────────────────────── */
.stars { color: var(--clr-star); letter-spacing: 1px; }

/* ── ÉTAT DE CHARGEMENT ──────────────────────── */
.loading-overlay {
  position: fixed;
  inset: 0;
  background: var(--clr-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  flex-direction: column;
  gap: 16px;
  transition: opacity 0.4s ease;
}

.loading-overlay.hidden {
  opacity: 0;
  pointer-events: none;
}

.loading-spinner {
  width: 44px; height: 44px;
  border: 3px solid var(--clr-border);
  border-top-color: var(--clr-purple);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

.loading-text { color: var(--clr-muted); font-size: 14px; }

/* ── FOOTER ──────────────────────────────────── */
.site-footer {
  border-top: 1px solid var(--clr-border);
  padding: 28px;
  text-align: center;
  color: var(--clr-muted);
  font-size: 13px;
}

/* ── RESPONSIVE ──────────────────────────────── */
@media (max-width: 900px) {
  .nav { padding: 0 16px; gap: 16px; }
  .nav-links { display: none; }
  .nav-search { max-width: none; }
  .hero-content { padding: 0 16px 36px; }
  .container { padding: 0 16px; }
  .video-row { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
}

@media (max-width: 600px) {
  .hero { height: 60vh; min-height: 400px; }
  .hero-title { font-size: 24px; }
  .video-row { grid-template-columns: repeat(2, 1fr); }
  .player-title { font-size: 22px; }
}

/* ── ANIMATIONS D'ENTRÉE ─────────────────────── */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}

.anim-in {
  animation: fadeUp 0.4s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.anim-in-d1 { animation-delay: 0.05s; }
.anim-in-d2 { animation-delay: 0.1s; }
.anim-in-d3 { animation-delay: 0.15s; }
.anim-in-d4 { animation-delay: 0.2s; }
