* { box-sizing: border-box; margin: 0; padding: 0; }
:root {
    --bg: #14172b;
    --bg2: #1b1f38;
    --bg3: #232847;
    --line: #2e3350;
    --fg: #e6e9f5;
    --dim: #8b91b5;
    --accent: #e8b84b;
    --accent2: #4b9fe8;
}
html, body { height: 100%; }
body {
    background: var(--bg);
    color: var(--fg);
    font: 14px/1.45 -apple-system, "Segoe UI", Roboto, sans-serif;
}

#app {
    display: grid;
    grid-template: "top top" 56px "side main" 1fr "player player" auto / 280px 1fr;
    height: 100vh;
}

/* Topbar */
#topbar {
    grid-area: top;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 16px;
    background: var(--bg2);
    border-bottom: 1px solid var(--line);
}
.logo { font-size: 20px; font-weight: 700; letter-spacing: .5px; white-space: nowrap; }
.logo span { color: var(--accent); }
#search {
    flex: 1;
    max-width: 520px;
    background: var(--bg);
    border: 1px solid var(--line);
    border-radius: 8px;
    color: var(--fg);
    padding: 8px 12px;
    outline: none;
}
#search:focus { border-color: var(--accent2); }
#genreFilter {
    background: var(--bg);
    border: 1px solid var(--line);
    color: var(--fg);
    border-radius: 8px;
    padding: 8px;
    max-width: 180px;
}
.btn {
    border: 1px solid var(--line);
    background: var(--bg3);
    color: var(--fg);
    border-radius: 8px;
    padding: 8px 14px;
    cursor: pointer;
    text-decoration: none;
    font-size: 14px;
    white-space: nowrap;
}
.btn.accent { background: var(--accent); border-color: var(--accent); color: #1a1503; font-weight: 600; }
.btn.ghost:hover, .btn:hover { filter: brightness(1.12); }

/* Sidebar */
#sidebar { grid-area: side; background: var(--bg2); border-right: 1px solid var(--line); overflow: hidden; }
.side-scroll { height: 100%; overflow-y: auto; padding: 10px 8px 20px; }
.side-head {
    display: flex; justify-content: space-between; align-items: center;
    font-size: 11px; text-transform: uppercase; letter-spacing: 1px;
    color: var(--dim); padding: 14px 8px 4px;
}
.side-head button {
    background: var(--bg3); color: var(--fg); border: 1px solid var(--line);
    border-radius: 6px; width: 22px; height: 22px; cursor: pointer;
}
.side-item {
    display: flex; justify-content: space-between; align-items: center; gap: 6px;
    padding: 6px 8px; border-radius: 6px; cursor: pointer; color: var(--fg);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.side-item:hover { background: var(--bg3); }
.side-item.active { background: var(--bg3); color: var(--accent); }
.side-item .cnt { color: var(--dim); font-size: 11px; }
.side-item .pl-del { display: none; color: var(--dim); padding: 0 2px; }
.side-item.pl:hover .pl-del { display: inline; }
.side-item .pl-del:hover { color: #e86a5a; }
.side-empty { color: var(--dim); font-size: 12px; padding: 4px 8px; }

/* Liste */
#main { grid-area: main; display: flex; flex-direction: column; overflow: hidden; }
#listHead {
    display: flex; align-items: baseline; gap: 12px;
    padding: 14px 20px 8px;
}
#listHead h2 { font-size: 18px; }
#listInfo { color: var(--dim); font-size: 12px; }
#listWrap { flex: 1; overflow-y: auto; position: relative; }
#listSpacer { position: relative; }
#listRows { position: absolute; left: 0; right: 0; }
.row {
    display: flex; align-items: center; gap: 10px;
    height: 52px; padding: 0 20px;
    border-bottom: 1px solid rgba(46, 51, 80, .5);
}
.row:hover { background: var(--bg2); }
.row.playing { background: var(--bg3); }
.rplay {
    width: 32px; height: 32px; flex: none;
    border-radius: 50%; border: 1px solid var(--line);
    background: var(--bg3); color: var(--fg); cursor: pointer;
}
.row:hover .rplay, .row.playing .rplay { background: var(--accent); color: #1a1503; border-color: var(--accent); }
.rtitle { flex: 1; min-width: 0; }
.rtitle .t { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rtitle .s { color: var(--dim); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.badge {
    font-size: 10px; font-weight: 600; border-radius: 4px; padding: 1px 6px;
    vertical-align: 2px; margin-left: 4px;
}
.badge.lic { background: #2b4a2e; color: #9fe0a5; }
.badge.proj { background: #4a3a2b; color: #e0c49f; }
.rchips { display: flex; gap: 4px; flex: none; }
.chip {
    font-size: 11px; padding: 3px 8px; border-radius: 20px;
    background: var(--bg3); border: 1px solid var(--line);
    color: var(--dim); cursor: pointer; user-select: none;
}
.chip:hover { color: var(--fg); border-color: var(--accent2); }
.chip.on { background: var(--accent); border-color: var(--accent); color: #1a1503; font-weight: 600; }
.rdur { width: 44px; text-align: right; color: var(--dim); font-variant-numeric: tabular-nums; flex: none; }
.radd, .rdel {
    width: 28px; height: 28px; flex: none; border-radius: 6px;
    background: none; border: 1px solid transparent; color: var(--dim); cursor: pointer;
    visibility: hidden;
}
.row:hover .radd, .row:hover .rdel { visibility: visible; }
.radd:hover { color: var(--accent); border-color: var(--line); }
.rdel:hover { color: #e86a5a; border-color: var(--line); }

/* Player */
#player {
    grid-area: player;
    display: flex; align-items: center; gap: 16px;
    background: var(--bg2); border-top: 1px solid var(--line);
    padding: 10px 20px;
}
#player.hidden { display: none; }
#pInfo { width: 260px; flex: none; min-width: 0; }
#pTitle { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#pMeta { color: var(--dim); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#pControls { display: flex; gap: 6px; flex: none; }
#pControls button {
    width: 40px; height: 40px; border-radius: 50%;
    background: var(--bg3); border: 1px solid var(--line); color: var(--fg);
    cursor: pointer; font-size: 15px;
}
#pPlay { background: var(--accent) !important; color: #1a1503 !important; border-color: var(--accent) !important; }
#pWave { flex: 1; position: relative; min-width: 100px; }
#wave { width: 100%; height: 56px; display: block; cursor: pointer; }
#pTime {
    position: absolute; right: 4px; top: 0;
    font-size: 11px; color: var(--dim); background: rgba(20, 23, 43, .7);
    padding: 1px 5px; border-radius: 4px; pointer-events: none;
    font-variant-numeric: tabular-nums;
}
#pExtra { display: flex; align-items: center; gap: 10px; flex: none; }
#pAdd {
    width: 34px; height: 34px; border-radius: 8px;
    background: var(--bg3); border: 1px solid var(--line); color: var(--fg); cursor: pointer;
}
#pAdd:hover { color: var(--accent); }
#pVol { width: 90px; accent-color: var(--accent); }

/* Modals */
#modalBg {
    position: fixed; inset: 0; background: rgba(0, 0, 0, .55);
    display: flex; align-items: center; justify-content: center; z-index: 50;
}
#modalBg.hidden { display: none; }
.modal {
    background: var(--bg2); border: 1px solid var(--line); border-radius: 12px;
    width: min(480px, 92vw); padding: 20px;
}
.modal.hidden { display: none; }
.modal h3 { margin-bottom: 14px; }
.drop {
    display: block; border: 2px dashed var(--line); border-radius: 10px;
    padding: 18px; text-align: center; color: var(--dim); cursor: pointer; margin-bottom: 14px;
}
.drop.drag { border-color: var(--accent); color: var(--accent); }
.drop input { display: none; }
#upFileList { margin-top: 8px; font-size: 12px; color: var(--fg); text-align: left; max-height: 120px; overflow-y: auto; }
.form-row { margin-bottom: 12px; }
.form-row.inline { display: flex; gap: 8px; }
.form-row label { display: block; font-size: 12px; color: var(--dim); margin-bottom: 4px; }
.form-row label em { color: var(--accent); font-style: normal; }
.form-row input {
    width: 100%; background: var(--bg); border: 1px solid var(--line);
    border-radius: 8px; color: var(--fg); padding: 8px 10px; outline: none;
}
.form-row input:focus { border-color: var(--accent2); }
.form-row.inline input { flex: 1; }
.form-row.inline button { flex: none; }
.modal-btns { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }
#upProgress {
    position: relative; height: 22px; background: var(--bg); border-radius: 6px;
    overflow: hidden; margin-bottom: 4px;
}
#upProgress.hidden { display: none; }
#upBar { height: 100%; width: 0; background: var(--accent); transition: width .2s; }
#upPct {
    position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
    font-size: 11px; color: var(--fg);
}
.pl-pick-item {
    display: flex; justify-content: space-between; width: 100%;
    background: var(--bg3); border: 1px solid var(--line); color: var(--fg);
    border-radius: 8px; padding: 9px 12px; margin-bottom: 6px; cursor: pointer;
}
.pl-pick-item:hover { border-color: var(--accent); }

/* Login */
.login-page {
    display: flex; align-items: center; justify-content: center; height: 100vh;
}
.login-box {
    background: var(--bg2); border: 1px solid var(--line); border-radius: 14px;
    padding: 34px; width: 320px; text-align: center;
}
.login-logo { font-size: 26px; font-weight: 700; }
.login-logo span { color: var(--accent); }
.login-box p { color: var(--dim); margin: 4px 0 18px; }
.login-box input {
    width: 100%; background: var(--bg); border: 1px solid var(--line);
    border-radius: 8px; color: var(--fg); padding: 10px 12px; margin-bottom: 12px; outline: none;
}
.login-box button {
    width: 100%; background: var(--accent); border: none; border-radius: 8px;
    padding: 10px; font-weight: 700; color: #1a1503; cursor: pointer;
}
.login-err { color: #e86a5a; margin-bottom: 10px; font-size: 13px; }

/* Schmale Fenster */
@media (max-width: 1000px) {
    #app { grid-template-columns: 210px 1fr; }
    .rchips .chip:not(.on) { display: none; }
    .row:hover .rchips .chip { display: inline-block; }
    #pInfo { width: 150px; }
    #genreFilter { display: none; }
}

::-webkit-scrollbar { width: 10px; }
::-webkit-scrollbar-thumb { background: var(--line); border-radius: 5px; }
::-webkit-scrollbar-track { background: transparent; }
