/**
 * CiMovie - Detail Screen, Search & Modals (LG webOS TV)
 * 10-Foot UI/UX Standards: 2:3 Poster Ratio, Safe Areas, High-Contrast Typography,
 * and Balanced Virtual Keyboard Layout.
 */

/* ==========================================================================
   Detail Screen Full View
   ========================================================================== */
#detail-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 1920px;
    height: 1080px;
    background: var(--bg-main);
    z-index: 2000;
    display: none;
    overflow-y: auto;
    overflow-x: hidden;
}

#detail-screen.active {
    display: block;
}

.detail-backdrop-wrap {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 720px;
    z-index: 1;
}

.detail-backdrop-img {
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center top;
}

.detail-backdrop-gradient {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(180deg, rgba(8, 11, 17, 0.4) 0%, rgba(8, 11, 17, 0.85) 65%, var(--bg-main) 100%),
                linear-gradient(90deg, var(--bg-main) 0%, rgba(8, 11, 17, 0.82) 45%, transparent 100%);
}

.detail-content-wrap {
    position: relative;
    z-index: 10;
    padding: var(--safe-top) var(--safe-side) var(--safe-bottom) var(--safe-side);
    display: flex;
    gap: 56px;
}

/* 2:3 Detail Poster Column (320px x 480px) */
.detail-poster-col {
    width: 320px;
    flex-shrink: 0;
}

.detail-poster-card {
    width: 100%;
    height: 480px;
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.85);
    border: 1.5px solid var(--border-subtle);
    background: var(--bg-surface);
}

.detail-poster-card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.detail-info-col {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.detail-top-nav {
    margin-bottom: 20px;
}

.detail-title {
    font-size: 30px;
    font-weight: 800;
    margin-bottom: 6px;
    line-height: 1.25;
    color: var(--text-main);
    text-shadow: 0 4px 20px rgba(0, 0, 0, 0.8);
}

.detail-orig-title {
    font-family: 'Outfit', sans-serif;
    font-size: 17px;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 18px;
}

.detail-badges-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 22px;
}

.detail-actions-row {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 28px;
}

.detail-synopsis-box {
    margin-bottom: 28px;
    max-width: 1100px;
}

.detail-synopsis-box h3 {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 10px;
    color: var(--text-main);
}

.detail-synopsis-box p {
    font-size: 15px;
    line-height: 1.7;
    color: var(--text-secondary);
}

.detail-cast-section {
    margin-bottom: 28px;
}

.detail-cast-section h3 {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 14px;
    color: var(--text-main);
}

.cast-chips-row {
    display: flex;
    gap: 14px;
    flex-wrap: wrap;
}

.cast-chip {
    padding: 10px 22px;
    border-radius: var(--radius-full);
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    font-size: 17px;
    font-weight: 600;
    color: var(--text-main);
}

/* Series Seasons & Episodes */
.detail-seasons-section {
    margin-top: 24px;
    max-width: 1250px;
}

.season-tabs-row {
    display: flex;
    flex-wrap: nowrap;
    gap: 16px;
    margin-bottom: 24px;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 6px 4px 12px 4px;
    scrollbar-width: none;
    -ms-overflow-style: none;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
}

.season-tabs-row::-webkit-scrollbar {
    display: none;
}

.season-tab-btn {
    flex-shrink: 0;
    padding: 10px 22px;
    border-radius: var(--radius-md);
    background: var(--bg-card);
    border: 2.5px solid transparent;
    color: var(--text-main);
    font-size: 15px;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s ease;
}

.season-tab-btn.active {
    background: var(--accent-primary);
    border-color: var(--accent-primary);
    box-shadow: 0 4px 16px rgba(229, 9, 20, 0.45);
}

.episodes-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 18px;
}

.episode-card {
    display: flex;
    align-items: center;
    gap: 18px;
    padding: 14px 20px;
    background: var(--bg-card);
    border-radius: var(--radius-md);
    border: 2.5px solid transparent;
    cursor: pointer;
    transition: all 0.2s ease;
}

.ep-num {
    font-family: 'Outfit', sans-serif;
    font-size: 20px;
    font-weight: 800;
    color: var(--accent-primary);
    width: 36px;
    text-align: center;
}

