/* ================================================================
   KINOO — MOBILE (≤ 760px)
   Refonte mobile ciblée, basée sur l'observation réelle du site
   sur Galaxy S20 / iPhone 12 / Pixel (375-412px).
   Placé APRÈS style.css pour gagner sur les règles existantes.
   ================================================================ */

@media (max-width: 760px) {

    /* -----------------------------------------------------------
       1. GLOBAL — nettoyage de base
       ----------------------------------------------------------- */
    html, body { overflow-x: hidden; max-width: 100vw; }
    * { box-sizing: border-box; }
    img, video, iframe, svg { max-width: 100%; height: auto; }

    .main-wrap {
        padding: 0 12px !important;
        margin: 10px auto !important;
    }

    /* -----------------------------------------------------------
       2. EN-TÊTE — compact
       ----------------------------------------------------------- */
    header {
        padding: 8px 12px !important;
        gap: 6px !important;
        min-height: 56px !important;
    }
    .site-logo-text { font-size: 1.3rem !important; letter-spacing: 0.5px !important; }

    .nav-toggle {
        width: 38px !important;
        height: 38px !important;
        font-size: 1.2rem !important;
    }
    .compte-btn { padding: 4px 8px !important; }
    .compte-btn #compteLabel { display: none !important; }

    /* -----------------------------------------------------------
       3. MENU BURGER OUVERT — compact, pas aéré à outrance
       ----------------------------------------------------------- */
    header nav.nav-open {
        flex-direction: column !important;
        gap: 0 !important;
        padding: 6px 0 2px !important;
        margin-top: 4px !important;
    }
    header nav > a,
    header nav > .nav-explorer > button {
        min-height: 42px !important;          /* 60px → 42px */
        padding: 0 10px !important;
        gap: 10px !important;
        font-size: 0.9rem !important;
        border-radius: 8px !important;
    }
    header nav > a svg,
    header nav > .nav-explorer > button svg {
        width: 18px !important;
        height: 18px !important;
    }

    /* Le panneau "Explorer" déployé : compact lui aussi */
    .nav-explorer-menu {
        padding: 10px !important;
        gap: 2px !important;
    }
    .mega-item {
        padding: 8px !important;
        gap: 8px !important;
    }
    .mega-texte strong { font-size: 0.82rem !important; }
    .mega-texte em { display: none !important; }    /* on cache les sous-titres */

    /* -----------------------------------------------------------
       4. BANNIÈRE — compacte mais lisible
       ----------------------------------------------------------- */
    .hero-banner {
        height: 300px !important;
        min-height: 260px !important;
        max-height: 320px !important;
        aspect-ratio: auto !important;
        border-radius: 14px !important;
        margin-bottom: 18px !important;
    }
    .hero-banner-content {
        padding: 14px 16px 52px !important;
        gap: 8px !important;
        justify-content: flex-end !important;
        max-width: 100% !important;
    }
    .hero-badges { gap: 5px !important; margin: 0 !important; }
    .hero-badge {
        padding: 4px 8px !important;
        font-size: 0.68rem !important;
        letter-spacing: 0.3px !important;
    }
    .hero-banner-content h1 {
        font-size: 1.4rem !important;
        letter-spacing: 0.02em !important;
        line-height: 1.1 !important;
        margin: 0 !important;
    }
    .hero-banner-content p,
    #heroDesc {
        font-size: 0.76rem !important;
        line-height: 1.4 !important;
        -webkit-line-clamp: 2 !important;
        margin: 0 !important;
    }
    .hero-actions {
        gap: 8px !important;
        margin-top: 6px !important;
        width: 100% !important;
    }
    .hero-actions .btn-hero-watch,
    .hero-actions .btn-hero-info {
        flex: 1 1 0 !important;
        min-width: 0 !important;
        height: 40px !important;
        padding: 0 10px !important;
        font-size: 0.76rem !important;
        justify-content: center !important;
    }
    .hero-actions svg { width: 14px !important; height: 14px !important; }

    /* Pastilles : centrées proprement, plus discrètes */
    .hero-banner-dots {
        left: 50% !important;
        bottom: 10px !important;
        transform: translateX(-50%) !important;
        padding: 5px 10px !important;
        gap: 4px !important;
        background: rgba(10, 10, 14, 0.55) !important;
    }
    .hero-dot { width: 6px !important; height: 6px !important; }
    .hero-dot.active { width: 18px !important; }
    .hero-fleches { display: none !important; }

    /* -----------------------------------------------------------
       5. SIDEBAR (bande catégories) — plus discrète
       ----------------------------------------------------------- */
    .sidebar {
        padding: 8px 10px !important;
        margin-bottom: 10px !important;
        border-radius: 10px !important;
    }
    .sidebar h3,
    .sidebar .sidebar-titre-stats { display: none !important; }
    .sidebar-stats {
        font-size: 0.7rem !important;
        padding: 0 !important;
        margin-top: 6px !important;
        flex-direction: row !important;
        gap: 12px !important;
    }
    #categoriesList {
        gap: 6px !important;
        padding: 0 0 2px 0 !important;
    }
    #categoriesList li {
        padding: 6px 12px !important;
        font-size: 0.7rem !important;
    }

    /* -----------------------------------------------------------
       6. TITRES DE SECTION — plus compacts
       ----------------------------------------------------------- */
    .section-title {
        margin: 16px 0 10px !important;
    }
    .section-title h2 {
        font-size: 0.9rem !important;
        letter-spacing: 0.6px !important;
        padding-bottom: 6px !important;
    }
    .section-title h2::after {
        width: 22px !important;
        height: 2px !important;
    }
    .section-title a { font-size: 0.66rem !important; }

    /* -----------------------------------------------------------
       7. GRILLES — 2 colonnes régulières
       ----------------------------------------------------------- */
    .grid {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
        gap: 12px 10px !important;
    }
    .card .info h4 { font-size: 0.75rem !important; }
    .card .info .cat { font-size: 0.7rem !important; }

    /* Tuiles catégories : hauteur réduite */
    .category-tiles {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
        gap: 8px !important;
        margin-bottom: 16px !important;
    }
    .category-tile { height: 88px !important; border-radius: 10px !important; }
    .category-tile-body { padding: 8px 10px !important; }
    .category-tile-body h4 { font-size: 0.82rem !important; }
    .category-tile-body span { font-size: 0.7rem !important; }

    /* -----------------------------------------------------------
       8. FICHE FILM/SÉRIE — bandeau compact
       ----------------------------------------------------------- */
    .fiche-hero {
        min-height: 280px !important;
        padding: 0 0 16px !important;
        margin: -8px 0 0 !important;
    }
    .fiche-hero-contenu {
        padding: 0 12px !important;
        gap: 10px !important;
    }
    .fiche-affiche {
        flex: 0 0 80px !important;
        width: 80px !important;
    }
    .fiche-texte h1 {
        font-size: 1.25rem !important;
        letter-spacing: -0.3px !important;
        margin-bottom: 6px !important;
    }
    .fiche-meta {
        gap: 5px 8px !important;
        font-size: 0.7rem !important;
        margin-bottom: 8px !important;
    }
    .fiche-pastille { padding: 3px 8px !important; font-size: 0.7rem !important; }
    .fiche-resume {
        font-size: 0.74rem !important;
        -webkit-line-clamp: 3 !important;
        margin-bottom: 12px !important;
        line-height: 1.45 !important;
    }
    .fiche-actions {
        flex-wrap: wrap !important;
        gap: 6px !important;
        width: 100% !important;
    }
    .fiche-btn-lecture {
        flex: 1 1 100% !important;
        height: 42px !important;
        font-size: 0.82rem !important;
        justify-content: center !important;
    }
    .fiche-btn-second,
    .fiche-actions .btn-vote,
    .fiche-actions .btn-list {
        height: 40px !important;
        padding: 0 14px !important;
        font-size: 0.74rem !important;
    }
    .fiche-actions .btn-vote { width: 40px !important; }

    /* -----------------------------------------------------------
       9. ÉPISODES — plus compacts
       ----------------------------------------------------------- */
    .episode {
        flex-wrap: wrap !important;
        gap: 8px !important;
        padding: 10px 8px !important;
    }
    .episode-vignette {
        flex: 0 0 100% !important;
        aspect-ratio: 16 / 9 !important;
    }
    .episode-corps { flex: 1 1 100% !important; }
    .episode-ligne h4 { font-size: 0.8rem !important; white-space: normal !important; }
    .episode-resume { font-size: 0.7rem !important; -webkit-line-clamp: 3 !important; }
    .episode-bouton-vu { display: none !important; }

    /* -----------------------------------------------------------
       10. LECTEUR VIDÉO — contrôles accessibles et alignés
       ----------------------------------------------------------- */
    .lecteur-barres {
        padding: 22px 8px 6px !important;
    }
    .lecteur-zone { inset: 0 0 60px 0 !important; }

    .lecteur-commandes {
        display: flex !important;
        flex-wrap: nowrap !important;
        align-items: center !important;
        gap: 4px !important;
        margin-top: 4px !important;
        overflow-x: auto !important;
        scrollbar-width: none !important;
    }
    .lecteur-commandes::-webkit-scrollbar { display: none !important; }

    .lecteur-btn {
        width: 36px !important;
        height: 36px !important;
        flex-shrink: 0 !important;
    }
    .lecteur-btn svg { width: 19px !important; height: 19px !important; }
    .lecteur-saut { display: none !important; }
    .lecteur-temps { font-size: 0.7rem !important; margin-left: 2px !important; }
    .lecteur-vitesse { height: 32px !important; min-width: 52px !important; font-size: 0.68rem !important; }
    .lecteur-volume .lecteur-glissiere { display: none !important; }
    .lecteur-espace { display: none !important; }

    /* Navigation épisodes en haut du lecteur : plus discrète.
       `bottom: auto` est INDISPENSABLE : la règle de base pose `bottom: 4px`,
       et un élément fixed qui a à la fois top et bottom s'étire entre les
       deux. Sans cette ligne la barre occupait toute la hauteur de l'écran. */
    .player-nav {
        top: 8px !important;
        bottom: auto !important;
        right: 70px !important;
        left: 12px !important;
        height: auto !important;
        padding: 4px !important;
        gap: 4px !important;
        /* La barre reste sur une seule ligne : enroulée, elle repousserait le
           bouton du milieu sous les deux autres. */
        flex-wrap: nowrap !important;
        align-items: center !important;
    }
    /* Les trois boutons se partagent la largeur, et le libellé du milieu est
       coupé plutôt que d'élargir la barre sous la croix de fermeture. */
    .player-nav-btn {
        flex: 1 1 0 !important;
        min-width: 0 !important;
        justify-content: center !important;
    }
    .player-nav-last { min-width: 0 !important; }
    .player-nav-last span {
        overflow: hidden !important;
        text-overflow: ellipsis !important;
        white-space: nowrap !important;
    }
    .player-nav-btn {
        height: 32px !important;
        padding: 0 10px !important;
        font-size: 0.7rem !important;
    }
    .player-nav-label { display: none !important; }

    /* -----------------------------------------------------------
       11. FOOTER — 2 colonnes compactes
       ----------------------------------------------------------- */
    .site-footer {
        padding: 22px 14px 14px !important;
        margin-top: 26px !important;
    }
    .footer-inner {
        flex-direction: row !important;
        flex-wrap: wrap !important;
        gap: 18px 12px !important;
    }
    .footer-col {
        flex: 1 1 calc(50% - 6px) !important;
        min-width: 0 !important;
        max-width: calc(50% - 6px) !important;
    }
    .footer-col.footer-brand {
        flex: 1 1 100% !important;
        max-width: 100% !important;
    }
    .footer-col h4 { font-size: 0.72rem !important; margin-bottom: 8px !important; }
    .footer-col a { font-size: 0.72rem !important; margin-bottom: 6px !important; }
    .footer-col p { font-size: 0.7rem !important; line-height: 1.5 !important; }
    .footer-bottom {
        flex-direction: column !important;
        gap: 6px !important;
        margin-top: 20px !important;
        font-size: 0.7rem !important;
        text-align: left !important;
    }

    /* -----------------------------------------------------------
       12. BULLE "Une idée ?" — discrète, ne chevauche rien
       ----------------------------------------------------------- */
    .assistant {
        bottom: 10px !important;
        left: 10px !important;
    }
    .assistant-bulle {
        padding: 7px 12px !important;
        font-size: 0.72rem !important;
        background: rgba(13, 13, 22, 0.9) !important;
        box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4) !important;
    }
    .assistant-bulle svg { width: 14px !important; height: 14px !important; }

    /* -----------------------------------------------------------
       13. AUTRES POP-UPS — ne pas chevaucher
       ----------------------------------------------------------- */
    .discord-bottom-popup,
    .recrutement-popup {
        left: 10px !important;
        right: 10px !important;
        width: auto !important;
        max-width: none !important;
    }
    .discord-bottom-popup { bottom: 80px !important; }
    .recrutement-popup { bottom: 10px !important; }

    /* -----------------------------------------------------------
       14. FORMULAIRES ET PAGES LÉGALES
       ----------------------------------------------------------- */
    .login-box { padding: 20px 16px !important; }
    .login-box h3 { font-size: 0.85rem !important; }

    .legal-content { padding: 20px 16px !important; }
    .legal-content h3 { font-size: 0.8rem !important; }
    .legal-content p,
    .legal-content ul { font-size: 0.72rem !important; }

    /* -----------------------------------------------------------
       15. MODALES (edit, confirm, ajout)
       ----------------------------------------------------------- */
    .edit-modal .modal-box,
    .confirm-modal .confirm-box {
        padding: 20px 16px !important;
        width: 94% !important;
        max-width: none !important;
    }
    .edit-modal .modal-box h2 { font-size: 0.9rem !important; }
}

