/* --- MATERIAL DESIGN VARIABLES --- */
:root {
    --primary-color: #d32f2f;     
    --primary-hover: #b71c1c;     
    
    --bg-dark: #121212;          
    --surface-dark: #1e1e1e;     
    --surface-dark-2: #2c2c2c;   
    
    --text-main: rgba(255, 255, 255, 0.87);
    --text-muted: rgba(255, 255, 255, 0.6);
    
    --shadow-elevation-1: 0 2px 4px -1px rgba(0,0,0,0.2), 0 4px 5px 0 rgba(0,0,0,0.14), 0 1px 10px 0 rgba(0,0,0,0.12);
    --shadow-elevation-2: 0 5px 5px -3px rgba(0,0,0,0.2), 0 8px 10px 1px rgba(0,0,0,0.14), 0 3px 14px 2px rgba(0,0,0,0.12);
}

body.light-mode {
    --primary-color: #d32f2f;
    --primary-hover: #b71c1c;
    --bg-dark: #f5f5f5;
    --surface-dark: #ffffff;
    --surface-dark-2: #e0e0e0;
    --text-main: rgba(0, 0, 0, 0.87);
    --text-muted: rgba(0, 0, 0, 0.6);
}

body {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    margin: 0;
    font-family: 'Roboto', sans-serif;
    color: var(--text-main);
    background-color: var(--bg-dark);
    transition: background-color 0.3s ease, color 0.3s ease;
}

.player-wrapper {
    display: flex;
    flex-direction: column;
    gap: 20px;
    background-color: var(--surface-dark);
    padding: 24px;
    border-radius: 8px;
    box-shadow: var(--shadow-elevation-2);
    max-width: 950px;
    width: 95%;
    transition: background-color 0.3s ease;
}

.top-controls {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.stream-input-container {
    display: flex;
    gap: 10px;
    width: 100%;
}

input[type="text"] {
    flex: 1;
    padding: 12px 16px;
    border-radius: 4px;
    border: 1px solid var(--surface-dark-2);
    background-color: var(--bg-dark);
    color: var(--text-main);
    font-size: 14px;
}

input[type="text"]:focus {
    outline: none;
    border-color: var(--primary-color);
}

.download-section {
    background-color: var(--surface-dark-2);
    padding: 12px;
    border-radius: 4px;
}

button {
    background-color: var(--primary-color);
    color: white;
    border: none;
    padding: 10px 24px;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    transition: background-color 0.2s, box-shadow 0.2s;
    box-shadow: var(--shadow-elevation-1);
}

button:hover {
    background-color: var(--primary-hover);
    box-shadow: var(--shadow-elevation-2);
}

.main-content {
    display: flex;
    gap: 24px;
    width: 100%;
}

.video-section {
    flex: 2.5;
    display: flex;
    flex-direction: column;
}

.video-container {
    background-color: #000;
    border-radius: 4px;
    overflow: hidden;
    position: relative;
    box-shadow: var(--shadow-elevation-1);
}

.controls {
    background: linear-gradient(transparent, rgba(0,0,0,0.8));
    position: absolute;
    bottom: 0;
    width: 100%;
    padding-top: 40px;
    opacity: 0;
    transition: opacity 0.3s ease;
}

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

.progress-container {
    width: 100%;
    height: 4px;
    background-color: rgba(255,255,255,0.3);
    cursor: pointer;
    position: relative;
    transition: height 0.1s ease;
}

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

.progress-filled {
    height: 100%;
    background-color: var(--primary-color);
    width: 0%;
    pointer-events: none;
}

.buttons {
    display: flex;
    gap: 16px;
    padding: 12px 20px 20px 20px;
    align-items: center;
}

button.icon-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    box-shadow: none;
    background-color: transparent;
}

button.icon-btn:hover {
    background-color: rgba(255,255,255,0.1);
    box-shadow: none;
}

#volume-slider {
    margin: 0 10px;
    cursor: pointer;
    accent-color: var(--primary-color);
}

#quality-selector {
    background-color: transparent;
    color: var(--text-main);
    border: 1px solid rgba(255, 255, 255, 0.2);
    padding: 6px 10px;
    border-radius: 4px;
    font-family: inherit;
    font-size: 13px;
    cursor: pointer;
    outline: none;
    transition: border-color 0.2s ease;
}

body.light-mode #quality-selector {
    border: 1px solid rgba(0, 0, 0, 0.2);
    color: #000;
}

#quality-selector:focus {
    border-color: var(--primary-color);
}

#quality-selector option {
    background-color: var(--surface-dark);
    color: var(--text-main);
}

body.light-mode #quality-selector option {
    background-color: var(--surface-dark);
    color: var(--text-main);
}

.playlist-container {
    flex: 1;
    background-color: var(--surface-dark-2);
    padding: 20px;
    border-radius: 4px;
    max-height: 450px;
    overflow-y: auto;
}

.playlist-container h3 {
    margin-top: 0;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    padding-bottom: 12px;
    font-size: 16px;
    text-transform: uppercase;
}

body.light-mode .playlist-container h3 {
    border-bottom: 1px solid rgba(0,0,0,0.1);
}

ul { list-style: none; padding: 0; margin: 0; }

li {
    padding: 12px 16px;
    background-color: transparent;
    margin-bottom: 4px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: background-color 0.2s;
}

li:hover {
    background-color: rgba(255,255,255,0.05);
}

body.light-mode li:hover {
    background-color: rgba(0,0,0,0.05);
}

li.active {
    background-color: rgba(211, 47, 47, 0.1);
    color: var(--primary-color);
    font-weight: 500;
}

#stats-overlay {
    position: absolute;
    top: 15px; left: 15px;
    background-color: rgba(0, 0, 0, 0.8);
    color: #fff;
    padding: 16px;
    border-radius: 4px;
    font-family: monospace;
    font-size: 13px;
    z-index: 10;
    pointer-events: none;
    display: none;
}

#stats-overlay.visible { display: block; }
#stats-overlay h4 { margin: 0 0 10px 0; border-bottom: 1px solid #555; padding-bottom: 5px; font-family: 'Roboto', sans-serif; }
#stats-overlay p { margin: 6px 0; }