.ep-info {
    flex: 1;
    overflow: hidden;
}

.ep-title {
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 4px;
    color: var(--text-main);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ep-meta {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-muted);
}

.ep-play-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
}

.ep-play-icon svg {
    width: 20px;
    height: 20px;
    fill: currentColor;
}

/* ==========================================================================
   Quality Selection Modal Overlay
   ========================================================================== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(4, 6, 10, 0.88);
    z-index: 5000;
    display: none;
    align-items: center;
    justify-content: center;
}

.modal-overlay.active {
    display: flex;
}

.modal-box {
    width: 620px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    background: var(--bg-elevated);
    border: 1.5px solid var(--border-light);
    border-radius: var(--radius-lg);
    padding: 32px;
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.95);
    overflow: hidden;
}

.modal-header {
    margin-bottom: 22px;
    text-align: center;
    flex-shrink: 0;
}

.modal-header h3 {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-main);
}

.modal-list {
    display: flex;
    flex-direction: column;
    gap: 14px;
    max-height: 480px;
    overflow-y: auto;
    overflow-x: hidden;
    padding-right: 6px;
    padding-left: 6px;
    scrollbar-width: thin;
    scrollbar-color: var(--accent-primary) rgba(255, 255, 255, 0.08);
}

.modal-list::-webkit-scrollbar {
    width: 6px;
}

.modal-list::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 4px;
}

.modal-list::-webkit-scrollbar-thumb {
    background: var(--accent-primary);
    border-radius: 4px;
}

.modal-list-item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 14px 20px;
    border-radius: var(--radius-md);
    background: rgba(255, 255, 255, 0.08);
    border: 2.5px solid transparent;
    color: var(--text-main);
    cursor: pointer;
    font-size: 15px;
    font-weight: 600;
    font-family: inherit;
    transition: all 0.2s ease;
}

.quality-badge {
    background: var(--accent-primary);
    color: #ffffff;
    font-weight: 800;
    padding: 6px 14px;
    border-radius: var(--radius-sm);
    font-size: 16px;
}

.quality-label {
    flex: 1;
    text-align: right;
    color: var(--text-main);
}

.modal-list-item .icon svg {
    width: 22px;
    height: 22px;
    fill: currentColor;
}

/* ==========================================================================
   Search Screen Layout & Balanced TV Virtual Keyboard (OSK)
   ========================================================================== */
.search-container {
    max-width: 1320px;
    margin: var(--safe-top) auto var(--safe-bottom) auto;
}

.search-input-box {
    width: 100%;
    margin-bottom: 24px;
}

.search-input-field {
    width: 100%;
    height: 56px;
    background: var(--bg-card);
    border: 2px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 0 24px;
    font-size: 19px;
    font-weight: 600;
    font-family: inherit;
    color: var(--text-main);
    direction: rtl;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.search-input-field::placeholder {
    color: var(--text-muted);
}

/* 10-Foot Virtual Keyboard */
.osk-keyboard {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 32px;
    align-items: center;
}

.osk-row {
    display: flex;
    gap: 10px;
}

.osk-key {
    width: 58px;
    height: 50px;
    border-radius: var(--radius-sm);
    background: var(--bg-card);
    border: 2px solid var(--border-subtle);
    color: var(--text-main);
    font-size: 17px;
    font-weight: 700;
    font-family: 'Outfit', 'Vazirmatn', sans-serif;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.osk-key.wide {
    width: 110px;
    font-size: 15px;
    font-family: 'Vazirmatn', sans-serif;
}

.osk-key.space {
    width: 260px;
    font-size: 15px;
    font-family: 'Vazirmatn', sans-serif;
}

.search-results-container {
    margin-top: 24px;
}

.search-status-label {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 18px;
}

.search-empty-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 14px;
    padding: 48px 0;
    color: var(--text-muted);
}

.search-empty-icon svg {
    width: 48px;
    height: 48px;
    fill: currentColor;
    opacity: 0.6;
}

.search-empty-text {
    font-size: 17px;
    font-weight: 600;
}
