/* ============================================
   Drishya - Video Player Styles
   Apple TV+ Inspired (Glass & Minimal)
   ============================================ */

/* Player Overlay */
.hidden {
    display: none !important;
}

@keyframes rotate {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

.rotating {
    animation: rotate 1s linear infinite;
}

/* Change Source Button - Icon only style */
.control-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.1);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    transition: all var(--transition-fast);
    position: relative;
}

.control-btn:hover {
    transform: scale(1.1);
    color: #fff;
    background: rgba(255, 255, 255, 0.2);
}

.control-btn svg {
    width: 20px;
    height: 20px;
}

/* Hide tooltip text by default, show on hover */
.control-btn .tooltip {
    display: none;
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    padding: 6px 12px;
    background: rgba(28, 28, 30, 0.95);
    border-radius: 6px;
    font-size: 0.75rem;
    white-space: nowrap;
    pointer-events: none;
    margin-bottom: 8px;
}

.control-btn:hover .tooltip {
    display: block;
}

.player-overlay {
    position: fixed;
    inset: 0;
    background: #000;
    z-index: var(--z-player);
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-base);
}

.player-overlay.active {
    opacity: 1;
    visibility: visible;
}

.player-container {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #000;
}

.video-player {
    width: 100%;
    height: 100%;
    object-fit: contain;
    background: #000;
}

/* Player Controls Gradient - Subtle Apple Vibe */
.player-controls {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    background: linear-gradient(180deg,
            rgba(0, 0, 0, 0.6) 0%,
            transparent 15%,
            transparent 85%,
            rgba(0, 0, 0, 0.8) 100%);
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--transition-base);
    cursor: none;
}

.player-controls.visible {
    opacity: 1;
    pointer-events: auto;
    cursor: default;
}

/* Top Controls */
.player-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-xl) var(--content-padding);
}

.player-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.9);
    letter-spacing: -0.5px;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
}

.player-top-right {
    display: flex;
    align-items: center;
    gap: var(--space-md);
}

/* Center Controls - Big Play Button */
.player-center {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 60px;
    position: relative;
    z-index: 20;
}

.player-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-primary);
    transition: all var(--transition-fast);
    border-radius: 50%;
    background: transparent;
}

.player-btn:hover {
    transform: scale(1.1);
    color: #fff;
    background: rgba(255, 255, 255, 0.1);
}

.play-btn {
    width: 90px;
    height: 90px;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.play-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.05);
    /* Gentle scale */
}

.seek-btn {
    width: 60px;
    height: 60px;
    opacity: 0.8;
}

.seek-btn:hover {
    opacity: 1;
}

.back-btn {
    width: 44px;
    height: 44px;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
}

/* Bottom Controls */
.player-bottom {
    padding: var(--space-xl) var(--content-padding);
}

/* Progress Bar - Minimal Line */
.progress-container {
    position: relative;
    margin-bottom: var(--space-lg);
    padding: 10px 0;
    cursor: pointer;
}

.progress-bar {
    position: relative;
    width: 100%;
    height: 6px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: var(--radius-full);
    transition: height var(--transition-fast);
    border: 1px solid rgba(255, 0, 0, 0.5);
    /* Red outline */
}

.progress-container:hover .progress-bar {
    height: 8px;
    /* Slight expand */
}

.progress-buffered {
    position: absolute;
    height: 100%;
    background: rgba(255, 255, 255, 0.3);
    border-radius: var(--radius-full);
    pointer-events: none;
}

.progress-played {
    position: absolute;
    height: 100%;
    background: rgba(255, 255, 255, 0.9);
    /* Almost white */
    border-radius: var(--radius-full);
    pointer-events: none;
    box-shadow: 0 0 15px rgba(255, 255, 255, 0.5);
}

.progress-thumb {
    position: absolute;
    top: 50%;
    width: 20px;
    height: 20px;
    background: #fff;
    border-radius: var(--radius-full);
    transform: translate(-50%, -50%) scale(0);
    transition: transform var(--transition-fast);
    pointer-events: none;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
}

.progress-container:hover .progress-thumb {
    transform: translate(-50%, -50%) scale(1);
}

.progress-preview {
    position: absolute;
    bottom: 25px;
    left: 0;
    padding: 6px 12px;
    background: rgba(28, 28, 30, 0.9);
    backdrop-filter: blur(10px);
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 600;
    opacity: 0;
    pointer-events: none;
    transform: translateX(-50%);
    transition: opacity var(--transition-fast);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.progress-container:hover .progress-preview {
    opacity: 1;
}

/* Bottom Controls Row */
.player-bottom-controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.player-left-controls,
.player-right-controls {
    display: flex;
    align-items: center;
    gap: 24px;
}

.time-display {
    font-size: 0.9rem;
    font-variant-numeric: tabular-nums;
    color: rgba(255, 255, 255, 0.8);
    font-weight: 500;
}

/* Volume */
.volume-container {
    display: flex;
    align-items: center;
    gap: 12px;
}

.volume-slider {
    width: 80px;
    height: 4px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: var(--radius-full);
    -webkit-appearance: none;
    appearance: none;
    cursor: pointer;
}

.volume-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 12px;
    height: 12px;
    background: #fff;
    border-radius: 50%;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
}

