/* Custom Video Player Styles */
.video-wrapper {
    position: relative;
    width: 100%;
    max-width: 100%;
    background: #000;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    aspect-ratio: 16/9;
}

.video-container {
    position: relative;
    width: 100%;
    max-width: 1200px;
    margin: 0 auto 20px;
    background: #000;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

.custom-video-player {
    width: 100%;
    height: 100%;
    background: #000;
    display: block;
}

/* Subtitles Styling */
video::cue {
    background-color: rgba(0, 0, 0, 0.7);
    color: #fff;
    font-family: 'Inter', sans-serif;
    font-size: 1.1em;
    line-height: 1.4;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.8);
}

/* Custom Controls Overlay */
.video-controls-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(to top, rgba(0,0,0,0.95), rgba(0,0,0,0.7), transparent);
    padding: 20px;
    border-radius: 0;
    opacity: 1;
    transition: opacity 0.3s ease;
    display: flex;
    flex-direction: column;
    gap: 12px;
    z-index: 100;
}

.video-container:hover .video-controls-overlay,
.video-container.paused .video-controls-overlay {
    opacity: 1;
}

/* Progress Bar */
.video-progress-container {
    width: 100%;
    height: 5px;
    background: rgba(255,255,255,0.2);
    cursor: pointer;
    border-radius: 2px;
    position: relative;
}

.video-progress-bar {
    height: 100%;
    background: var(--cosmic-accent);
    width: 0%;
    border-radius: 2px;
    position: relative;
}

.video-progress-bar::after {
    content: '';
    position: absolute;
    right: -6px;
    top: 50%;
    transform: translateY(-50%) scale(0);
    width: 12px;
    height: 12px;
    background: #fff;
    border-radius: 50%;
    transition: transform 0.2s;
}

.video-progress-container:hover .video-progress-bar::after {
    transform: translateY(-50%) scale(1);
}

/* Buttons Row */
.video-controls-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
}

