/* ============================================================
   PRIME.CSS — Thème sombre style Prime Video pour KFlix
   Chargé APRÈS style.css et cards.css : surcharge proprement.
   Palette : fond #00050D · texte blanc · accent rouge KFlix #E50914
   ============================================================ */

:root {
    --pv-bg: #00050D;
    --pv-surface: #0A1420;
    --pv-surface-2: #101B28;
    --pv-border: rgba(255,255,255,0.12);
    --pv-text: #FFFFFF;
    --pv-muted: #8197A4;
    --pv-accent: #E50914;
    --pv-accent-hover: #FF1F2D;
    --pv-nav-h: 56px;
}

/* ============================================================
   1. BASE — police Amazon Ember, fond noir, texte blanc
   ============================================================ */
body {
    font-family: "Amazon Ember", "Helvetica Neue", Helvetica, Arial, sans-serif !important;
    background-color: var(--pv-bg) !important;
    color: var(--pv-text) !important;
    line-height: 1.5;
    font-size: 15px;
}

/* Neutraliser les textes noirs forcés de style.css */
h1:not(.modal-title), h2:not(.modal-title), h3:not(.kflix-section-title):not(.modal-title),
h4:not(.dropdown-header):not(.section-title):not(.modal-title),
h5:not(.modal-title), h6:not(.card-header h6) {
    color: var(--pv-text) !important;
}
p, li, label, td, th { color: var(--pv-text); }
.text-muted, small.text-muted, .kflix-card-meta { color: var(--pv-muted) !important; }
.kflix-row-title, .kflix-card-title { color: var(--pv-text) !important; }
strong, b { color: inherit; }

