/* =========================================================================
   ANIMFLIX - 10-FOOT UI & EXPÉRIENCE TÉLÉVISEUR (TV MODE, D-PAD & GAMEPAD)
   ========================================================================= */

/* --- BOUTON TOGGLE MODE TV DANS LA NAVBAR --- */
.btn-tv-nav {
    background: #1f1f1f;
    border: 1px solid #333;
    color: #aaa;
    padding: 7px 11px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 15px;
    transition: all 0.2s cubic-bezier(0.2, 0, 0, 1);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.btn-tv-nav:hover {
    background: #2a2a2a;
    color: #fff;
    border-color: #555;
    transform: scale(1.05);
}

.btn-tv-nav.active {
    background: rgba(229, 9, 20, 0.2);
    border-color: #e50914;
    color: #ff4d58;
    box-shadow: 0 0 10px rgba(229, 9, 20, 0.35);
}

/* --- INDICATEUR DE FOCUS HAUTE VISIBILITÉ (10-FOOT FOCUS RING) --- */
/* S'active quand l'utilisateur navigue au clavier, télécommande ou manette */
body.tv-focus-active :focus-visible,
body.tv-focus-active .tv-focused,
.tv-focused {
    outline: 3px solid #e50914 !important;
    outline-offset: 3px !important;
    box-shadow: 0 0 18px rgba(229, 9, 20, 0.85), 0 0 32px rgba(229, 9, 20, 0.4) !important;
    transition: transform 0.16s cubic-bezier(0.2, 0, 0, 1), box-shadow 0.16s ease !important;
}

/* Cartes d'animes et éléments de grille focusés */
body.tv-focus-active .card.tv-focused,
.card.tv-focused {
    transform: scale(1.06) translateY(-4px) !important;
    z-index: 25 !important;
    border-color: #e50914 !important;
}

body.tv-focus-active .card.tv-focused .card-overlay-hover,
.card.tv-focused .card-overlay-hover {
    opacity: 1 !important;
    visibility: visible !important;
}

/* Boutons et contrôles du lecteur multimédia focusés */
body.tv-focus-active .player-btn.tv-focused,
.player-btn.tv-focused {
    background: rgba(229, 9, 20, 0.35) !important;
    border-color: #e50914 !important;
    color: #ffffff !important;
    transform: scale(1.18) !important;
}

/* Onglets d'accueil focusés */
body.tv-focus-active .home-tab-btn.tv-focused,
.home-tab-btn.tv-focused {
    background: #e50914 !important;
    color: #fff !important;
    transform: scale(1.05) !important;
}

/* Éléments de liste de fichiers torrents focusés */
body.tv-focus-active .torrent-item.tv-focused,
body.tv-focus-active .file-row.tv-focused,
.torrent-item.tv-focused,
.file-row.tv-focused {
    background: rgba(229, 9, 20, 0.22) !important;
    border-color: #e50914 !important;
    transform: translateX(6px) !important;
}

/* Timeline scrubber focusée */
.player-scrubber-track.tv-focused {
    height: 14px !important;
    box-shadow: 0 0 14px rgba(229, 9, 20, 0.9) !important;
}

/* --- HUD FLOTTANT DE LA MANETTE / TÉLÉCOMMANDE (GAMEPAD CONTROLS HELPER) --- */
.tv-gamepad-hud {
    position: fixed;
    bottom: 24px;
    right: 28px;
    background: rgba(14, 14, 14, 0.92);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-left: 4px solid #e50914;
    padding: 10px 18px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    gap: 16px;
    font-size: 13px;
    color: #eee;
    z-index: 10000;
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.7);
    pointer-events: none;
    transition: opacity 0.35s ease, transform 0.35s ease;
    animation: tvHudFadeIn 0.35s ease-out;
}

.tv-gamepad-hud.hidden {
    opacity: 0;
    transform: translateY(15px);
}

.tv-hud-badge {
    background: #2a2a2a;
    border: 1px solid #444;
    padding: 2px 7px;
    border-radius: 5px;
    font-weight: 700;
    font-size: 11px;
    color: #ff4d58;
    margin-right: 4px;
}

@keyframes tvHudFadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* --- ADAPTATION GLOBALE "10-FOOT UI" (body.tv-mode) --- */
/* Pour canapé à 3 mètres de l'écran : textes agrandis, marges larges, contrôles renforcés */
body.tv-mode {
    font-size: 18px;
}

body.tv-mode .navbar {
    padding: 18px 50px;
    height: auto;
}

body.tv-mode .logo {
    font-size: 32px;
}

body.tv-mode .search-box input {
    font-size: 16px;
    padding: 12px 18px;
}

body.tv-mode .search-box select,
body.tv-mode .search-box button {
    font-size: 15px;
    padding: 12px 16px;
}

body.tv-mode .home-tabs-container {
    gap: 12px;
    margin-bottom: 24px;
}

body.tv-mode .home-tab-btn {
    font-size: 16px;
    padding: 12px 22px;
    border-radius: 8px;
}

body.tv-mode .grid {
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)) !important;
    gap: 26px !important;
}

body.tv-mode .card {
    border-radius: 10px;
}

body.tv-mode .card-title {
    font-size: 16px;
    margin-top: 8px;
}

body.tv-mode .card-subtitle {
    font-size: 13.5px;
}

/* Vue détail agrandie */
body.tv-mode .detail-title {
    font-size: 34px !important;
}

body.tv-mode .detail-badges-row {
    gap: 10px;
    margin: 12px 0;
}

body.tv-mode .detail-badge {
    font-size: 14px;
    padding: 6px 14px;
}

body.tv-mode .torrent-item {
    padding: 16px 20px;
    font-size: 16px;
    margin-bottom: 10px;
}

body.tv-mode .file-row {
    padding: 14px 18px;
    font-size: 15px;
}

/* Contrôles du lecteur en Mode TV */
body.tv-mode .player-bottom-bar {
    padding: 14px 30px;
}

body.tv-mode .player-btn {
    width: 48px;
    height: 48px;
    font-size: 18px;
}

body.tv-mode .player-btn-skip {
    font-size: 14px;
    padding: 0 16px;
}

body.tv-mode .player-time-label {
    font-size: 15px;
}

body.tv-mode .player-scrubber-container {
    height: 28px;
}

body.tv-mode .player-scrubber-track {
    height: 10px;
}

body.tv-mode .player-scrubber-track:hover,
body.tv-mode .player-scrubber-track.tv-focused {
    height: 14px;
}

body.tv-mode .player-scrubber-thumb {
    width: 18px;
    height: 18px;
}

/* Modales en Mode TV */
body.tv-mode .anilist-modal-content {
    max-width: 680px;
    padding: 28px;
    font-size: 16px;
}

body.tv-mode .settings-select {
    font-size: 15px;
    padding: 10px 14px;
}

/* Masquage automatique du curseur après inactivité sur TV */
body.tv-mode.cursor-hidden,
body.tv-mode.cursor-hidden * {
    cursor: none !important;
}

/* Scrollbars discrètes */
body.tv-mode::-webkit-scrollbar {
    width: 8px;
}
body.tv-mode::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.4);
}
body.tv-mode::-webkit-scrollbar-thumb {
    background: #333;
    border-radius: 4px;
}
