/* ============================================================
   AKVIM TV - MODAL PLAYER STYLES
   ============================================================
   استایل‌های Modal، پلیر، سایدبار و تب‌ها
   ============================================================ */

/* ============ MODAL OVERLAY ============ */
.modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 1000;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 30px;
    opacity: 0;
    visibility: hidden;
    transition: all 0.4s ease;
}

.modal-overlay.open {
    opacity: 1;
    visibility: visible;
}

/* ============ MODAL CONTAINER ============ */
.modal-container {
    width: 100%;
    max-width: 1400px;
    height: 90vh;
    max-height: 850px;
    background: linear-gradient(135deg, rgba(18, 18, 26, 0.98), rgba(12, 12, 18, 0.98));
    border: 1px solid var(--border-color);
    border-radius: 24px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transform: scale(0.9) translateY(30px);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 40px 100px rgba(0, 0, 0, 0.8);
    position: relative;
}

.modal-overlay.open .modal-container {
    transform: scale(1) translateY(0);
}

.modal-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--primary-red), transparent);
    z-index: 10;
}

/* ============ MODAL HEADER ============ */
.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 24px;
    border-bottom: 1px solid var(--border-color);
    background: rgba(0, 0, 0, 0.3);
    flex-shrink: 0;
}

.modal-header-left {
    display: flex;
    align-items: center;
    gap: 14px;
    min-width: 0;
}

.modal-header-icon {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--primary-red), var(--dark-red));
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    flex-shrink: 0;
    box-shadow: 0 4px 15px rgba(230, 57, 70, 0.4);
}

.modal-header-info {
    display: flex;
    flex-direction: column;
    gap: 3px;
    min-width: 0;
}

.modal-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.modal-subtitle {
    font-size: 11px;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.modal-subtitle .live-dot {
    width: 6px;
    height: 6px;
    flex-shrink: 0;
}

.modal-header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.modal-action-btn {
    width: 40px;
    height: 40px;
    border-radius: 11px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

.modal-action-btn:hover {
    background: rgba(230, 57, 70, 0.15);
    border-color: var(--primary-red);
    color: var(--primary-red);
    transform: translateY(-2px);
}

.modal-action-btn.close:hover {
    background: var(--primary-red);
    border-color: var(--primary-red);
    color: #fff;
}

/* ============ MODAL BODY ============ */
.modal-body {
    flex: 1;
    display: grid;
    grid-template-columns: 1fr 380px;
    overflow: hidden;
    min-height: 0;
}

/* ============ PLAYER SIDE ============ */
.modal-player-side {
    display: flex;
    flex-direction: column;
    background: #000;
    position: relative;
    overflow: hidden;
}

.modal-player {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #000;
    position: relative;
    min-height: 0;
    overflow: hidden;
}

.modal-player video {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

/* ============ AUDIO VISUALIZER ============ */
.modal-player .audio-visualizer {
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #0a0a0f 0%, #1a1a2e 100%);
    position: relative;
    overflow: hidden;
}

.modal-player.audio-mode .audio-visualizer {
    display: flex;
}

.modal-player.audio-mode video {
    display: none;
}

.audio-visualizer::before {
    content: '';
    position: absolute;
    inset: 0;
    background: 
        radial-gradient(circle at 50% 50%, rgba(230, 57, 70, 0.15) 0%, transparent 60%);
    animation: audioGlow 3s ease-in-out infinite;
}

@keyframes audioGlow {
    0%, 100% { opacity: 0.5; }
    50% { opacity: 1; }
}

.audio-art {
    width: 140px;
    height: 140px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-red), var(--dark-red));
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    z-index: 2;
    box-shadow: 0 20px 60px rgba(230, 57, 70, 0.5);
    animation: audioPulse 2s ease-in-out infinite;
    margin-bottom: 30px;
}

@keyframes audioPulse {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 20px 60px rgba(230, 57, 70, 0.5);
    }
    50% {
        transform: scale(1.05);
        box-shadow: 0 25px 75px rgba(230, 57, 70, 0.8);
    }
}

.audio-art svg {
    width: 50px;
    height: 50px;
    color: #fff;
}

.audio-bars {
    display: flex;
    align-items: flex-end;
    gap: 5px;
    height: 60px;
    margin-bottom: 25px;
    position: relative;
    z-index: 2;
}