a { color: var(--pv-text); }
a:hover { color: #ccc; }

::selection { background: var(--pv-accent); color: #fff; }

/* Scrollbar sombre */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--pv-bg); }
::-webkit-scrollbar-thumb { background: #2A3846; border-radius: 5px; }
::-webkit-scrollbar-thumb:hover { background: #3A4A58; }

main, .container-fluid, .subscription-page, .offers-page { background: transparent !important; }

/* ============================================================
   2. NAVBAR style Prime Video — noire translucide → opaque
   ============================================================ */
header {
    background: linear-gradient(to bottom, rgba(0,5,13,0.85) 0%, rgba(0,5,13,0.45) 100%) !important;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border-bottom: none !important;
    height: var(--pv-nav-h);
    padding: 0 !important;
    transition: background 0.3s ease;
}
header.scrolled,
header.nav-solid {
    background: #00050D !important;
    border-bottom: 1px solid var(--pv-border) !important;
}
.navbar { background: transparent !important; padding: 0 3% !important; height: 100%; }

.logo a, .logo { color: var(--pv-accent) !important; }
.logo-text, .logo span { color: var(--pv-accent) !important; }

/* Liens plats style Prime */
.nav-links { display: flex; align-items: center; gap: 4px; height: 100%; }
.nav-link {
    color: rgba(255,255,255,0.82) !important;
    font-size: 14px !important;
    font-weight: 500 !important;
    padding: 8px 14px !important;
    border-radius: 4px;
    transition: color 0.15s ease;
    position: relative;
}
.nav-link::after { display: none !important; } /* retire le soulignement animé Netflix */
.nav-link:hover { color: #fff !important; }
.nav-link.active { color: #fff !important; font-weight: 700; }

/* Dropdowns simplifiés sombres */
.dropdown-menu {
    background: #0A1420 !important;
    border: 1px solid var(--pv-border) !important;
    border-radius: 6px !important;
    box-shadow: 0 8px 32px rgba(0,0,0,.6) !important;
    padding: 6px !important;
    min-width: 200px;
}
.dropdown-item {
    color: rgba(255,255,255,0.85) !important;
    font-size: 13.5px !important;
    padding: 8px 12px !important;
    border-radius: 4px;
}
.dropdown-item:hover { background: rgba(255,255,255,0.08) !important; color: #fff !important; }
.dropdown-header { color: var(--pv-muted) !important; font-size: 11px !important; text-transform: uppercase; letter-spacing: .5px; }
.dropdown-divider { border-color: var(--pv-border) !important; }

/* Recherche : icône qui s'étend au focus */
.search-container { margin-left: auto !important; }
.search-form { display: flex; align-items: center; }
.search-input {
    background: rgba(255,255,255,0.1) !important;
    border: 1px solid var(--pv-border) !important;
    color: #fff !important;
    width: 180px !important;
    transition: width 0.25s ease, background 0.25s ease;
    border-radius: 4px 0 0 4px !important;
    font-size: 13.5px !important;
    height: 36px;
}
.search-input:focus { width: 280px !important; background: rgba(255,255,255,0.16) !important; outline: none; }
.search-input::placeholder { color: rgba(255,255,255,0.45); }
.search-button {
    background: rgba(255,255,255,0.1) !important;
    border: 1px solid var(--pv-border) !important;
    border-left: none !important;
    color: #fff !important;
    height: 36px;
    border-radius: 0 4px 4px 0 !important;
    padding: 0 10px;
}
.search-button:hover { background: rgba(255,255,255,0.18) !important; }

/* Boutons connexion / inscription navbar */
.login-btn, .register-btn {
    color: #fff !important;
    border: 1px solid var(--pv-border) !important;
    border-radius: 4px !important;
    padding: 6px 14px !important;
    font-size: 13.5px !important;
}
.register-btn { background: var(--pv-accent) !important; border-color: var(--pv-accent) !important; }
.login-btn:hover { border-color: #fff !important; }
.register-btn:hover { background: var(--pv-accent-hover) !important; }

/* Avatar user dropdown */
.user-avatar { color: #fff !important; }
.username { color: #fff !important; }
.avatar-img { border: 2px solid var(--pv-border); }

/* Badge messages */
.messages-badge {
    background: var(--pv-accent) !important;
    color: #fff !important;
    border: 2px solid var(--pv-bg);
}

/* ============================================================
   3. HERO — conservation Netflix (fond déjà sombre)
   ============================================================ */
.kflix-hero-btn-play { background: var(--pv-accent) !important; }
.kflix-hero-btn-play:hover { background: var(--pv-accent-hover) !important; }
.kflix-hero-btn-info { background: rgba(109,109,110,0.7) !important; color: #fff !important; }
.kflix-hero-desc { color: rgba(255,255,255,0.85) !important; }

/* ============================================================
   4. RANGÉES & SLIDERS — titres blancs + flèches chevron
   ============================================================ */
.kflix-row { position: relative; margin-bottom: 0.5rem !important; }
.kflix-row-title {
    color: var(--pv-text) !important;
    font-size: 1.35rem !important;
    font-weight: 700 !important;
    letter-spacing: -0.2px;
    padding: 0 56px !important;
    margin-bottom: 0.75rem !important;
}

/* Flèches chevron visibles au hover de la rangée */
.kflix-row:hover .row-arrow {
    opacity: 1;
    pointer-events: auto;
}
.row-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 20;
    width: 40px;
    height: 100%;
    max-height: 260px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(to right, rgba(0,5,13,0.9), rgba(0,5,13,0));
    border: none;
    color: #fff;
    font-size: 2rem;
    cursor: pointer;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
}
.row-arrow.arrow-left { left: 0; }
.row-arrow.arrow-right { right: 0; background: linear-gradient(to left, rgba(0,5,13,0.9), rgba(0,5,13,0)); }
.row-arrow:hover { color: var(--pv-accent); }

/* ============================================================
   5. CARDS — signature Prime : hover agrandit + panneau détails
   ============================================================ */

/* Wrapper de la carte (positionnement du panneau) */
.pv-card-wrap {
    position: relative;
    flex: 0 0 auto;
    scroll-snap-align: start;
    /* largeurs gérées par les media queries existantes sur kflix-card */
}
.kflix-slider > .pv-card-wrap { flex-basis: calc((100% - 72px) / 5.5) !important; }
@media (min-width: 1800px) { .kflix-slider > .pv-card-wrap { flex-basis: calc((100% - 81px) / 5.5) !important; } }
@media (max-width: 900px)  { .kflix-slider > .pv-card-wrap { flex-basis: calc((100% - 24px) / 2.5) !important; } }
@media (max-width: 600px)  { .kflix-slider > .pv-card-wrap { flex-basis: 68% !important; } }
@media (max-width: 480px)  { .kflix-slider > .pv-card-wrap { flex-basis: 70% !important; } }

/* La carte elle-même */
.pv-card {
    position: relative;
    aspect-ratio: 2/3;
    border-radius: 6px;
    overflow: visible;
    cursor: pointer;
    background: var(--pv-surface);
    transition: transform 0.3s cubic-bezier(0.25,0.46,0.45,0.94);
    transform-origin: center bottom;
    will-change: transform;
}

/* Au hover : la carte s'agrandit nettement (signature Prime) */
@media (min-width: 901px) {
    .pv-card:hover {
        transform: scale(1.32);
        z-index: 100;
    }
}

/* Media (image + vidéo trailer) */
.pv-card-media {
    position: relative;
    width: 100%;
    height: 100%;
    border-radius: 6px;
    overflow: hidden;
    background: var(--pv-surface-2);
    box-shadow: 0 2px 10px rgba(0,0,0,0.5);
    transition: box-shadow 0.3s ease;
}
.pv-card:hover .pv-card-media {
    box-shadow: 0 16px 48px rgba(0,0,0,0.75);
}
.pv-card-media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.pv-card-media video {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: none;
    z-index: 2;
}
.pv-card.playing .pv-card-media video { display: block; }
.pv-card.playing .pv-card-media img { opacity: 0.35; }

/* Trailer en lecture sur kflix-card (markup existant home.php) :
   cacher l'overlay titre pour voir le trailer plein cadre */
.kflix-card.playing .kflix-card-info,
.kflix-card.playing .trending-badge,
.kflix-card.playing .new-badge { opacity: 0; pointer-events: none; }
.kflix-card.playing { border-radius: 6px; }

/* Titre + méta superposés en bas de l'image */
.pv-card-overlay {
    position: absolute;
    bottom: 0; left: 0; right: 0;
    padding: 26px 10px 10px;
    z-index: 3;
    background: linear-gradient(to top, rgba(0,0,0,0.88) 0%, rgba(0,0,0,0.35) 55%, transparent 100%);
    transition: opacity 0.2s ease;
}
.pv-card.playing .pv-card-overlay { opacity: 0; } /* trailer plein cadre = on cache l'overlay */

.pv-card-title {
    font-size: 0.85rem;
    font-weight: 700;
    color: #fff;
    margin: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.pv-card-year {
    font-size: 0.72rem;
    color: var(--pv-muted);
    margin: 2px 0 0;
}

/* Barre d'accent rouge KFlix */
.pv-card-badge {
    display: inline-block;
    padding: 2px 7px;
    background: var(--pv-accent);
    color: #fff;
    font-size: 0.62rem;
    font-weight: 700;
    border-radius: 3px;
    letter-spacing: 0.4px;
    margin-bottom: 3px;
}

/* Indicateur épisodes (séries) */
.pv-card-episodes {
    display: flex;
    gap: 3px;
    margin-top: 5px;
}
.pv-card-episodes span {
    flex: 1;
    height: 3px;
    border-radius: 2px;
    background: rgba(255,255,255,0.35);
}

/* ---------- PANNEAU DE DÉTAILS (glisse sous la carte au hover) ---------- */
.pv-card-detail {
    position: absolute;
    top: calc(100% - 4px);
    left: -12%;
    width: 124%;
    background: #16181F;
    border-radius: 0 0 8px 8px;
    padding: 12px 14px 14px;
    z-index: 99;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    transition: opacity 0.22s ease 0.12s, transform 0.22s ease 0.12s, visibility 0.22s 0.12s;
    box-shadow: 0 20px 60px rgba(0,0,0,0.85);
}
.pv-card:hover .pv-card-detail {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.pv-detail-title {
    font-size: 0.95rem;
    font-weight: 700;
    color: #fff;
    margin: 0 0 3px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.pv-detail-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.72rem;
    color: var(--pv-muted);
    margin-bottom: 7px;
}
.pv-detail-meta .match { color: #46D369; font-weight: 700; } /* % de correspondance vert Prime */
.pv-detail-meta .age {
    border: 1px solid rgba(255,255,255,0.35);
    padding: 0 4px;
    border-radius: 2px;
    font-weight: 600;
}
.pv-detail-desc {
    font-size: 0.78rem;
    line-height: 1.42;
    color: rgba(255,255,255,0.82);
    margin: 0 0 9px;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Boutons du panneau */
.pv-detail-actions { display: flex; gap: 6px; align-items: center; }
.pv-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    padding: 6px 14px;
    border-radius: 4px;
    border: none;
    font-size: 0.78rem;
    font-weight: 700;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.15s ease;
}
.pv-btn-play { background: var(--pv-accent); color: #fff; }
.pv-btn-play:hover { background: var(--pv-accent-hover); }
.pv-btn-circle {
    width: 30px;
    height: 30px;
    padding: 0;
    border-radius: 50%;
    background: rgba(255,255,255,0.15);
    border: 1px solid rgba(255,255,255,0.35);
    color: #fff;
    font-size: 0.8rem;
}
.pv-btn-circle:hover { background: rgba(255,255,255,0.28); border-color: #fff; }

/* ============================================================
   5bis. CARDS + FLYOUT (style Prime Video)
   Au hover, la carte « s'arrache » de sa rangée : un calque fixe
   (position:fixed) naît d'elle et s'agrandit au double, comme une
   modale de lecture — sans contrainte du slider.
   ============================================================ */
.kflix-card {
    border-radius: 6px;
    transition: box-shadow 0.25s ease, opacity 0.25s ease;
}
/* La carte d'origine s'estompe pendant que son double est affiché */
.kflix-card.pv-origin-dimmed { opacity: 0.35; }

/* ---------- FLYOUT : le double agrandi ---------- */
.pv-flyout {
    position: fixed;
    z-index: 6000; /* au-dessus de la navbar (1000) */
    background: #16181F;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 30px 90px rgba(0,0,0,0.9);
    opacity: 0;
    transform: scale(0.55) translateY(12px);
    transition: transform 0.28s cubic-bezier(0.2,0.8,0.25,1), opacity 0.22s ease;
    cursor: pointer;
}
.pv-flyout.pv-open {
    opacity: 1;
    transform: scale(1) translateY(0);
}
.pv-flyout.closing {
    opacity: 0;
    transform: scale(0.7) translateY(8px);
    transition: transform 0.18s ease, opacity 0.16s ease;
}

/* Média 16/9 (format lecture, comme les cartes étendues Prime) */
.pv-flyout-media {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    background: #000;
    overflow: hidden;
}
.pv-flyout-media img,
.pv-flyout-media video {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.pv-flyout-media video { display: none; }
.pv-flyout.playing .pv-flyout-media video { display: block; }
.pv-flyout.playing .pv-flyout-media img { opacity: 0.3; }

/* Dégradé titre sur le média */
.pv-flyout-media::after {
    content: '';
    position: absolute;
    bottom: 0; left: 0; right: 0;
    height: 45%;
    background: linear-gradient(to top, rgba(0,0,0,0.85), transparent);
    z-index: 1;
}
.pv-flyout-media .pv-flyout-title-overlay {
    position: absolute;
    bottom: 8px; left: 14px;
    z-index: 2;
    font-size: 1rem;
    font-weight: 700;
    color: #fff;
    text-shadow: 0 1px 6px rgba(0,0,0,.6);
}

/* Panneau de détails sous le média */
.pv-flyout-detail {
    padding: 12px 16px 16px;
    text-align: left;
}
.pv-detail-title {
    font-size: 0.95rem;
    font-weight: 700;
    color: #fff;
    margin: 0 0 4px;
}
.kflix-inject-meta {
    display: flex; align-items: center; gap: 7px;
    font-size: 0.72rem; color: var(--pv-muted); margin-bottom: 6px;
}
.kflix-inject-meta .match { color: #46D369; font-weight: 700; }
.kflix-inject-meta .age { border: 1px solid rgba(255,255,255,0.35); padding: 0 4px; border-radius: 2px; font-weight: 600; }
.kflix-inject-desc {
    font-size: 0.78rem;
    line-height: 1.42;
    color: rgba(255,255,255,0.82);
    margin: 0 0 2px;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Boutons */
.kflix-inject-actions { display: flex; gap: 6px; align-items: center; margin-top: 9px; }
.kflix-inject-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    padding: 7px 16px;
    border-radius: 4px;
    border: none;
    font-size: 0.78rem;
    font-weight: 700;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.15s ease;
    color: #fff;
}
.kflix-inject-btn.play { background: var(--pv-accent); }
.kflix-inject-btn.play:hover { background: var(--pv-accent-hover); }
.kflix-inject-btn.info { background: rgba(255,255,255,0.12); }
.kflix-inject-btn.info:hover { background: rgba(255,255,255,0.22); }
.kflix-inject-btn.circle {
    width: 30px; height: 30px; padding: 0;
    border-radius: 50%;
    background: rgba(255,255,255,0.15);
    border: 1px solid rgba(255,255,255,0.35);
    font-size: 0.8rem;
}
.kflix-inject-btn.circle:hover { background: rgba(255,255,255,0.28); }

/* ============================================================
   6. PAGES CATALOGUES (films, séries, recherche, ma-liste…)

/* ============================================================
   6. PAGES CATALOGUES (films, séries, recherche, ma-liste…)
   ============================================================ */
.film-details, main.film-details { background: var(--pv-bg) !important; }
.page-header, .catalog-header { background: transparent !important; border: none !important; }
.page-header h1 { color: var(--pv-text) !important; }

/* Pagination sombre */
.pagination-pv { display: flex; justify-content: center; gap: 6px; padding: 2rem 3%; flex-wrap: wrap; }
.pagination-pv a, .pagination-pv span {
    min-width: 36px; height: 36px;
    display: inline-flex; align-items: center; justify-content: center;
    background: var(--pv-surface);
    color: var(--pv-text);
    border-radius: 4px;
    text-decoration: none;
    font-size: 14px;
    border: 1px solid var(--pv-border);
}
.pagination-pv a:hover { background: var(--pv-surface-2); }
.pagination-pv .active { background: var(--pv-accent); border-color: var(--pv-accent); font-weight: 700; }

/* Empty state */
.empty-pv { text-align: center; padding: 4rem 3%; color: var(--pv-muted); }
.empty-pv i { font-size: 3rem; opacity: 0.3; margin-bottom: 1rem; }

/* ============================================================
   7. FOOTER sombre
   ============================================================ */
footer {
    background: var(--pv-bg) !important;
    border-top: 1px solid var(--pv-border) !important;
    padding: 2rem 3%;
    margin-top: 2rem;
}
.footer-content { color: var(--pv-muted); text-align: center; font-size: 0.82rem; }

/* ============================================================
   8. BANNIÈRES / ALERTES sombres
   ============================================================ */
.alert-kflix-success { background: rgba(76,175,80,0.15); border: 1px solid rgba(76,175,80,0.4); color: #81C995; }
.alert-danger, .alert-kflix-danger { background: rgba(229,9,20,0.12); border: 1px solid rgba(229,9,20,0.4); color: #FF6B73; }
.alert-warning { background: rgba(212,160,23,0.12); border: 1px solid rgba(212,160,23,0.4); color: #E5C07B; }
.alert-info { background: rgba(33,150,243,0.12); border: 1px solid rgba(33,150,243,0.4); color: #64B5F6; }

/* ============================================================
   9. RESPONSIVE
   ============================================================ */
@media (max-width: 900px) {
    .pv-card:hover { transform: none; }          /* pas d'agrandissement tactile */
    .pv-card-detail { display: none !important; } /* pas de panneau détail mobile */
    .kflix-row-title { padding: 0 4% !important; font-size: 1.1rem !important; }
    .search-input { width: 120px !important; }
    .search-input:focus { width: 180px !important; }
}

/* Réduire les animations si préféré par l'utilisateur */
@media (prefers-reduced-motion: reduce) {
    .pv-card, .pv-card-media img, .pv-card-detail { transition: none !important; }
}