.video-btn {
    background: none;
    border: none;
    color: #fff;
    cursor: pointer;
    padding: 5px;
    border-radius: 4px;
    transition: color 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.video-btn:hover {
    color: var(--cosmic-accent);
}

.video-btn svg {
    width: 20px;
    height: 20px;
    fill: currentColor;
}

/* VideoPlayer Controls Styles */
.progress-bar-container {
    width: 100%;
    height: 6px;
    background: rgba(255,255,255,0.2);
    cursor: pointer;
    border-radius: 3px;
    position: relative;
    margin-bottom: 10px;
}

.progress-bar {
    width: 100%;
    height: 100%;
    position: relative;
}

.progress-fill {
    height: 100%;
    background: var(--cosmic-accent, #6366f1);
    border-radius: 3px;
    width: 0%;
}

.progress-hover {
    position: absolute;
    height: 100%;
    background: rgba(99, 102, 241, 0.5);
    border-radius: 3px;
    display: none;
}

.progress-bar-container:hover .progress-hover {
    display: block;
}

.controls-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
    width: 100%;
    flex-wrap: wrap;
}

.controls-left {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
}

.controls-right {
    display: flex;
    align-items: center;
    gap: 10px;
}

.control-btn {
    background: none;
    border: none;
    color: #fff;
    cursor: pointer;
    padding: 6px 8px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 14px;
    transition: background 0.2s, color 0.2s;
}

.control-btn:hover {
    background: rgba(255,255,255,0.1);
    color: var(--cosmic-accent, #6366f1);
}

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

.volume-container {
    display: flex;
    align-items: center;
    gap: 8px;
}

.volume-slider {
    width: 80px;
    height: 4px;
    cursor: pointer;
    accent-color: var(--cosmic-accent, #6366f1);
}

.time-display {
    font-size: 14px;
    color: #fff;
    font-family: 'Courier New', monospace;
    min-width: 100px;
}

.sub-dub-toggle {
    display: flex;
    gap: 0;
    border: 1px solid rgba(255,255,255,0.3);
    border-radius: 4px;
    background: rgba(0,0,0,0.3);
}

.sd-btn {
    background: transparent;
    border: none;
    color: #fff;
    cursor: pointer;
    padding: 6px 12px;
    font-size: 12px;
    font-weight: 600;
    transition: all 0.2s;
    border-radius: 0;
}

.sd-btn:first-child {
    border-radius: 4px 0 0 4px;
}

.sd-btn:last-child {
    border-radius: 0 4px 4px 0;
}

.sd-btn.active {
    background: var(--cosmic-accent, #6366f1);
    color: #fff;
}

.sd-btn:hover:not(.active) {
    background: rgba(255,255,255,0.1);
}

.settings-menu-container {
    position: relative;
}

.settings-menu {
    position: absolute;
    bottom: 100%;
    right: 0;
    background: rgba(0,0,0,0.95);
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 8px;
    padding: 0;
    min-width: 200px;
    max-height: 300px;
    overflow-y: auto;
    display: none;
    z-index: 1000;
    margin-bottom: 10px;
}

.settings-menu.active {
    display: block;
}

.settings-menu-container:has(.settings-menu.active) {
    z-index: 1001;
}

.settings-header {
    padding: 10px 15px;
    font-weight: 600;
    color: var(--cosmic-accent, #6366f1);
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.settings-option,
.quality-option,
.speed-option,
.subtitle-option {
    padding: 10px 15px;
    color: #fff;
    cursor: pointer;
    background: transparent;
    border: none;
    width: 100%;
    text-align: left;
    font-size: 14px;
    transition: background 0.2s;
}

.settings-option:hover,
.quality-option:hover,
.speed-option:hover,
.subtitle-option:hover {
    background: rgba(255,255,255,0.1);
}

.settings-option.active,
.quality-option.active,
.speed-option.active,
.subtitle-option.active {
    background: rgba(99, 102, 241, 0.3);
    color: var(--cosmic-accent, #6366f1);
}

/* Next Episode Overlay */
.next-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 200;
    border-radius: 12px;
}

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

.next-content {
    background: rgba(0, 0, 0, 0.95);
    border: 2px solid var(--cosmic-accent, #6366f1);
    border-radius: 12px;
    padding: 30px;
    text-align: center;
    min-width: 300px;
}

.next-title {
    color: #fff;
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 20px;
}

.next-actions {
    display: flex;
    gap: 15px;
    justify-content: center;
}

.next-actions button {
    background: var(--cosmic-accent, #6366f1);
    border: none;
    color: #fff;
    padding: 10px 25px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.next-actions button:hover {
    opacity: 0.8;
    transform: scale(1.05);
}

.next-actions #cancelNextBtn {
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.next-actions #cancelNextBtn:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Video container spacing */
#videoPlayer {
    margin-top: 20px;
    margin-bottom: 30px;
    width: 100%;
    max-width: 100%;
}

.loading-text {
    color: #fff;
    text-align: center;
    padding: 50px;
    background: #000;
    border-radius: 12px;
}

.error-message {
    color: #ff6b6b;
    text-align: center;
    padding: 30px;
    background: rgba(255,0,0,0.1);
    border-radius: 8px;
    border: 1px solid rgba(255,107,107,0.3);
}

/* Responsive design */
@media (max-width: 768px) {
    .controls-row {
        gap: 8px;
    }
    
    .controls-left,
    .controls-right {
        gap: 8px;
    }
    
    .time-display {
        font-size: 12px;
        min-width: 80px;
    }
    
    .control-btn {
        padding: 4px 6px;
        font-size: 12px;
    }
    
    .control-btn svg {
        width: 18px;
        height: 18px;
    }
    
    .volume-slider {
        width: 60px;
    }
    
    .sub-dub-toggle {
        gap: 0;
    }
    
    .sd-btn {
        padding: 4px 8px;
        font-size: 11px;
    }
    
    .settings-menu {
        min-width: 150px;
    }
}

/* Video Loader Spinner */
.video-loader {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 50;
}

.video-loader {
    display: none;
}

.video-loader.active {
    display: flex;
}

.spinner {
    border: 3px solid rgba(255, 255, 255, 0.1);
    border-top: 3px solid var(--cosmic-accent, #6366f1);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Player Navigation */
.player-navigation {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
    margin-top: 20px;
    padding: 15px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 8px;
}

.nav-btn {
    background: rgba(99, 102, 241, 0.2);
    border: 1px solid var(--cosmic-accent, #6366f1);
    color: var(--cosmic-accent, #6366f1);
    cursor: pointer;
    padding: 8px 15px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s;
}

.nav-btn:hover:not(:disabled) {
    background: var(--cosmic-accent, #6366f1);
    color: #fff;
}

.nav-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.nav-btn svg {
    width: 16px;
    height: 16px;
}

.ep-info {
    flex: 1;
    text-align: center;
    color: #fff;
}

.ep-number {
    display: block;
    font-size: 12px;
    color: var(--cosmic-accent, #6366f1);
    font-weight: 600;
    text-transform: uppercase;
}

.ep-title {
    display: block;
    font-size: 16px;
    font-weight: 600;
    margin-top: 2px;
}