.audio-bars span {
    width: 5px;
    background: linear-gradient(180deg, var(--primary-red), var(--accent));
    border-radius: 3px;
    animation: audioBar 1s ease-in-out infinite;
}

.audio-bars span:nth-child(1) { height: 30%; animation-delay: 0s; }
.audio-bars span:nth-child(2) { height: 60%; animation-delay: 0.1s; }
.audio-bars span:nth-child(3) { height: 90%; animation-delay: 0.2s; }
.audio-bars span:nth-child(4) { height: 45%; animation-delay: 0.3s; }
.audio-bars span:nth-child(5) { height: 75%; animation-delay: 0.4s; }
.audio-bars span:nth-child(6) { height: 55%; animation-delay: 0.5s; }
.audio-bars span:nth-child(7) { height: 85%; animation-delay: 0.6s; }
.audio-bars span:nth-child(8) { height: 40%; animation-delay: 0.7s; }
.audio-bars span:nth-child(9) { height: 70%; animation-delay: 0.8s; }

@keyframes audioBar {
    0%, 100% { transform: scaleY(0.4); opacity: 0.6; }
    50% { transform: scaleY(1); opacity: 1; }
}

.audio-name {
    font-size: 22px;
    font-weight: 800;
    color: #fff;
    position: relative;
    z-index: 2;
    text-align: center;
    padding: 0 20px;
    font-family: 'Playfair Display', serif;
}

.audio-category {
    font-size: 12px;
    color: var(--text-secondary);
    letter-spacing: 2px;
    text-transform: uppercase;
    margin-top: 8px;
    position: relative;
    z-index: 2;
    font-weight: 600;
}

/* ============ PLAYER LOADING ============ */
.player-loading {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 20px;
    z-index: 5;
    transition: opacity 0.4s ease;
}

.player-loading.hidden {
    opacity: 0;
    pointer-events: none;
}

.player-loading .spinner {
    width: 48px;
    height: 48px;
    border: 3px solid rgba(230, 57, 70, 0.2);
    border-top-color: var(--primary-red);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.player-loading-text {
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: 500;
    letter-spacing: 1px;
}

/* ============ FULLSCREEN HINT ============ */
.fullscreen-hint {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    padding: 10px 18px;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 100px;
    font-size: 11px;
    color: rgba(255, 255, 255, 0.8);
    display: flex;
    align-items: center;
    gap: 8px;
    opacity: 0;
    transition: opacity 0.4s ease;
    pointer-events: none;
    z-index: 6;
}

.modal-container.fullscreen:hover .fullscreen-hint {
    opacity: 1;
}

.fullscreen-hint kbd {
    padding: 2px 6px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    font-size: 10px;
    font-family: monospace;
    font-weight: 700;
}

/* ============ MODAL SIDEBAR ============ */
.modal-sidebar {
    border-left: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    background: rgba(0, 0, 0, 0.2);
    overflow: hidden;
}

/* ============ SIDEBAR TABS ============ */
.sidebar-tabs {
    display: flex;
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
    background: rgba(0, 0, 0, 0.3);
}

.sidebar-tab {
    flex: 1;
    padding: 14px 10px;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    font-family: inherit;
}

.sidebar-tab:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.02);
}

.sidebar-tab.active {
    color: var(--primary-red);
    border-bottom-color: var(--primary-red);
    background: rgba(230, 57, 70, 0.05);
}

.sidebar-tab svg {
    width: 14px;
    height: 14px;
}

/* ============ SIDEBAR SEARCH ============ */
.sidebar-search {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
}

.sidebar-search input {
    width: 100%;
    padding: 10px 14px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    color: var(--text-primary);
    font-size: 13px;
    font-family: inherit;
    outline: none;
    transition: all 0.3s ease;
}

.sidebar-search input:focus {
    border-color: rgba(230, 57, 70, 0.5);
    background: rgba(230, 57, 70, 0.05);
}

.sidebar-search input::placeholder {
    color: var(--text-secondary);
}

/* ============ SIDEBAR LIST ============ */
.sidebar-list {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
    min-height: 0;
}

.sidebar-list::-webkit-scrollbar {
    width: 5px;
}

.sidebar-list::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar-list::-webkit-scrollbar-thumb {
    background: rgba(230, 57, 70, 0.3);
    border-radius: 3px;
}

