/* 1. VARIABLES GLOBALES 
   J'utilise des variables pour la cohérence de mes couleurs et espacements.
   
*/
:root {
    --bg-base: #04041a;
    --bg-card: #111115;
    --accent: #7c3aed;
    --accent-hover: #6d28d9;
    --movie-accent: #002d30;
    /* Utilisé pour les détails */
    --text-primary: #ffffff;
    --text-secondary: #9ca3af;
    --border-subtle: rgba(255, 255, 255, 0.06);
}

/* 2. ACCESSIBILITÉ DE BASE (Opquast)  */
* {
    /* Le box-sizing permet d'inclure les bordures et paddings dans la largeur finale  */
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    /* Je définis une police de secours (sans-serif) à la fin si jamais il y a un problème de chargement */
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--bg-base);
    color: var(--text-primary);
    overflow-x: hidden;
}

/* ACCESSIBILITÉ : NAVIGATION AU CLAVIER (Tabulable)
    Si un utilisateur navigue avec la touche TAB, il doit voir 
   exactement où il se trouve. J'utilise donc :focus-visible pour ne pas gêner les clics souris.
*/
:focus-visible {
    outline: 0.1875rem dashed var(--accent);
    outline-offset: 0.25rem;
}

/* Règle Opquast : Le soulignement est réservé aux liens. Je l'ajoute au survol. */
a {
    text-decoration: none;
    color: inherit;
    transition: color 0.2s ease;
}

a:hover {
    text-decoration: underline;
    text-underline-offset: 0.25rem;
}

/* 3. EN-TÊTE ET NAVIGATION (header.php)*/
.main-header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 1000;
    /* J'utilise Flexbox en colonne pour le Mobile First, que j'adapterai ensuite sur grand écran */
    display: flex;
    flex-direction: column;
    gap: 1rem;
    padding: 1rem 5%;
    background-color: rgba(6, 6, 8, 0.85);
    backdrop-filter: blur(15px);
    border-bottom: 1px solid var(--border-subtle);
}

.header-left {
    display: flex;
    align-items: center;
    gap: 2.5rem;
}

.logo {
    font-size: 1.35rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: -0.01875rem;
    
    /* Ton dégradé */
    background: linear-gradient(45deg, #ffffff, var(--text-secondary));
    
    /* Les 3 lignes magiques pour appliquer le dégradé au texte */

    background-clip: text;
    color: transparent;
}

.navigation ul {
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 1.5rem;
}

.navigation a {
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 600;
}

.navigation a:hover,
.navigation a.active {
    color: var(--text-primary);
    text-shadow: 0 0 0.5rem rgba(255, 255, 255, 0.3);
}

.search-bar-container {
    display: flex;
    align-items: center;
    background-color: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-subtle);
    border-radius: 1.25rem;
    padding: 0.4375rem 1rem;
    transition: border-color 0.2s ease, background-color 0.2s ease;
}

.search-bar-container:focus-within {
    border-color: rgba(255, 255, 255, 0.25);
    background-color: rgba(255, 255, 255, 0.08);
}

.search-bar-container input {
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 0.85rem;
    outline: none;
    width: 12rem;
}

.search-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 0.85rem;
    color: var(--text-primary);
}

/* 4. PAGE D'ACCUEIL (index.php) */

/* --- Bannière Hero --- */
.hero-banner {
    height: 70vh;
    background-size: cover;
    background-position: center top;
    background-repeat: no-repeat;
    position: relative;
    display: flex;
    align-items: center;
    /* CORRECTION ICI : Padding réduit pour remonter le contenu */
    padding: 6rem 6% 0 6%;
    border-bottom: 1px solid var(--border-subtle);
}

.hero-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 101%;
    background:
        linear-gradient(to right, var(--bg-base) 10%, rgba(6, 6, 8, 0.7) 45%, transparent 100%),
        linear-gradient(to bottom, transparent 50%, var(--bg-base) 95%, var(--bg-base) 100%);
    z-index: 1;
}