/* Très petits écrans (≤ 375px) */
@media (max-width: 375px) {
    .hero-banner { height: 260px !important; min-height: 240px !important; }
    .hero-banner-content h1 { font-size: 1.25rem !important; }
    .hero-actions .btn-hero-watch,
    .hero-actions .btn-hero-info { font-size: 0.72rem !important; }
    .grid { gap: 10px 8px !important; }
    .card .info h4 { font-size: 0.72rem !important; }
    .footer-col { flex: 1 1 100% !important; max-width: 100% !important; }
}

/* Réduction des animations si l'utilisateur le demande */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.001ms !important;
        transition-duration: 0.001ms !important;
    }
}

/* ================================================================
   BANNIÈRE — TRANSITION ADOUCIE
   Effet Ken Burns (zoom très léger) sur l'image visible + fondu
   plus long. Le changement de diapositive ne saute plus, il glisse.
   ================================================================ */
.hero-banner-image {
    transition: opacity 1.4s ease-in-out !important;
}
.hero-banner-image.hero-image-visible {
    animation: kenburns 12s ease-out forwards;
}
@keyframes kenburns {
    from { transform: scale(1.0); }
    to   { transform: scale(1.04); }
}
@media (prefers-reduced-motion: reduce) {
    .hero-banner-image.hero-image-visible { animation: none; }
}

