:root {
    --primary-color: #8b5cf6; /* Violet */
    --primary-glow: rgba(139, 92, 246, 0.5);
    --bg-dark: #000;
    --text-white: #fff;
    --glass-bg: rgba(20, 20, 20, 0.7);
    --font-main: 'Inter', sans-serif;
}

* {
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    margin: 0;
    padding: 0;
    background-color: #0f0f0f;
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    font-family: var(--font-main);
    overflow: hidden;
}

/* --- Container --- */
.player-wrapper {
    width: 100%;
    height: 100%;
    position: relative;
    background: #000;
    overflow: hidden;
}

/* --- Video.js Engine Reset --- */
.video-js {
    width: 100% !important;
    height: 100% !important;
}

.video-js .vjs-control-bar,
.video-js .vjs-big-play-button,
.video-js .vjs-loading-spinner {
    display: none !important; /* Hide Default UI */
}

/* --- Custom UI Overlay --- */
.custom-ui {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none; /* Let clicks pass through to gesture layer */
    z-index: 10;
    opacity: 1;
    transition: opacity 0.3s ease;
    font-size: 16px !important; /* Reset font size to prevent Video.js inheritance issues */
    line-height: normal !important;
}

.custom-ui.ui-hidden {
    opacity: 0;
    pointer-events: none;
}

/* --- Gesture Layer --- */
.gesture-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%; /* Cover full screen to avoid dead zones */
    z-index: 100; /* Higher than controls when UI is hidden */
    pointer-events: auto; /* Catch clicks */
    cursor: pointer;
    -webkit-tap-highlight-color: transparent; /* Remove tap highlight on mobile */
    touch-action: manipulation; /* Disable browser double-tap zoom for instant click response */
}

/* When UI is VISIBLE, lower gesture layer so controls can be clicked */
.custom-ui:not(.ui-hidden) ~ .gesture-layer,
/* Note: We need to handle this via JS or structure. 
   Since gesture-layer is sibling/child, let's adjust z-index based on UI state class on parent or body.
   Actually, simpler approach: 
   Let gesture layer always be on top, but pass clicks through to controls? No, controls need to be clickable.
   
   Better Strategy:
   1. UI HIDDEN: Gesture Layer z-index = 100 (Covers everything, catches all taps to show UI)
   2. UI VISIBLE: Gesture Layer z-index = 1 (Behind controls, handles background taps)
*/

.custom-ui.ui-hidden {
    opacity: 0;
    pointer-events: none; /* Disables UI interaction, but we need gesture layer to be active */
}

/* --- Center Controls --- */
.center-controls {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 50; /* High Z-Index */
    pointer-events: none;
    display: flex;
    align-items: center;
    justify-content: center;
    filter: drop-shadow(0 0 20px rgba(139, 92, 246, 0.4));
}

@keyframes pulse-ring {
    0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(139, 92, 246, 0.7); }
    70% { transform: scale(1); box-shadow: 0 0 0 20px rgba(139, 92, 246, 0); }
    100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(139, 92, 246, 0); }
}

.big-play-btn {
    background: rgba(109, 40, 217, 0.9); /* Solid Violet with slight transparency for glass feel */
    background: radial-gradient(circle at 30% 30%, #a78bfa, #7c3aed);
    border: none;
    border-radius: 50%;
    width: 90px;
    height: 90px;
    color: white;
    font-size: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 10px 25px rgba(0,0,0,0.5), inset 0 0 0 2px rgba(255,255,255,0.2);
    cursor: pointer;
    pointer-events: auto;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    animation: pulse-ring 2s infinite;
    visibility: visible !important;
    opacity: 1 !important;
}

.big-play-btn i {
    font-size: 45px;
    margin-left: 5px; /* Visual optical adjustment */
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.3));
}

.big-play-btn.hidden {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
    animation: none;
}

.big-play-btn:hover {
    transform: scale(1.15);
    background: linear-gradient(135deg, #a78bfa, #7c3aed);
    box-shadow: 0 20px 50px rgba(109, 40, 217, 0.7);
}

.big-play-btn:active {
    transform: scale(0.95);
    animation: none;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(255,255,255,0.3);
    border-top: 4px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    position: absolute;
}

.hidden { display: none !important; }

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

/* --- Seek Overlays --- */
.seek-overlay {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 40%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255,255,255,0.1);
    opacity: 0;
    transition: opacity 0.2s;
    z-index: 15;
    pointer-events: none;
}