/* Quality & Speed - Glass Chip style */
/* Quality & Speed - Glass Chip style */
.quality-selector {
    padding: 6px 12px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    color: rgba(255, 255, 255, 0.9);
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.speed-selector {
    padding: 6px 4px;
    /* Reduced width */
    width: 50px;
    /* Fixed compact width */
    text-align: center;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    color: rgba(255, 255, 255, 0.9);
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.quality-selector:hover,
.speed-selector:hover {
    background: rgba(255, 255, 255, 0.2);
}

.quality-selector option,
.speed-selector option {
    background: #1c1c1e;
    /* Standard dark dropdown */
    color: #fff;
}

/* Settings Panel - Glass Sidebar */
/* Using previously defined Track Modal for settings content */

/* Netflix-style Audio/Subtitle Modal but Glass */
.track-modal {
    position: absolute;
    inset: 0;
    z-index: 100;
    display: none;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.4);
    /* Dim background */
}

.track-modal.active {
    display: flex;
    opacity: 1;
    pointer-events: auto;
    backdrop-filter: blur(5px);
}

.track-modal-content {
    display: flex;
    background: rgba(28, 28, 30, 0.85);
    /* Glass */
    backdrop-filter: blur(40px) saturate(180%);
    padding: 40px;
    border-radius: 24px;
    /* More rounded */
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
    max-width: 800px;
    width: 90%;
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.1);
    position: relative;
}

.track-section {
    flex: 1;
    min-width: 0;
    /* Prevent flex overflow */
}

.track-section h3 {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding-bottom: 15px;
    color: var(--text-primary);
}

.track-item {
    padding: 12px 20px;
    cursor: pointer;
    border-radius: 12px;
    transition: background 0.2s;
    font-size: 1rem;
    color: rgba(255, 255, 255, 0.7);
    display: flex;
    align-items: center;
}

.track-item:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

.track-item.selected {
    color: var(--text-primary);
    font-weight: 600;
    background: rgba(255, 255, 255, 0.15);
}

.track-item.selected::before {
    content: '✓';
    margin-right: 12px;
    font-weight: bold;
}

.track-divider {
    width: 1px;
    background: rgba(255, 255, 255, 0.1);
    margin: 0 30px;
}

.modal-close {
    position: absolute;
    top: 24px;
    right: 24px;
    background: rgba(255, 255, 255, 0.1);
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 16px;
    cursor: pointer;
    transition: background 0.2s;
    border: none;
}

.modal-close:hover {
    background: rgba(255, 255, 255, 0.25);
}

/* Loading Spinner */
.player-loading {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(10px);
    z-index: 50;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s;
}

.player-loading.active {
    opacity: 1;
    visibility: visible;
}

/* Loading Status (Centered Below Play Button) */
.player-loading-status {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translateX(-50%);
    margin-top: 90px;
    /* Clear the 90px play button (45px half + 45px gap) */
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(10px);
    padding: 16px 24px;
    border-radius: 16px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    z-index: 60;
    max-width: 300px;
    pointer-events: none;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    text-align: center;
}

.player-loading-status .loading-spinner {
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    flex-shrink: 0;
}

.player-loading-status .loading-text {
    font-size: 0.95rem;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.95);
    max-width: 100%;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(255, 255, 255, 0.1);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* Server Selector Popup */
.server-selector {
    position: absolute;
    inset: 0;
    z-index: 90;
    /* Below Settings/Tracks (100) but above controls (20) */
    display: none;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(15px);
    padding: 40px;
}

.server-selector.active,
.server-selector[style*="display: flex"] {
    display: flex !important;
}

.server-label {
    font-size: 1.5rem;
    font-weight: 700;
    color: #fff;
    margin-bottom: 30px;
    letter-spacing: -0.5px;
}

.server-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    justify-content: center;
    max-width: 800px;
}

.server-btn {
    padding: 14px 28px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    color: rgba(255, 255, 255, 0.9);
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.server-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
    color: #fff;
    border-color: rgba(255, 255, 255, 0.3);
}

.server-btn.active {
    background: #fff;
    color: #000;
    font-weight: 700;
    border-color: #fff;
    box-shadow: 0 4px 15px rgba(255, 255, 255, 0.2);
}

/* Responsive */
@media (max-width: 768px) {
    .player-center {
        gap: 32px;
        width: 100%;
        justify-content: center;
    }

    .play-btn {
        width: 64px;
        height: 64px;
    }

    .play-btn svg {
        width: 32px;
        height: 32px;
    }

    .seek-btn {
        width: 44px;
        height: 44px;
    }

    .seek-btn svg {
        width: 24px;
        height: 24px;
    }

    /* Hide less important controls on mobile */
    .volume-container {
        display: none;
    }

    .player-title {
        display: block;
        font-size: 1rem;
        max-width: 60%;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .player-bottom {
        padding: 20px;
    }

    .player-bottom-controls {
        gap: 10px;
    }

    .time-display {
        font-size: 0.8rem;
    }

    /* Ensure icons don't get too small */
    .player-btn svg {
        width: 20px;
        height: 20px;
    }

    .track-modal-content {
        flex-direction: column;
        padding: 24px;
        border-radius: 24px 24px 0 0;
        /* Sheet style */
        position: fixed;
        bottom: 0;
        width: 100%;
        max-height: 80vh;
        top: auto;
    }

    .track-divider {
        display: none;
    }

    .track-section {
        margin-bottom: 20px;
    }
}