/* ================================================================
   BANNIÈRE — FONDU SUR LE TEXTE
   Le titre, les badges et le résumé apparaissent en fondu quand
   l'image change, au lieu de se remplacer d'un coup.
   ================================================================ */
.hero-banner-content h1,
.hero-banner-content p,
.hero-banner-content .hero-badges,
.hero-banner-content .hero-actions {
    transition: opacity 0.6s ease !important;
}

/* État "en transition" : le contenu est invisible */
.hero-banner-content.en-transition h1,
.hero-banner-content.en-transition p,
.hero-banner-content.en-transition .hero-badges,
.hero-banner-content.en-transition .hero-actions {
    opacity: 0 !important;
}

/* ================================================================
   BOUTONS D'ACTION SOUS LES CARTES — compacts sur mobile
   Les 4 ronds (play, favori, modifier, supprimer) étaient à 34px
   avec un gap de 6px. Sur 132px de carte, ça fait serré.
   On descend à 30px et gap 5px pour que tout tienne sur une ligne.
   ================================================================ */
@media (max-width: 760px) {
    .card .info .actions {
        gap: 5px !important;
        margin-top: 6px !important;
    }
    .card .info .actions button {
        width: 30px !important;
        height: 30px !important;
    }
    .card .info .actions button svg {
        width: 14px !important;
        height: 14px !important;
    }

    /* Boutons de la fenêtre d'ajout : plus compacts */
    .ajout-btn-principal,
    .ajout-btn-secondaire {
        height: 36px !important;
        padding: 0 14px !important;
        font-size: 0.74rem !important;
    }

    /* Boutons dans les modales (éditer, confirmer) */
    .edit-modal .modal-box .modal-actions button,
    .confirm-modal .confirm-actions button {
        height: 38px !important;
        padding: 0 16px !important;
        font-size: 0.7rem !important;
    }

    /* Boutons du formulaire de connexion : déjà ok, mais on uniformise */
    .login-box button {
        height: 44px !important;
        font-size: 0.8rem !important;
    }

    /* Boutons "Demander" / "Chercher" sur la page Demandes */
    .demande-btn-primary,
    .demande-btn-secondary {
        height: 40px !important;
        padding: 0 16px !important;
        font-size: 0.72rem !important;
    }
}