.hero-content {
    max-width: 42.5rem;
    position: relative;
    z-index: 2;
    /* CORRECTION ICI : Margin retiré pour éviter l'écrasement vers le bas */
    margin-top: 0;
}

.badge-tag {
    display: inline-block;
    background-color: rgba(0, 240, 255, 0.1);
    border: 1px solid #009da8;
    color: #00f0ff;
    padding: 0.25rem 0.625rem;
    border-radius: 0.25rem;
    font-size: 0.75rem;
    font-weight: 700;
    margin-bottom: 1rem;
}

.hero-title {
    font-size: 2.5rem;
    font-weight: 900;
    line-height: 1.05;
    margin-bottom: 0;
    letter-spacing: -0.0625rem;
    text-transform: uppercase;
    text-shadow: 0 0.25rem 1.5rem rgba(0, 0, 0, 0.9);
}

.hero-meta {
    font-size: 0.95rem;
    color: #e2e8f0;
    margin-bottom: 1.125rem;
    font-weight: 600;
    letter-spacing: 0.0625rem;
}

.hero-synopsis {
    font-size: 0.98rem;
    color: #cbd5e1;
    line-height: 1.6;
    margin-bottom: 1.5rem;
    text-shadow: 0 0.125rem 0.625rem rgba(0, 0, 0, 0.8);
}

.hero-buttons {
    margin-top: 0.625rem;
}

.btn-primary {
    display: inline-flex;
    align-items: center;
    background-color: var(--accent);
    color: #ffffff;
    padding: 0.875rem 2.1875rem;
    font-weight: 800;
    border-radius: 3.125rem;
    font-size: 1rem;
    text-transform: uppercase;
    letter-spacing: 0.0625rem;
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 0 1.25rem rgba(124, 58, 237, 0.5);
    text-decoration: none !important;
}

/* --- Bloc Concept --- */
.concept-container {
    padding: 0 5%;
    margin-top: -1.25rem;
    margin-bottom: 2.5rem;
    position: relative;
    z-index: 10;
}

.concept-card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-subtle);
    padding: 1.5625rem;
    border-radius: 0.625rem;
}

.concept-card h3 {
    font-size: 1.2rem;
    margin-bottom: 0.5rem;
}

.concept-card p {
    font-size: 0.95rem;
    color: var(--text-secondary);
}

/* --- Barre de filtres collante (Sticky) --- */
.sticky-filter-bar {
    position: sticky;
    top: 0;
    z-index: 900;
    background-color: rgba(6, 6, 8, 0.95);
    backdrop-filter: blur(10px);
    display: flex;
    flex-direction: column;
    gap: 1rem;
    padding: 1rem 5%;
    margin: 0 -5% 1.25rem -5%;
    border-bottom: 1px solid var(--border-subtle);
}

.sticky-filter-bar select {
    background-color: var(--bg-card);
    color: var(--text-primary);
    border: 1px solid var(--border-subtle);
    padding: 0.625rem;
    border-radius: 0.5rem;
    width: 100%;
}

/* --- Grille des films (CSS Grid) --- */
.content-row {
    padding: 0 5% 3.75rem 5%;
}

.row-title {
    font-size: 1.35rem;
    font-weight: 700;
    margin-bottom: 1.25rem;
}

/* MOBILE FIRST : Grille à 1 colonne par défaut */
.streaming-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
}

.movie-card {
    background-color: var(--bg-card);
    border-radius: 0.625rem;
    overflow: hidden;
    border: 1px solid var(--border-subtle);
    position: relative;
}