.sidebar-list::-webkit-scrollbar-thumb:hover {
    background: rgba(230, 57, 70, 0.5);
}

.sidebar-section-title {
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: var(--text-secondary);
    padding: 12px 12px 8px;
    opacity: 0.6;
}

.sidebar-item {
    padding: 11px 12px;
    border-radius: 11px;
    cursor: pointer;
    transition: all 0.25s ease;
    display: flex;
    align-items: center;
    gap: 11px;
    margin-bottom: 3px;
    position: relative;
    overflow: hidden;
}

.sidebar-item:hover {
    background: rgba(255, 255, 255, 0.05);
}

.sidebar-item.active {
    background: rgba(230, 57, 70, 0.15);
}

.sidebar-item.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 20%;
    height: 60%;
    width: 3px;
    background: var(--primary-red);
    border-radius: 0 3px 3px 0;
}

.sidebar-item-logo {
    width: 36px;
    height: 36px;
    border-radius: 9px;
    background: linear-gradient(135deg, rgba(230, 57, 70, 0.2), rgba(183, 28, 44, 0.2));
    border: 1px solid rgba(230, 57, 70, 0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary-red);
    flex-shrink: 0;
    font-weight: 800;
    font-size: 12px;
    font-family: 'Playfair Display', serif;
}

.sidebar-item.active .sidebar-item-logo {
    background: linear-gradient(135deg, var(--primary-red), var(--dark-red));
    color: #fff;
    border-color: var(--primary-red);
}

.sidebar-item-info {
    flex: 1;
    min-width: 0;
}

.sidebar-item-name {
    font-size: 12.5px;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: flex;
    align-items: center;
    gap: 6px;
}

.sidebar-item-meta {
    font-size: 10px;
    color: var(--text-secondary);
    margin-top: 2px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.quality-tag {
    padding: 1px 5px;
    background: rgba(255, 255, 255, 0.06);
    border-radius: 4px;
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 0.5px;
}

.sidebar-item.active .sidebar-item-name::after {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--primary-red);
    box-shadow: 0 0 8px var(--primary-red);
    animation: pulse 1.5s ease-in-out infinite;
    flex-shrink: 0;
}

.sidebar-empty {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-secondary);
    font-size: 12px;
}

.sidebar-empty svg {
    width: 36px;
    height: 36px;
    margin-bottom: 10px;
    opacity: 0.3;
}

/* ============ FULLSCREEN MODE ============ */
.modal-container.fullscreen {
    max-width: 100%;
    width: 100%;
    height: 100vh;
    max-height: 100vh;
    border-radius: 0;
}

.modal-overlay.fullscreen {
    padding: 0;
}

.modal-container.fullscreen .modal-body {
    grid-template-columns: 1fr;
}

.modal-container.fullscreen .modal-sidebar {
    display: none;
}

.modal-container.fullscreen .modal-player {
    height: 100%;
}

/* ============ RESPONSIVE ============ */
@media (max-width: 1100px) {
    .modal-body {
        grid-template-columns: 1fr 320px;
    }
}

@media (max-width: 900px) {
    .modal-overlay {
        padding: 0;
    }

    .modal-container {
        max-width: 100%;
        height: 100vh;
        max-height: 100vh;
        border-radius: 0;
    }

    .modal-body {
        grid-template-columns: 1fr;
        grid-template-rows: 1fr auto;
    }

    .modal-sidebar {
        border-left: none;
        border-top: 1px solid var(--border-color);
        max-height: 45vh;
    }

    .modal-player-side {
        min-height: 0;
    }

    .modal-container.fullscreen .modal-sidebar {
        display: flex;
    }
}

@media (max-width: 480px) {
    .modal-header {
        padding: 12px 16px;
    }

    .modal-title {
        font-size: 14px;
    }

    .modal-subtitle {
        display: none;
    }

    .modal-header-icon {
        width: 36px;
        height: 36px;
    }

    .modal-action-btn {
        width: 36px;
        height: 36px;
    }

    .audio-art {
        width: 100px;
        height: 100px;
    }

    .audio-art svg {
        width: 36px;
        height: 36px;
    }

    .audio-name {
        font-size: 18px;
    }

    .audio-bars {
        height: 45px;
    }

    .sidebar-tab {
        font-size: 11px;
        padding: 12px 6px;
    }
}