:root {
    --primary-color: #ff0000;
    --accent-color: #007bff;
    --bg-body: linear-gradient(135deg, #e0eafc 0%, #cfdef3 100%);
    --bg-card: #ffffff;
    --bg-header: rgba(255, 255, 255, 0.95);
    --text-main: #333333;
    --text-sub: #777777;
    --border-color: #eeeeee;
    --hover-bg: #f0f0f0;
    --shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
}

body.dark-mode {
    --bg-body: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
    --bg-card: #1e293b;
    --bg-header: rgba(30, 41, 59, 0.95);
    --text-main: #f1f5f9;
    --text-sub: #94a3b8;
    --border-color: #334155;
    --hover-bg: #334155;
    --shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: var(--text-main);
    background: var(--bg-body);
    height: 100vh;
    overflow: hidden; 
    transition: background 0.3s, color 0.3s;
}

.container {
    width: 100%;
    max-width: 100%;
    height: 100%;
    margin: 0 auto;
    padding: 15px;
    display: flex;
    flex-direction: column;
}

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 25px;
    margin-bottom: 15px;
    background: var(--bg-header);
    border-radius: 16px;
    box-shadow: var(--shadow);
    backdrop-filter: blur(10px);
    flex-shrink: 0;
}

.logo-group { display: flex; align-items: center; gap: 15px; }
.nvt-logo { width: 80px; height: auto; transition: transform 0.3s; }
.nvt-logo:hover { transform: scale(1.1); }
h1 { font-size: 1.4rem; color: var(--primary-color); margin: 0; }

.header-controls { display: flex; gap: 15px; align-items: center; flex-grow: 1; justify-content: flex-end; max-width: 600px; }
.search-container { display: flex; flex-grow: 1; position: relative; }
#search-input { width: 100%; padding: 10px 20px; border: 2px solid transparent; border-radius: 50px; font-size: 15px; background: var(--hover-bg); color: var(--text-main); outline: none; transition: all 0.3s; }
#search-input:focus { background: var(--bg-card); border-color: var(--primary-color); box-shadow: 0 0 0 3px rgba(255, 0, 0, 0.1); }
#search-button { position: absolute; right: 5px; top: 50%; transform: translateY(-50%); width: 34px; height: 34px; border-radius: 50%; border: none; background: var(--primary-color); color: white; cursor: pointer; transition: 0.3s; }
#search-button:hover { background: #cc0000; transform: translateY(-50%) scale(1.05); }
#theme-toggle { width: 40px; height: 40px; border-radius: 50%; border: none; background: var(--bg-card); color: var(--text-main); font-size: 1.1rem; cursor: pointer; box-shadow: var(--shadow); transition: 0.3s; display: flex; align-items: center; justify-content: center; }
#theme-toggle:hover { transform: rotate(15deg); background: var(--hover-bg); }

/* --- GRID 3 CỘT --- */
main {
    display: grid;
    grid-template-columns: repeat(3, 1fr); /* 3 cột bằng nhau */
    gap: 20px;
    flex: 1;
    overflow: hidden;
    min-height: 0;
}

.col-player, .col-search, .col-recs { height: 100%; overflow: hidden; display: flex; flex-direction: column; }
.card { background: var(--bg-card); border-radius: 16px; padding: 20px; box-shadow: var(--shadow); border: 1px solid var(--border-color); transition: background 0.3s, border 0.3s; height: 100%; display: flex; flex-direction: column; overflow: hidden; }
.card-header { display: flex; justify-content: space-between; align-items: center; border-bottom: 2px solid var(--border-color); padding-bottom: 10px; margin-bottom: 10px; flex-shrink: 0; }
h3 { color: var(--text-main); margin: 0; font-size: 1.1rem; }
.btn-text { background: none; border: none; color: var(--text-sub); cursor: pointer; font-size: 0.9rem; }
.btn-text:hover { color: var(--primary-color); }
ul { list-style: none; flex: 1; overflow-y: auto; padding-right: 5px; min-height: 0; }