.seek-overlay.left { left: 0; border-radius: 0 50% 50% 0; }
.seek-overlay.right { right: 0; border-radius: 50% 0 0 50%; }

.seek-overlay.active { opacity: 1; }

.icon-box {
    background: rgba(0,0,0,0.5);
    padding: 15px;
    border-radius: 50%;
    text-align: center;
    color: white;
}
.icon-box i { display: block; font-size: 24px; margin-bottom: 5px; }
.icon-box span { font-size: 12px; font-weight: 600; }


/* --- Bottom Controls Panel --- */
.bottom-controls {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(to top, rgba(0,0,0,0.9), rgba(0,0,0,0.6) 50%, rgba(0,0,0,0));
    padding: 40px 20px 20px 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    z-index: 20;
    pointer-events: auto;
    transition: transform 0.3s ease;
}

.custom-ui.ui-hidden .bottom-controls {
    transform: translateY(100%);
}

/* Row 1: Time */
.time-row {
    font-size: 13px;
    color: #ccc;
    font-weight: 500;
    display: flex;
    gap: 5px;
    user-select: none;
}

/* Row 2: Progress */
.progress-row {
    width: 100%;
    height: 20px;
    display: flex;
    align-items: center;
}

.progress-container {
    width: 100%;
    height: 4px;
    background: rgba(255,255,255,0.2);
    border-radius: 2px;
    position: relative;
    cursor: pointer;
    transition: height 0.2s;
}

.progress-container:hover { height: 6px; }

.progress-bar {
    height: 100%;
    background: var(--primary-color);
    width: 0%;
    border-radius: 2px;
    position: relative;
    z-index: 2;
}

.progress-handle {
    width: 12px;
    height: 12px;
    background: white;
    border-radius: 50%;
    position: absolute;
    right: -6px;
    top: 50%;
    transform: translateY(-50%) scale(0);
    transition: transform 0.2s;
    box-shadow: 0 0 10px rgba(0,0,0,0.5);
}

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

.buffered-bar {
    height: 100%;
    background: rgba(255,255,255,0.3);
    width: 0%;
    position: absolute;
    top: 0;
    left: 0;
    z-index: 1;
    border-radius: 2px;
}

/* Row 3: Buttons */
.buttons-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.left-buttons, .right-buttons {
    display: flex;
    align-items: center;
    gap: 15px;
}

.control-btn {
    background: none;
    border: none;
    color: white;
    font-size: 32px !important; /* Optimized Desktop Size */
    width: 45px !important;
    height: 45px !important;
    cursor: pointer;
    padding: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.9;
    transition: all 0.2s;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.5));
}

.control-btn i {
    font-size: 32px !important; /* Optimized Icon Size */
    line-height: 1 !important;
    display: block;
    width: 100%;
    height: auto;
}


.control-btn:hover {
    opacity: 1;
    color: var(--primary-color);
    transform: scale(1.15);
}

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

#volume-slider {
    width: 0;
    opacity: 0;
    transition: all 0.3s;
    appearance: none;
    height: 4px;
    background: rgba(255,255,255,0.3);
    border-radius: 2px;
}

.volume-container:hover #volume-slider {
    width: 60px;
    opacity: 1;
}

#volume-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 10px;
    height: 10px;
    background: white;
    border-radius: 50%;
    cursor: pointer;
}

/* Mobile Adjustments */
@media (max-width: 768px) {
    .bottom-controls {
        left: 0;
        right: 0;
        bottom: 0;
        padding: 30px 10px 10px 10px; /* Reduced padding for more space */
    }
    
    .big-play-btn { 
        width: 70px !important; 
        height: 70px !important; 
        font-size: 35px !important; 
    }
    
    .volume-container input { display: none; } /* Hide volume slider on mobile */
    
    .control-btn { 
        font-size: 26px !important; /* Optimized Mobile Size */
        width: 40px !important;
        height: 40px !important;
        padding: 0; /* Remove padding to save space */
    }
    
    .control-btn i {
        font-size: 26px !important;
    }

    /* Better spacing for controls */
    .controls-left, .right-buttons {
        gap: 10px;
    }
}

/* --- Settings Menu --- */
.settings-menu {
    position: absolute;
    bottom: 90px;
    right: 20px;
    background: rgba(20, 20, 20, 0.95);
    width: 180px; /* Reduced Width */
    border-radius: 12px;
    overflow: hidden;
    z-index: 30;
    pointer-events: auto;
    box-shadow: 0 5px 15px rgba(0,0,0,0.5);
    border: 1px solid rgba(255,255,255,0.1);
}

