/* Custom Video Player Styles */
.custom-video-player {
    position: relative;
    cursor: pointer;
    user-select: none;
    transition: cursor 0.3s ease;
    /* Ensure container maintains 16:9 aspect ratio */
    aspect-ratio: 16 / 9;
    /* Prevent content from affecting size */
    overflow: hidden;
}

.custom-video-player.hide-cursor {
    cursor: none;
}

.custom-video-player video {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
    /* Prevent video dimensions from affecting container */
    max-width: 100%;
    max-height: 100%;
}

/* Video Controls */
.video-controls {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(to top, rgba(0,0,0,0.9) 0%, rgba(0,0,0,0.7) 60%, transparent 100%);
    padding: 1.5rem 1rem 1rem;
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 10;
}

.custom-video-player.paused .video-controls,
.custom-video-player.show-controls .video-controls {
    opacity: 1;
}

/* Progress Bar */
.progress-bar-container {
    width: 100%;
    padding: 8px 0;
    margin-bottom: 8px;
    cursor: pointer;
    position: relative;
}

.progress-bar {
    position: relative;
    width: 100%;
    height: 4px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 2px;
    transition: height 0.1s ease;
}

.progress-bar-container:hover .progress-bar {
    height: 6px;
}

.progress-bar-buffered {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    background: rgba(255, 255, 255, 0.5);
    border-radius: 2px;
    width: 0%;
}

.progress-bar-filled {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    background: #3b82f6;
    border-radius: 2px;
    width: 0%;
    z-index: 1;
    transition: width 0.05s linear;
}

.custom-video-player.seeking .progress-bar-filled {
    transition: none;
}

.progress-bar-handle {
    position: absolute;
    top: 50%;
    left: 0%;
    transform: translate(-50%, -50%) scale(0);
    width: 14px;
    height: 14px;
    background: #3b82f6;
    border-radius: 50%;
    box-shadow: 0 0 4px rgba(0, 0, 0, 0.5);
    transition: transform 0.1s ease, left 0.05s linear;
    z-index: 2;
}

.custom-video-player.seeking .progress-bar-handle {
    transition: transform 0.1s ease;
}

.progress-bar-container:hover .progress-bar-handle {
    transform: translate(-50%, -50%) scale(1);
}

/* Frame Preview Thumbnail */
.frame-preview {
    position: absolute;
    bottom: 100%;
    left: 0;
    transform: translateX(-50%);
    margin-bottom: 20px;
    background: #1e293b;
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    overflow: visible;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
    z-index: 3;
}

.frame-preview::after {
    content: '';
    position: absolute;
    bottom: -8px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 8px solid transparent;
    border-right: 8px solid transparent;
    border-top: 8px solid #1e293b;
    z-index: 1;
}

.frame-preview::before {
    content: '';
    position: absolute;
    bottom: -10px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 9px solid transparent;
    border-right: 9px solid transparent;
    border-top: 10px solid rgba(255, 255, 255, 0.2);
    z-index: 0;
}

.frame-preview.visible {
    opacity: 1;
}

.frame-preview canvas {
    display: block;
    width: 160px;
    height: 90px;
    background: #000;
    border-radius: 6px;
    overflow: hidden;
}

.frame-preview-time {
    position: absolute;
    bottom: 4px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
}

/* Controls Row */
.controls-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.controls-left,
.controls-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Control Buttons */
.control-btn {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
    padding: 0.5rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 0.5rem;
    transition: all 0.2s ease;
}

.control-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.4);
    transform: translateY(-1px);
}

.control-btn:active {
    transform: translateY(0);
}

.control-btn svg {
    width: 24px;
    height: 24px;
}

.play-btn svg {
    width: 28px;
    height: 28px;
}

/* Volume Controls */
.volume-slider-container {
    position: relative;
    width: 0;
    overflow: hidden;
    transition: width 0.2s ease;
    display: flex;
    align-items: center;
    padding: 16px 0;
    cursor: pointer;
}

.controls-left:hover .volume-slider-container {
    width: 80px;
    overflow: visible;
    padding: 16px 4px;
}

.volume-slider {
    -webkit-appearance: none;
    appearance: none;
    width: 80px;
    height: 4px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 2px;
    outline: none;
    cursor: pointer;
    pointer-events: auto;
}

.volume-slider::before {
    content: '';
    position: absolute;
    top: -8px;
    bottom: -8px;
    left: 0;
    right: 0;
    cursor: pointer;
}