.player-container { text-align: center; justify-content: center; }
.disk-wrapper { width: 200px; height: 200px; margin: 0 auto 10px; border-radius: 50%; overflow: hidden; box-shadow: 0 10px 30px rgba(0,0,0,0.2); animation: rotate 20s linear infinite; animation-play-state: paused; border: 4px solid var(--bg-card); position: relative; flex-shrink: 0; }
.disk-wrapper.playing { animation-play-state: running; }
.disk-wrapper::after { content: ''; position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); width: 30px; height: 30px; background: var(--bg-card); border-radius: 50%; z-index: 2; }
@keyframes rotate { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
#current-thumbnail { width: 100%; height: 100%; object-fit: cover; }
.track-info { margin-bottom: 5px; }
.track-info h2 { font-size: 1.1rem; margin-bottom: 5px; color: var(--text-main); }
.track-info p { color: var(--text-sub); font-size: 0.9rem; margin-bottom: 5px; }

#visualizer { width: 100%; height: 60px; margin: 10px 0; border-radius: 8px; background: transparent; }

.controls { margin-top: auto; width: 100%; }
.progress-area { width: 100%; height: 6px; background: var(--border-color); border-radius: 5px; margin: 5px 0 8px; cursor: pointer; position: relative; transition: height 0.2s; }
.progress-area:hover { height: 8px; }
#progress-bar { width: 0%; height: 100%; background: var(--primary-color); border-radius: 5px; position: relative; }
#progress-bar::after { content: ''; position: absolute; right: -6px; top: 50%; transform: translateY(-50%) scale(0); width: 12px; height: 12px; background: var(--primary-color); border-radius: 50%; transition: transform 0.2s; box-shadow: 0 0 5px rgba(0,0,0,0.2); }
.progress-area:hover #progress-bar::after { transform: translateY(-50%) scale(1); }
.time-container { display: flex; justify-content: space-between; font-size: 0.8rem; color: var(--text-sub); font-weight: 500; margin-bottom: 15px; }
.buttons { display: flex; justify-content: center; gap: 20px; }
.btn-control { width: 45px; height: 45px; border-radius: 50%; border: none; background: var(--hover-bg); color: var(--text-main); font-size: 16px; cursor: pointer; transition: 0.2s; }
.btn-control:hover:not(:disabled) { background: var(--primary-color); color: white; transform: scale(1.1); }
.btn-main { width: 55px; height: 55px; font-size: 20px; background: var(--primary-color); color: white; }
.btn-main:hover { background: #d00000; }
.btn-control:disabled { opacity: 0.5; cursor: not-allowed; }

.video-item { display: flex; align-items: center; padding: 10px; border-radius: 10px; cursor: pointer; transition: 0.2s; margin-bottom: 6px; border: 1px solid transparent; }
.video-item:hover { background: var(--hover-bg); border-color: var(--border-color); }
.video-item.active { background: rgba(255, 0, 0, 0.1); border-color: var(--primary-color); }
.video-thumbnail { width: 90px; height: 50px; border-radius: 6px; overflow: hidden; margin-right: 12px; flex-shrink: 0; position: relative; }
.video-thumbnail img { width: 100%; height: 100%; object-fit: cover; }
.video-duration { position: absolute; bottom: 3px; right: 3px; background-color: rgba(0, 0, 0, 0.85); color: #fff; font-size: 10px; padding: 2px 4px; border-radius: 3px; font-weight: 600; line-height: 1; }
.video-info h4 { font-size: 0.9rem; margin-bottom: 3px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; color: var(--text-main); }
.video-info p { font-size: 0.75rem; color: var(--text-sub); }

::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-thumb { background: #ccc; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #aaa; }
body.dark-mode ::-webkit-scrollbar-thumb { background: #475569; }

@media (max-width: 900px) {
    body { height: auto; overflow: auto; }
    .container { height: auto; display: block; }
    main { display: flex; flex-direction: column; height: auto; }
    .col-player, .col-search, .col-recs { height: auto; overflow: visible; margin-bottom: 20px; }
    .card { height: auto; }
    ul { max-height: 400px; }
    header { flex-direction: column; gap: 15px; padding: 15px; }
    .header-controls { width: 100%; }
    .logo-group h1 { display: none; }
}

/* --- Volume Control Styles --- */
.volume-box {
    display: flex;
    align-items: center;
    gap: 5px;
    margin-left: 10px;
    transition: 0.3s;
}

#volume-slider {
    width: 60px;
    height: 4px;
    accent-color: var(--primary-color);
    cursor: pointer;
    background: transparent;
}

#mute-button {
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
}

#mute-button i {
    font-size: 1rem;
    color: var(--text-sub);
    transition: color 0.2s;
}

#mute-button:hover i {
    color: var(--primary-color);
}