.settings-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 12px; /* Reduced Padding */
    border-bottom: 1px solid rgba(255,255,255,0.1);
    background: rgba(255,255,255,0.05);
}

.settings-header span {
    font-weight: 600;
    font-size: 13px; /* Reduced Font */
    color: white;
}

.close-btn {
    background: none;
    border: none;
    color: #aaa;
    cursor: pointer;
    font-size: 16px; /* Reduced Size */
    padding: 0;
    display: flex;
}
.close-btn:hover { color: white; }

.speed-options {
    list-style: none;
    padding: 0;
    margin: 0;
}

.speed-options li {
    padding: 8px 12px; /* Reduced Padding */
    cursor: pointer;
    font-size: 12px; /* Reduced Font */
    color: #ddd;
    transition: background 0.2s;
    display: flex;
    justify-content: space-between;
}


.speed-options li:hover {
    background: rgba(255,255,255,0.1);
    color: white;
}

.speed-options li.active {
    color: var(--primary-color);
    font-weight: 600;
}

.speed-options li.active::after {
    content: '✓';
}

/* Mobile Adjustments for Settings */
@media (max-width: 768px), (max-height: 450px) {
    .settings-menu {
        bottom: 60px; /* Positioned above bottom controls */
        right: 10px;
        left: auto;
        transform: none;
        width: 160px; /* More compact width */
        max-height: 60%; /* Prevent overflowing height */
        overflow-y: auto; /* Scroll if needed */
        background: rgba(20, 20, 20, 0.85); /* Slightly transparent */
        backdrop-filter: blur(10px); /* Glassy feel */
        border: 1px solid rgba(255, 255, 255, 0.1);
    }
    
    .settings-header {
        padding: 8px 10px;
    }
    
    .speed-options li {
        padding: 8px 10px;
        font-size: 13px;
    }
}

/* --- Resume Modal --- */
.resume-modal {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.6); /* Darker overlay */
    backdrop-filter: blur(5px); /* Blur background behind modal */
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 50;
    pointer-events: auto;
    opacity: 1;
    transition: opacity 0.3s ease;
}

.resume-modal.hidden {
    opacity: 0;
    pointer-events: none;
}

.resume-content {
    background: rgba(30, 30, 30, 0.65); /* Glassy Background */
    backdrop-filter: blur(15px); /* Strong blur for premium feel */
    -webkit-backdrop-filter: blur(15px);
    padding: 30px;
    border-radius: 20px;
    text-align: center;
    width: 90%;
    max-width: 380px;
    box-shadow: 0 15px 40px rgba(0,0,0,0.4), inset 0 0 0 1px rgba(255,255,255,0.1); /* Glow & Depth */
    border: 1px solid rgba(255,255,255,0.15); /* Subtle border */
}

.resume-content h3 {
    margin: 0 0 8px 0;
    color: white;
    font-size: 20px;
    font-weight: 600;
    letter-spacing: 0.5px;
    text-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.resume-content p {
    color: rgba(255, 255, 255, 0.8);
    margin: 0 0 25px 0;
    font-size: 14px;
    line-height: 1.5;
}

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

.resume-btn {
    padding: 10px 24px;
    border-radius: 50px; /* Pill shape for premium look */
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    font-family: var(--font-main);
    letter-spacing: 0.5px;
}

.resume-btn.primary {
    background: linear-gradient(135deg, var(--primary-color), #7c3aed);
    border: none;
    color: white;
    box-shadow: 0 4px 15px rgba(139, 92, 246, 0.4);
}

.resume-btn.primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(139, 92, 246, 0.5);
    filter: brightness(1.1);
}

.resume-btn.secondary {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255,255,255,0.1);
    color: #eee;
    backdrop-filter: blur(5px);
}

.resume-btn.secondary:hover {
    background: rgba(255,255,255,0.2);
    border-color: rgba(255,255,255,0.3);
    color: white;
    transform: translateY(-2px);
}

/* Mobile & Small Screen Adjustments for Resume Modal */
@media (max-width: 768px), (max-height: 450px) {
    .resume-content {
        padding: 20px 15px;
        width: 85%;
        max-width: 300px;
        border-radius: 12px;
    }
    
    .resume-content h3 {
        font-size: 18px;
        margin-bottom: 8px;
    }
    
    .resume-content p {
        font-size: 13px;
        margin-bottom: 15px;
    }
    
    .resume-btn {
        padding: 8px 16px;
        font-size: 13px;
        border-radius: 6px;
    }
    
    .resume-actions {
        gap: 10px;
    }
}