.card-link {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.poster-wrapper {
    position: relative;
    aspect-ratio: 2 / 3;
    width: 100%;
    overflow: hidden;
    background-color: #16161c;
}

.movie-poster {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.movie-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(10, 10, 12, 0.6);
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
}

.view-icon {
    font-size: 1.5rem;
    color: var(--text-primary);
    background-color: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    width: 3.125rem;
    height: 3.125rem;
    display: flex;
    justify-content: center;
    align-items: center;
    border-radius: 50%;
    backdrop-filter: blur(5px);
}

.movie-info-block {
    padding: 1rem;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.movie-info-block h4 {
    font-size: 0.98rem;
    font-weight: 600;
    margin-bottom: 0.3125rem;
    color: var(--text-primary);
}

.movie-card-year {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.message-vide {
    grid-column: 1 / -1;
    text-align: center;
    color: var(--text-secondary);
    padding: 1.25rem;
}

/* 5. PAGE DÉTAILS*/
.page-detail-global-wrapper {
    width: 100%;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
    background-color: #060608;
    padding-top: 5rem;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
}

.page-detail-global-wrapper::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: inherit;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    filter: blur(2.5rem) brightness(0.3);
    transform: scale(1.1);
    z-index: 1;
}

.hero-immersive-container {
    width: 90%;
    max-width: 78.125rem;
    min-height: 34.375rem;
    border-radius: 1.25rem;
    display: flex;
    position: relative;
    overflow: hidden;
    z-index: 2;
    box-shadow: 0 1.5625rem 3.75rem rgba(0, 0, 0, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.08);
    flex-direction: column;
    justify-content: flex-end;
    height: auto;
    padding: 2.5rem 1.25rem;
    background: linear-gradient(to top, #060608 60%, rgba(6, 6, 8, 0.2) 100%);
}

.hero-content-block {
    z-index: 3;
    position: relative;
    max-width: 100%;
    text-align: center;
}

.hero-immersive-container .hero-title {
    font-size: 2.5rem;
    font-weight: 900;
    line-height: 1.1;
    margin-bottom: 1rem;
    text-transform: uppercase;
    color: var(--movie-accent);
    text-shadow: 0 0.25rem 1rem rgba(0, 0, 0, 0.9);
}

.hero-immersive-container .hero-meta {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 0.625rem;
    margin-bottom: 1.5rem;
}

.meta-item {
    color: var(--text-primary);
    font-size: 0.9rem;
    background-color: rgba(6, 6, 8, 0.6);
    padding: 0.25rem 0.75rem;
    border-radius: 0.375rem;
    border: 1px solid var(--movie-accent);
}

.hero-synopsis h3 {
    font-size: 1rem;
    text-transform: uppercase;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
    letter-spacing: 0.0625rem;
}

.hero-synopsis p {
    font-size: 1rem;
    line-height: 1.6;
    color: #ffffff;
}

.btn-back {
    margin-top: 1.875rem;
    display: inline-flex;
    background-color: rgba(6, 6, 8, 0.5);
    color: #ffffff;
    padding: 0.625rem 1.5rem;
    border-radius: 1.875rem;
    font-weight: 600;
    border: 1px solid var(--movie-accent);
    backdrop-filter: blur(8px);
}

.hero-perso-wrapper {
    position: absolute;
    z-index: 1;
    width: 100%;
    height: 50%;
    top: 0;
    left: 0;
}

.hero-perso-wrapper::after {
    content: "";
    position: absolute;
    width: 100%;
    height: 30%;
    top: auto;
    bottom: 0;
    left: 0;
    background: linear-gradient(to top, #060608 0%, transparent 100%);
    pointer-events: none;
}

.hero-perso-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center top;
}

/* --- Équipe et Casting --- */
.hero-crew {
    margin-top: 1.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding-top: 1.25rem;
}

.director-info {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.director-photo {
    width: 5rem;
    height: 5rem;
    border-radius: 50%;
    object-fit: cover;
    border: 0.1875rem solid var(--movie-accent);
}

.crew-label {
    display: block;
    color: #a0a0a0;
    text-transform: uppercase;
    font-size: 0.85rem;
    letter-spacing: 0.0625rem;
}

.crew-name {
    color: #ffffff;
    font-size: 1.3rem;
}

.cast-section {
    margin-top: 2.5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding-top: 1.5rem;
}

.cast-title {
    font-size: 1.1rem;
    color: #ffffff;
    text-transform: uppercase;
    letter-spacing: 0.0625rem;
    margin-bottom: 1.25rem;
    text-align: center;
}

.cast-grid {
    display: flex;
    gap: 1.5rem;
    overflow-x: auto;
    padding-bottom: 0.625rem;
}

.cast-grid {
    scrollbar-width: thin; 
    scrollbar-color: #888888 transparent; 
}

.cast-card {
    text-align: center;
    min-width: 5.625rem;
}

.cast-photo {
    width: 5rem;
    height: 5rem;
    border-radius: 50%;
    object-fit: cover;
    border: 0.125rem solid rgba(255, 255, 255, 0.2);
    margin-bottom: 0.75rem;
}

.cast-firstname {
    display: block;
    color: #ffffff;
    font-size: 0.95rem;
    margin-bottom: 0.125rem;
}

.cast-lastname {
    display: block;
    color: #a0a0a0;
    font-size: 0.85rem;
}

/* 6. MENTIONS LÉGALES ET FOOTER */
.legal-container {
    padding: 7.5rem 5% 3.75rem 5%;
    max-width: 62.5rem;
    margin: 0 auto;
}

.legal-card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: 0.75rem;
    padding: 2.5rem;
}

.legal-title {
    font-size: 2.2rem;
    font-weight: 800;
    margin-bottom: 1.875rem;
    color: var(--text-primary);
    text-align: center;
    text-transform: uppercase;
    letter-spacing: 0.0625rem;
}

.legal-intro {
    color: var(--text-secondary);
    line-height: 1.6;
    text-align: center;
    margin-bottom: 1.25rem;
}

.legal-section-title {
    font-size: 1.3rem;
    color: var(--accent);
    margin: 2.1875rem 0 1rem 0;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.legal-movie-title {
    font-size: 1.1rem;
    color: var(--text-primary);
    margin: 1.25rem 0 0.625rem 0;
    font-weight: 700;
}

.legal-list {
    list-style-type: none;
    padding-left: 0;
}

.legal-list li {
    margin-bottom: 0.5rem;
    color: var(--text-secondary);
    font-size: 0.95rem;
    display: flex;
    align-items: center;
}

.legal-list li::before {
    content: "•";
    color: var(--accent);
    font-weight: bold;
    margin-right: 0.625rem;
}

.legal-link {
    color: var(--text-secondary);
    text-decoration: underline;
    text-decoration-color: rgba(255, 255, 255, 0.2);
    word-break: break-all;
}

footer {
    background-color: #040406;
    border-top: 1px solid var(--border-subtle);
    padding: 1.5625rem;
    text-align: center;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

footer a {
    text-decoration: underline;
}

/* 7. MODALE VIDÉO*/
.trailer-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    background-color: rgba(0, 0, 0, 0.9);
    z-index: 10000;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(8px);
}

.trailer-content {
    position: relative;
    width: 90%;
    max-width: 62.5rem;
    aspect-ratio: 16 / 9;
    background: #000;
    border-radius: 0.75rem;
    box-shadow: 0 0 2.5rem rgba(0, 240, 255, 0.15);
}

.trailer-content iframe {
    width: 100%;
    height: 100%;
    border-radius: 0.75rem;
}

.close-modal {
    position: absolute;
    top: -2.8125rem;
    right: 0;
    color: #fff;
    font-size: 3rem;
    cursor: pointer;
    line-height: 1;
}

/*  8. MEDIA QUERIES (Grands écrans - Desktop)
   Utilisation de la valeur 'em' pour une adaptation optimale la valeur standard d'un em est de 16 pixels. Si on fait le calcul, on obtient : 48 x 16 = 768 pixels*/
@media (min-width: 48em) {

    /* Header repasse en ligne */
    .main-header {
        flex-direction: row;
        padding: 1.25rem 5%;
    }

    /* La bannière hero redevient grande */
    .hero-banner {
        height: 85vh;
    }

    .hero-title {
        font-size: 4.2rem;
    }

    /* La barre de filtre passe en ligne */
    .sticky-filter-bar {
        flex-direction: row;
        top: 4.5625rem;
    }

    /* Grille à 3 colonnes pour tablettes */
    .streaming-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    /* Page détails : L'image repasse à droite et le texte à gauche */
    .hero-immersive-container {
        flex-direction: row;
        align-items: center;
        justify-content: flex-start;
        height: 75vh;
        padding: 0 5%;
        background: linear-gradient(90deg, #060608 45%, rgba(6, 6, 8, 0.7) 65%, rgba(6, 6, 8, 0.1) 100%);
    }

    .hero-content-block {
        max-width: 31.25rem;
        text-align: left;
    }

    .hero-immersive-container .hero-title {
        font-size: 4rem;
    }

    .hero-immersive-container .hero-meta {
        justify-content: flex-start;
    }

    .hero-perso-wrapper {
        width: 55%;
        height: 100%;
        top: 0;
        right: 0;
        left: auto;
    }

    .hero-perso-wrapper::after {
        width: 30%;
        height: 100%;
        top: 0;
        left: 0;
        bottom: auto;
        background: linear-gradient(90deg, #060608 0%, transparent 100%);
    }

    .hero-crew {
        flex-direction: row;
    }

    .cast-title {
        text-align: left;
    }
}

@media (min-width: 68.75em) {

    /* Grille à 5 colonnes pour Desktop */
    .streaming-grid {
        grid-template-columns: repeat(5, 1fr);
    }
}

/*  9. ANIMATIONS ET SANTÉ DE L'UTILISATEUR ( adapté avec prefers-reduced-motion)*/
#loader-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #0a0a0c;
    z-index: 9999;
    display: none;
    justify-content: center;
    align-items: center;
}

/* Je désactive les animations complexes si l'utilisateur a activé
   l'option pour réduire les mouvements sur son ordinateur. */
@media (prefers-reduced-motion: no-preference) {

    .btn-primary {
        transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    }

    .btn-primary:hover {
        background-color: var(--accent-hover);
        transform: translateY(-0.25rem) scale(1.03);
        box-shadow: 0 0.625rem 2.5rem rgba(124, 58, 237, 0.8), 0 0 1.25rem rgba(0, 240, 255, 0.5);
        border-color: rgba(255, 255, 255, 0.5);
    }

    .movie-card {
        transition: transform 0.3s ease, box-shadow 0.3s ease;
    }

    .movie-card:hover {
        transform: translateY(-0.3125rem);
        box-shadow: 0 0.625rem 1.5625rem rgba(0, 0, 0, 0.5);
    }

    .movie-poster {
        transition: transform 0.3s ease;
    }

    .movie-card:hover .movie-poster {
        transform: scale(1.03);
    }

    .movie-overlay {
        transition: opacity 0.2s ease;
    }

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

    .btn-back {
        transition: all 0.2s ease;
    }

    .btn-back:hover {
        background-color: var(--movie-accent);
        color: #060608;
        border-color: var(--movie-accent);
        box-shadow: 0 0 1.25rem var(--movie-accent);
    }

    .cast-photo {
        transition: transform 0.3s ease, border-color 0.3s ease;
    }

    .cast-card:hover .cast-photo {
        transform: scale(1.05);
        border-color: var(--movie-accent);
    }

    .close-modal {
        transition: color 0.3s ease;
    }

    .close-modal:hover {
        color: var(--accent);
    }

    .legal-link {
        transition: color 0.2s ease;
    }

    .legal-link:hover {
        color: #ffffff;
        text-decoration-color: var(--accent);
    }

    #loader-logo {
        width: 18.75rem;
        border-radius: 0.9375rem;
        animation: loaderEffect 5s ease-in-out forwards;
    }

    @keyframes loaderEffect {
        0% {
            opacity: 0;
            transform: scale(0.9);
        }

        15% {
            opacity: 1;
            transform: scale(1);
        }

        85% {
            opacity: 1;
            transform: scale(1.05);
        }

        100% {
            opacity: 0;
            transform: scale(1.1);
        }
    }

    /* -- 10. ACCESSIBILITÉ : Navigation au clavier --- */

    .movie-card a:focus {
        outline: none;
    }

    .movie-card:focus-within {
        outline: 3px solid var(--accent, #e50914);
        outline-offset: 4px;
        border-radius: 10px;

        /* On enlève toute les animations existantes pour le clavier */
        transition: none !important;
        transform: none !important;
        box-shadow: none !important;
    }
}