.volume-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 14px;
    height: 14px;
    background: white;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.volume-slider::-moz-range-thumb {
    width: 14px;
    height: 14px;
    background: white;
    border-radius: 50%;
    cursor: pointer;
    border: none;
    box-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

/* Time Display */
.time-display {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 14px;
    font-weight: 500;
    color: white;
    font-variant-numeric: tabular-nums;
}

.time-separator {
    opacity: 0.7;
}

/* Settings Menu */
.settings-menu {
    position: absolute;
    bottom: 60px;
    right: 16px;
    background: rgba(0, 0, 0, 0.95);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 0.5rem;
    padding: 0.5rem;
    min-width: 250px;
    max-width: 320px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.settings-menu.hidden {
    opacity: 0;
    pointer-events: none;
    transform: translateY(10px);
}

/* Settings Main Menu */
.settings-main {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.settings-menu-item {
    background: none;
    border: none;
    color: white;
    padding: 0.75rem 1rem;
    cursor: pointer;
    text-align: left;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    white-space: nowrap;
}

.settings-menu-item:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateX(2px);
}

.settings-menu-item .current-value {
    color: rgba(255, 255, 255, 0.6);
    font-size: 13px;
    flex-shrink: 0;
}

.settings-menu-item svg {
    width: 16px;
    height: 16px;
    opacity: 0.6;
}

/* Settings Submenu */
.settings-submenu {
    display: none;
}

.settings-submenu.active {
    display: block;
}

.settings-submenu-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    margin-bottom: 6px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.settings-back-btn {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.settings-back-btn svg {
    width: 20px;
    height: 20px;
}

.settings-submenu-title {
    font-size: 14px;
    font-weight: 600;
    color: white;
    white-space: normal;
    line-height: 1.3;
}

.speed-options,
.quality-options,
.fade-duration-options {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.speed-option,
.quality-option,
.fade-duration-option {
    background: none;
    border: none;
    color: white;
    padding: 12px 14px;
    cursor: pointer;
    text-align: left;
    border-radius: 4px;
    font-size: 14px;
    transition: background-color 0.2s;
    display: flex;
    align-items: center;
    justify-content: space-between;
    white-space: nowrap;
}

.speed-option:hover,
.quality-option:hover,
.fade-duration-option:hover {
    background: rgba(255, 255, 255, 0.1);
}

.speed-option.active,
.quality-option.active,
.fade-duration-option.active {
    color: #3b82f6;
}

.speed-option.active::after,
.quality-option.active::after,
.fade-duration-option.active::after {
    content: '✓';
    font-weight: bold;
}

/* Cinema Mode Button in Controls */
.cinema-btn svg {
    width: 22px;
    height: 22px;
}

/* Big Play Button */
.big-play-btn {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 80px;
    height: 80px;
    background: rgba(59, 130, 246, 0.9);
    backdrop-filter: blur(10px);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    z-index: 5;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
}

.big-play-btn:hover {
    background: rgba(59, 130, 246, 1);
    border-color: rgba(255, 255, 255, 0.5);
    transform: translate(-50%, -50%) scale(1.1);
    box-shadow: 0 8px 12px -2px rgba(0, 0, 0, 0.4);
}

.big-play-btn svg {
    width: 40px;
    height: 40px;
    color: white;
    margin-left: 4px;
}

.custom-video-player.playing .big-play-btn {
    opacity: 0;
    pointer-events: none;
}

/* Custom Context Menu */
.custom-context-menu {
    position: absolute;
    background: rgba(0, 0, 0, 0.95);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 0.5rem;
    padding: 0.5rem;
    min-width: 240px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
    z-index: 100;
    opacity: 1;
    transform: scale(1);
    transition: opacity 0.15s ease, transform 0.15s ease;
}

.custom-context-menu.hidden {
    opacity: 0;
    transform: scale(0.95);
    pointer-events: none;
}

.context-menu-item {
    background: none;
    border: none;
    color: white;
    padding: 0.75rem 1rem;
    cursor: pointer;
    text-align: left;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
}

.context-menu-item:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateX(2px);
}

.context-menu-item svg {
    flex-shrink: 0;
}

.context-menu-item span {
    flex: 1;
    white-space: nowrap;
}

/* Context menu separator */
.context-menu-separator {
    height: 1px;
    background: rgba(255, 255, 255, 0.2);
    margin: 0.5rem 0;
}

/* Toggle Switch Styles */
.toggle-item {
    justify-content: space-between;
}

.toggle-switch {
    position: relative;
    width: 40px;
    height: 22px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 11px;
    transition: background-color 0.3s;
    flex-shrink: 0;
}

.toggle-item.active .toggle-switch {
    background: #3b82f6;
}

.toggle-slider {
    position: absolute;
    top: 2px;
    left: 2px;
    width: 18px;
    height: 18px;
    background: white;
    border-radius: 50%;
    transition: transform 0.3s;
}

.toggle-item.active .toggle-slider {
    transform: translateX(18px);
}

/* Loading Spinner */
.video-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 15;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top-color: #3b82f6;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Bass Boost Slider Styling */
.bass-boost-content input[type="range"] {
    -webkit-appearance: none;
    appearance: none;
    background: transparent;
    cursor: pointer;
}

.bass-boost-content input[type="range"]::-webkit-slider-track {
    background: rgba(255, 255, 255, 0.2);
    height: 6px;
    border-radius: 3px;
}

.bass-boost-content input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #3b82f6;
    cursor: pointer;
    margin-top: -5px;
    transition: all 0.2s ease;
}

.bass-boost-content input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.2);
    background: #60a5fa;
}

