/* ==========================================================================
   TurboLoader - Cinema Player HUD, Subtitles & Smart TV D-Pad Focus Styles
   Path: /static/css/player.css
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. استایل فوکوس واضح و چشم‌نواز برای ریموت کنترل تلویزیون (D-Pad)
   -------------------------------------------------------------------------- */
[data-focusable]:focus-visible,
body.tv-mode [data-focusable]:focus,
body.tv-mode button:focus,
body.tv-mode a:focus,
body.tv-mode input:focus,
body.tv-mode select:focus,
.tv-focused {
    outline: 3px solid #38bdf8 !important;
    outline-offset: 3px;
    box-shadow:
        0 0 0 6px rgba(56, 189, 248, 0.24),
        0 14px 30px -8px rgba(14, 165, 233, 0.55) !important;
    position: relative;
    z-index: 15;
}

body.tv-mode [data-focusable]:focus,
body.tv-mode .minimal-tile:focus-within {
    transform: scale(1.02);
}

/* --------------------------------------------------------------------------
   2. لایه پخش‌کننده تمام‌صفحه سینمایی
   -------------------------------------------------------------------------- */
.cinema-player-overlay {
    position: fixed;
    inset: 0;
    z-index: 100;
    background: #000000;
    user-select: none;
    overflow: hidden;
}

.cinema-player-overlay.hidden {
    display: none;
}

.cinema-video-stage {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #000000;
}

.cinema-video-el {
    width: 100%;
    height: 100%;
    object-fit: contain;
    background: #000000;
}

/* نوار بالای HUD (با احتساب فضای امن برای TV در حالت غیر تمام‌صفحه واقعی) */
.player-top-bar {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    z-index: 30;
    padding: calc(0.85rem + var(--tv-safe-top) * 0.55) 1rem 1.4rem;
    background: linear-gradient(180deg, rgba(2, 6, 23, 0.94) 0%, rgba(2, 6, 23, 0.65) 65%, transparent 100%);
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    transition: opacity 260ms ease, transform 260ms ease;
}

.player-bottom-bar {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 30;
    padding: 2rem 1rem calc(0.9rem + env(safe-area-inset-bottom, 0px));
    background: linear-gradient(0deg, rgba(2, 6, 23, 0.96) 0%, rgba(2, 6, 23, 0.78) 65%, transparent 100%);
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    transition: opacity 260ms ease, transform 260ms ease;
}

@media (min-width: 768px) {
    .player-top-bar {
        padding-left: 1.5rem;
        padding-right: 1.5rem;
    }

    .player-bottom-bar {
        padding-left: 1.5rem;
        padding-right: 1.5rem;
    }
}

.player-hud-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    padding: 0.45rem 0.78rem;
    border-radius: 0.75rem;
    font-size: 0.75rem;
    font-weight: 700;
    background: rgba(15, 23, 42, 0.88);
    border: 1px solid rgba(148, 163, 184, 0.25);
    color: #e2e8f0;
    cursor: pointer;
    white-space: nowrap;
    transition: all var(--transition-fast);
}

.player-hud-btn:hover {
    background: rgba(30, 41, 59, 0.96);
    border-color: rgba(56, 189, 248, 0.55);
    color: #ffffff;
}

body.tv-mode .player-hud-btn {
    padding: 0.6rem 1rem;
    font-size: 0.88rem;
    min-height: 46px;
}

/* اسلایدر تایم‌لاین ویدیو */
input[type='range'].cinema-slider {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 7px;
    border-radius: 9999px;
    background: rgba(148, 163, 184, 0.32);
    cursor: pointer;
    transition: height 150ms ease;
}

input[type='range'].cinema-slider:hover,
input[type='range'].cinema-slider:focus {
    height: 10px;
}

input[type='range'].cinema-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #38bdf8;
    border: 2.5px solid #ffffff;
    box-shadow: 0 0 12px rgba(56, 189, 248, 0.9);
    cursor: pointer;
}

input[type='range'].cinema-slider::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #38bdf8;
    border: 2.5px solid #ffffff;
    box-shadow: 0 0 12px rgba(56, 189, 248, 0.9);
    cursor: pointer;
}

/* اعلان وسط صفحه (OSD) */
.player-center-osd {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 25;
    padding: 0.8rem 1.5rem;
    border-radius: 1rem;
    background: rgba(2, 6, 23, 0.86);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(56, 189, 248, 0.35);
    color: #ffffff;
    font-weight: 900;
    font-size: 1.05rem;
    box-shadow: 0 20px 45px rgba(0, 0, 0, 0.75);
    pointer-events: none;
}

/* زیرنویس فارسی پیشرفته */
#cinemaSubContainer {
    position: absolute;
    left: 0;
    right: 0;
    display: flex;
    justify-content: center;
    padding: 0 1rem;
    pointer-events: none;
    z-index: 22;
    transition: bottom 220ms ease;
}

#cinemaSubText {
    font-family: 'Vazirmatn', system-ui, sans-serif;
    font-weight: 700;
    line-height: 1.65;
    unicode-bidi: plaintext;
    text-align: center;
    word-wrap: break-word;
    white-space: pre-line;
    max-width: 92vw;
    padding: 0.35rem 1rem;
    border-radius: 0.75rem;
    transition: font-size 120ms ease, color 120ms ease, background-color 150ms ease;
}

.sub-shadow-only {
    background: transparent !important;
    text-shadow:
        0 2px 4px #000000,
        0 0 10px #000000,
        2px 2px 2px #000000,
        -2px -2px 2px #000000;
}

.sub-bg-semi {
    background: rgba(2, 6, 23, 0.78);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.9);
}

.sub-bg-solid {
    background: rgba(0, 0, 0, 0.94);
}

/* پاپ‌اور تنظیمات ظاهر و جستجوی زیرنویس */
.sub-settings-popover {
    position: absolute;
    bottom: 5.5rem;
    left: 1rem;
    z-index: 40;
    width: 21rem;
    max-width: calc(100vw - 2rem);
    padding: 1rem;
    border-radius: 1.25rem;
    border: 1px solid rgba(56, 189, 248, 0.38);
}