/* --- Base Container --- */
.nuf-player-container {
    position: relative;
    display: flex;
    flex-direction: row;
    width: 100%;
    max-width: 1300px;
    min-height: 450px;
    margin: 0 auto;
    background: #0f111a;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0,0,0,0.7);
    font-family: 'Segoe UI', Tahoma, Geneva, sans-serif;
    color: #ffffff;
}

/* --- Main Video Area --- */
.nuf-main-video-area {
    width: 70%; /* Fixed Width */
    aspect-ratio: 16 / 9; /* Perfect 16:9 ratio for PC */
    position: relative;
    background: #000;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.nuf-main-video-area.hide-ui { cursor: none; }
#nuf-video { width: 100%; height: 100%; object-fit: contain; display: block; }

/* --- FULLSCREEN FIXES --- */
.nuf-main-video-area:-webkit-full-screen { background: #000; justify-content: center; }
.nuf-main-video-area:fullscreen { background: #000; justify-content: center; }
.nuf-main-video-area:-webkit-full-screen #nuf-video { max-height: 100vh; object-fit: contain; }
.nuf-main-video-area:fullscreen #nuf-video { max-height: 100vh; object-fit: contain; }

/* --- OSD (On-Screen Display) --- */
.nuf-osd { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%) scale(1.5); background: rgba(0, 0, 0, 0.6); backdrop-filter: blur(5px); color: #fff; padding: 15px 25px; border-radius: 50px; display: flex; align-items: center; gap: 12px; font-size: 22px; font-weight: bold; opacity: 0; visibility: hidden; transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275); pointer-events: none; z-index: 10; }
.nuf-osd.show { opacity: 1; visibility: visible; transform: translate(-50%, -50%) scale(1); }

/* --- Controls Pro UI --- */
.nuf-controls { position: absolute; bottom: 0; left: 0; width: 100%; background: linear-gradient(to top, rgba(0,0,0,0.9) 0%, rgba(0,0,0,0.6) 50%, transparent 100%); display: flex; flex-direction: column; padding: 10px 15px; transition: opacity 0.4s ease-in-out, visibility 0.4s ease-in-out, transform 0.4s ease-in-out; opacity: 1; visibility: visible; transform: translateY(0); z-index: 5; }
.nuf-main-video-area.hide-ui .nuf-controls { opacity: 0; visibility: hidden; transform: translateY(20px); }

/* =========================================
   CUSTOM RANGE SLIDERS (0% to 100% PERFECT FIX)
   ========================================= */
.nuf-controls input[type="range"] {
    -webkit-appearance: none !important;
    appearance: none !important;
    background: transparent !important;
    padding: 0 !important;
    margin: 0 !important;
    border: none !important;
    box-shadow: none !important;
    outline: none !important;
}

/* --- Progress Bar --- */
.nuf-progress-container { width: 100%; margin-bottom: 8px; }
#nuf-progress-bar {
    width: 100%; cursor: pointer;
    --progress: 0;
    --thumb-width: 14px;
    --fill-pos: calc(var(--thumb-width) / 2 + var(--progress) * (100% - var(--thumb-width)) / 100);
}
#nuf-progress-bar::-webkit-slider-runnable-track { height: 4px; background: linear-gradient(to right, #e50914 var(--fill-pos), rgba(255,255,255,0.2) var(--fill-pos)); border-radius: 2px; }
#nuf-progress-bar::-moz-range-track { height: 4px; background: linear-gradient(to right, #e50914 var(--fill-pos), rgba(255,255,255,0.2) var(--fill-pos)); border-radius: 2px; }
#nuf-progress-bar::-webkit-slider-thumb { -webkit-appearance: none; height: 14px; width: 14px; background: #e50914; border-radius: 50%; margin-top: -5px; cursor: pointer; transition: transform 0.1s; }
#nuf-progress-bar::-moz-range-thumb { height: 14px; width: 14px; background: #e50914; border: none; border-radius: 50%; cursor: pointer; }
#nuf-progress-bar:hover::-webkit-slider-thumb { transform: scale(1.2); }

/* --- Volume Bar --- */
.nuf-volume-area { display: flex; align-items: center; gap: 8px; color: #ffffff; }
#nuf-volume-bar {
    width: 60px; cursor: pointer;
    --volume: 100; --thumb-width: 12px;
    --fill-pos: calc(var(--thumb-width) / 2 + var(--volume) * (100% - var(--thumb-width)) / 100);
}
#nuf-volume-bar::-webkit-slider-runnable-track { height: 4px; background: linear-gradient(to right, #ffffff var(--fill-pos), rgba(255,255,255,0.2) var(--fill-pos)); border-radius: 2px; }
#nuf-volume-bar::-moz-range-track { height: 4px; background: linear-gradient(to right, #ffffff var(--fill-pos), rgba(255,255,255,0.2) var(--fill-pos)); border-radius: 2px; }
#nuf-volume-bar::-webkit-slider-thumb { -webkit-appearance: none; height: 12px; width: 12px; background: #ffffff; border-radius: 50%; margin-top: -4px; cursor: pointer; }
#nuf-volume-bar::-moz-range-thumb { height: 12px; width: 12px; background: #ffffff; border: none; border-radius: 50%; cursor: pointer; }

/* --- Other UI Elements --- */
.nuf-controls-bottom { display: flex; justify-content: space-between; align-items: center; width: 100%; }
.nuf-controls-left, .nuf-controls-right { display: flex; align-items: center; gap: 15px; }

.nuf-controls button, .nuf-download-btn { background: transparent; border: none; color: #ffffff; cursor: pointer; font-size: 16px; display: flex; align-items: center; justify-content: center; transition: color 0.2s, transform 0.1s; outline: none; }
.nuf-controls button:hover, .nuf-download-btn:hover { color: #4db8ff; transform: scale(1.1); }
.nuf-time-display { color: #eeeeee; font-size: 13px; cursor: pointer; user-select: none; font-family: monospace; min-width: 95px; }
.nuf-time-display:hover { color: #ffffff; }
.nuf-spinner-anim { animation: spin 1s linear infinite; }
@keyframes spin { 100% { transform: rotate(360deg); } }

/* =========================================
   PLAYLIST SIDEBAR (SCROLL FIX APPLIED)
   ========================================= */
.nuf-playlist-sidebar {
    position: absolute; /* This detaches it so it doesn't stretch the video area */
    right: 0;
    top: 0;
    bottom: 0;
    width: 30%; /* Fixed Width */
    background: #151822;
    color: #ffffff;
    display: flex;
    flex-direction: column;
    border-left: 1px solid rgba(255,255,255,0.05);
}

.nuf-playlist-header { padding: 15px 20px; display: flex; justify-content: space-between; align-items: center; background: #1a1e29; border-bottom: 1px solid rgba(255,255,255,0.05); }
.nuf-playlist-header h3 { margin: 0; font-size: 16px; font-weight: 500; }
.playlist-icons i { cursor: pointer; margin-left: 10px; color: #aaaaaa; transition: color 0.2s; }
.playlist-icons i:hover { color: #ffffff; }

.nuf-playlist-items {
    flex: 1; /* Takes available space below header */
    overflow-y: auto; /* Enables scrolling */
    min-height: 0; /* Important trick to keep scrolling contained */
}

/* Custom Scrollbar */
.nuf-playlist-items::-webkit-scrollbar { width: 6px; }
.nuf-playlist-items::-webkit-scrollbar-track { background: #151822; }
.nuf-playlist-items::-webkit-scrollbar-thumb { background: #3a3f52; border-radius: 4px; }
.nuf-playlist-items::-webkit-scrollbar-thumb:hover { background: #4db8ff; }

.nuf-playlist-item { display: flex; align-items: center; padding: 12px 20px; gap: 15px; cursor: pointer; border-bottom: 1px solid rgba(255,255,255,0.03); transition: background 0.2s; }
.nuf-playlist-item:hover, .nuf-playlist-item.active { background: rgba(255, 255, 255, 0.08); }
.nuf-playlist-item.active h4 { color: #4db8ff; }
.nuf-item-number { font-size: 12px; color: #777777; min-width: 15px; }
.nuf-item-thumb img { width: 80px; height: 45px; object-fit: cover; border-radius: 4px; box-shadow: 0 2px 5px rgba(0,0,0,0.5); }
.nuf-item-details h4 { margin: 0; font-size: 14px; line-height: 1.4; font-weight: normal; color: #dddddd; }

/* =========================================
   MOBILE RESPONSIVE (SCROLL FIX APPLIED)
   ========================================= */
@media (max-width: 900px) {
    .nuf-player-container { 
        display: block; /* Stacks items vertically */
    }
    
    .nuf-main-video-area { 
        width: 100%; 
        aspect-ratio: 16 / 9; /* Keeps video proportional */
    }
    
    .nuf-playlist-sidebar { 
        position: relative; /* Brings it back to normal flow below video */
        width: 100%; 
        height: 350px; /* Fixed height for scrolling on mobile */
        border-left: none; 
        border-top: 2px solid #000; 
    }
    
    .nuf-controls { padding: 8px 10px; }
    .nuf-volume-area { display: none; }
    .nuf-controls-left, .nuf-controls-right { gap: 10px; }
}