/* --- GLOBAL RESET --- */
body, html {
    margin: 0; padding: 0; width: 100%; height: 100%;
    background-color: #000;
    font-family: "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    overflow: hidden; color: #eee;
    user-select: none;
}

/* --- LAYERS --- */
#player-wrapper {
    position: absolute; top: 0; left: 0; width: 100vw; height: 100vh;
    z-index: 1; background: #000;
}
#video-placeholder { width: 100%; height: 100%; }

/* --- UI COMPONENTS --- */

#toast-msg {
    position: absolute; top: 50px; left: 50%; transform: translateX(-50%);
    background: rgba(20, 20, 20, 0.9); border: 1px solid #333; color: white;
    padding: 10px 25px; border-radius: 30px; font-weight: bold;
    z-index: 50; opacity: 0; transition: opacity 0.5s; pointer-events: none;
    box-shadow: 0 5px 20px rgba(0,0,0,0.5);
}

#center-overlay {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    z-index: 30; background: rgba(0, 0, 0, 0.95);
    display: flex; flex-direction: column; justify-content: center; align-items: center;
    transition: opacity 0.3s ease, visibility 0.3s;
}
#center-overlay.hidden { opacity: 0; visibility: hidden; pointer-events: none; }

.input-box {
    background: #1a1a1a; padding: 40px; border-radius: 16px;
    border: 1px solid #333; text-align: center; width: 90%; max-width: 550px;
    box-shadow: 0 30px 60px rgba(0,0,0,0.8);
}

.input-row { display: flex; gap: 10px; margin-bottom: 20px; }
.url-field { flex: 2; padding: 15px; background: #000; border: 1px solid #444; color: white; font-size: 1rem; outline: none; border-radius: 6px; }
.quality-pre-select { flex: 1; padding: 15px; background: #222; border: 1px solid #444; color: white; font-size: 1rem; outline: none; border-radius: 6px; cursor: pointer; }

.load-btn {
    background: #cc0000; color: white; border: none; padding: 15px 30px;
    font-size: 1.1rem; font-weight: bold; border-radius: 6px; cursor: pointer;
    width: 100%; transition: background 0.2s;
}
.load-btn:hover { background: #ff0000; }

/* Playlist Drawer */
#playlist-drawer {
    position: absolute; top: 0; right: -340px; width: 320px; height: 100%;
    background: rgba(15, 15, 15, 0.96); backdrop-filter: blur(10px);
    z-index: 20; border-left: 1px solid #333;
    transition: right 0.4s cubic-bezier(0.25, 1, 0.5, 1);
    display: flex; flex-direction: column;
    box-shadow: -10px 0 30px rgba(0,0,0,0.5);
}
#playlist-drawer.open { right: 0; }

.playlist-header { padding: 20px; border-bottom: 1px solid #333; font-weight: bold; display: flex; justify-content: space-between; align-items: center; background: rgba(0,0,0,0.3); }
.close-drawer { cursor: pointer; font-size: 1.5rem; padding: 0 10px; }
.playlist-items { flex: 1; overflow-y: auto; padding: 10px; }
.playlist-items::-webkit-scrollbar { width: 6px; }
.playlist-items::-webkit-scrollbar-thumb { background: #444; border-radius: 3px; }

.track-item {
    display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: 6px;
    cursor: pointer; margin-bottom: 5px; transition: background 0.2s;
    background: rgba(255,255,255,0.02);
}
.track-item:hover { background: rgba(255,255,255,0.1); }
.track-item.active { background: rgba(204, 0, 0, 0.2); border: 1px solid rgba(204, 0, 0, 0.5); }
.track-thumb { width: 80px; height: 45px; object-fit: cover; border-radius: 4px; background: #000; }
.track-info { font-size: 0.85rem; color: #ccc; line-height: 1.2; }

/* Controls Layer */
#controls-layer {
    position: absolute; bottom: 0; left: 0; width: 100%; z-index: 10;
    background: linear-gradient(to top, rgba(0,0,0,0.95), transparent);
    padding: 20px 20px 30px 20px; box-sizing: border-box;
    transition: opacity 0.5s; display: flex; flex-direction: column; gap: 10px;
}

.progress-container { width: 100%; display: flex; align-items: center; cursor: pointer; height: 15px; }
input[type=range].scrubber { appearance: none; width: 100%; background: transparent; z-index: 2; cursor: pointer; }
input[type=range].scrubber::-webkit-slider-runnable-track { width: 100%; height: 4px; background: rgba(255,255,255,0.3); border-radius: 2px; }
input[type=range].scrubber::-webkit-slider-thumb {
    -webkit-appearance: none; height: 14px; width: 14px; border-radius: 50%;
    background: #f00; margin-top: -5px; transition: transform 0.1s;
}
input[type=range].scrubber:hover::-webkit-slider-thumb { transform: scale(1.3); }

.buttons-row { display: flex; align-items: center; justify-content: space-between; position: relative; }
.left-controls, .right-controls { display: flex; align-items: center; gap: 15px; }

button.icon-btn {
    background: transparent; border: none; color: white; cursor: pointer;
    display: flex; align-items: center; padding: 5px; opacity: 0.9;
}
button.icon-btn:hover { opacity: 1; }
button.icon-btn svg { width: 28px; height: 28px; fill: currentColor; }

.time-display { font-size: 0.9rem; font-family: monospace; color: #ddd; margin-left: 10px; }
#playlist-btn.active svg { fill: #cc0000; }

.volume-control { display: flex; align-items: center; gap: 5px; }
.vol-slider { width: 70px; accent-color: white; height: 3px; cursor: pointer; }

/* Live Clock */
.live-clock {
    position: absolute; left: 50%; transform: translateX(-50%);
    font-family: 'Courier New', Courier, monospace;
    font-size: 1.2rem; font-weight: bold; color: #eee;
    letter-spacing: 1px; text-shadow: 0 0 10px rgba(0,0,0,0.8);
    pointer-events: none;
}

/* Idle Logic */
body.idle #controls-layer { opacity: 0; }
body.idle { cursor: none; }