.bass-boost-content input[type="range"]::-moz-range-track {
    background: rgba(255, 255, 255, 0.2);
    height: 6px;
    border-radius: 3px;
}

.bass-boost-content input[type="range"]::-moz-range-thumb {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #3b82f6;
    cursor: pointer;
    border: none;
    transition: all 0.2s ease;
}

.bass-boost-content input[type="range"]::-moz-range-thumb:hover {
    transform: scale(1.2);
    background: #60a5fa;
}

.bass-boost-content input[type="range"]:disabled {
    cursor: not-allowed;
    opacity: 0.3;
}

.bass-boost-content input[type="range"]:disabled::-webkit-slider-thumb {
    cursor: not-allowed;
}

.bass-boost-content input[type="range"]:disabled::-moz-range-thumb {
    cursor: not-allowed;
}

/* Player buttons (for additional control elements) */
.player-btn {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.player-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.4);
    transform: translateY(-1px);
}

.player-btn:active {
    transform: translateY(0);
}

.player-btn.primary {
    background: rgba(59, 130, 246, 0.9);
    border-color: rgba(59, 130, 246, 1);
}

.player-btn.primary:hover {
    background: rgba(59, 130, 246, 1);
}

/* Hidden class utility */
.hidden {
    display: none !important;
}

/* Fullscreen styles */
.custom-video-player:fullscreen {
    width: 100vw;
    height: 100vh;
}

.custom-video-player:-webkit-full-screen {
    width: 100vw;
    height: 100vh;
}

.custom-video-player:-moz-full-screen {
    width: 100vw;
    height: 100vh;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .time-display {
        font-size: 12px;
    }
    
    .control-btn svg {
        width: 20px;
        height: 20px;
    }
    
    .play-btn svg {
        width: 24px;
        height: 24px;
    }
    
    .big-play-btn {
        width: 60px;
        height: 60px;
    }
    
    .big-play-btn svg {
        width: 30px;
        height: 30px;
    }
    
    .controls-left:hover .volume-slider-container {
        width: 60px;
    }
    
    .volume-slider {
        width: 60px;
    }
}

/* Double-Tap Skip Feedback */
.skip-feedback {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 40%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
    z-index: 20;
}

.skip-feedback-left {
    left: 0;
    background: linear-gradient(to right, rgba(0, 0, 0, 0.6), transparent);
}

.skip-feedback-right {
    right: 0;
    background: linear-gradient(to left, rgba(0, 0, 0, 0.6), transparent);
}

.skip-feedback.skip-feedback-show {
    opacity: 1;
    animation: skipPulse 0.4s ease-out;
}

@keyframes skipPulse {
    0% {
        transform: translateY(-50%) scale(0.8);
    }
    50% {
        transform: translateY(-50%) scale(1.1);
    }
    100% {
        transform: translateY(-50%) scale(1);
    }
}

.skip-feedback .skip-icon {
    width: 48px;
    height: 48px;
    color: rgba(255, 255, 255, 0.95);
    filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.5));
}

.skip-feedback .skip-text {
    font-size: 20px;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.95);
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
    letter-spacing: 0.5px;
}

/* Mobile responsive adjustments */
@media (max-width: 768px) {
    .skip-feedback .skip-icon {
        width: 40px;
        height: 40px;
    }
    
    .skip-feedback .skip-text {
        font-size: 18px;
    }
}

@media (max-width: 480px) {
    .skip-feedback .skip-icon {
        width: 36px;
        height: 36px;
    }
    
    .skip-feedback .skip-text {
        font-size: 16px;
    }
}
