/*
    Created on : 20 Sept 2025, 22:38:04
    Author     : Andrei
*/

:root {
    --bg: #f4f5f7;
    --surface: #ffffff;
    --text: #1d2330;
    --muted: #5d6677;
    --border: #dde1e7;
    --topbar: #1d2330;
    --accent: #f08c00;
    --primary: #1f5fbf;
    --primary-hover: #194f9f;
    --danger: #c92a2a;
    --ok-bg: #e6f4ea;
    --ok-text: #1e6b34;
    --due-bg: #fff3d6;
    --due-text: #8a5a00;
    --overdue-bg: #fde4e4;
    --overdue-text: #a61e1e;
    --radius: 8px;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
}

a { color: var(--primary); }

.h1, .h2, .h3, h1, h2, h3 {
    margin: 0 0 .5rem;
    font-weight: 600;
    line-height: 1.25;
}
h1 { font-size: 1.6rem; }
h2 { font-size: 1.2rem; }
h3 { font-size: 1rem; }

/* top bar and menu */
.topbar { background: var(--topbar); color: #fff; }
.topbar-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 16px;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    min-height: 56px;
    gap: 8px;
}
.brand { color: #fff; font-weight: 700; font-size: 1.15rem; text-decoration: none; margin-right: 24px; }
.brand span { color: var(--accent); }
.nav { display: flex; flex: 1; align-items: center; gap: 4px; }
.nav a { color: #c9d0dc; text-decoration: none; padding: 8px 12px; border-radius: 6px; }
.nav a:hover { color: #fff; background: rgba(255,255,255,.08); }
.nav a.active { color: #fff; background: rgba(255,255,255,.14); }
.nav-user { margin-left: auto; display: flex; align-items: center; gap: 4px; }
.nav-name { color: #fff; padding: 0 8px; }
.nav-toggle { display: none; }
.nav-toggle-label { display: none; }

@media (max-width: 860px) {
    .nav-toggle-label {
        display: block;
        margin-left: auto;
        padding: 6px 12px;
        border: 1px solid rgba(255,255,255,.3);
        border-radius: 6px;
        cursor: pointer;
    }
    .nav { display: none; flex-basis: 100%; flex-direction: column; align-items: stretch; padding-bottom: 12px; }
    .nav-toggle:checked ~ .nav { display: flex; }
    .nav-user { margin-left: 0; flex-direction: column; align-items: stretch; border-top: 1px solid rgba(255,255,255,.15); padding-top: 8px; }
    .nav-name { padding: 8px 12px; }
}

/* page */
.container { max-width: 1200px; margin: 0 auto; padding: 24px 16px; }
.footer { text-align: center; color: var(--muted); font-size: .85rem; padding: 16px; }
.page-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 20px; }
.page-head h1 { margin: 0; }
.page-head .sub { color: var(--muted); margin: 2px 0 0; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.actions form { margin: 0; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; letter-spacing: .02em; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 20px;
}
.card > h2:first-child { margin-bottom: 12px; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 12px; }
.card-head h2 { margin: 0; }

.grid { display: grid; gap: 20px; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.grid-2 > .card { margin-bottom: 0; }
.grid { margin-bottom: 20px; }
.stack > * + * { margin-top: 20px; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 16px; margin-bottom: 20px; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 20px; }
.stat-value { font-size: 1.9rem; font-weight: 700; }
.stat-label { color: var(--muted); }

/* details: label / value list */
.details { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 0; }
.details dt { color: var(--muted); }
.details dd { margin: 0; overflow-wrap: anywhere; }

/* tables */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { padding: 10px 12px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: top; }
.table th { font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 600; }
.table tbody tr:hover { background: #fafbfc; }
.table tfoot td { font-weight: 600; border-bottom: 0; }
.empty { color: var(--muted); padding: 12px 0; margin: 0; }

.badge { display: inline-block; padding: 2px 8px; border-radius: 99px; font-size: .8rem; font-weight: 600; white-space: nowrap; }
.badge-ok { background: var(--ok-bg); color: var(--ok-text); }
.badge-due { background: var(--due-bg); color: var(--due-text); }
.badge-overdue { background: var(--overdue-bg); color: var(--overdue-text); }
.badge-muted { background: #eceef2; color: var(--muted); }

/* buttons */
.btn {
    display: inline-block;
    padding: 8px 16px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--surface);
    color: var(--text);
    font: inherit;
    text-decoration: none;
    cursor: pointer;
    line-height: 1.4;
}
.btn:hover { background: #f0f2f5; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-danger { color: var(--danger); border-color: #f0b4b4; }
.btn-danger:hover { background: var(--overdue-bg); }
.btn-small { padding: 4px 10px; font-size: .85rem; }
.btn-block { width: 100%; }
.link-button { background: none; border: 0; padding: 0; color: var(--danger); font: inherit; cursor: pointer; text-decoration: underline; }

/* forms */
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px 20px; }
.field { display: flex; flex-direction: column; gap: 4px; }
.field-wide { grid-column: 1 / -1; }
label { font-weight: 600; font-size: .9rem; }
.hint { color: var(--muted); font-size: .85rem; margin: 0; font-weight: normal; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], input[type=search], input[type=tel], select, textarea {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid #c4cad4;
    border-radius: 6px;
    font: inherit;
    background: #fff;
    color: var(--text);
}
textarea { min-height: 80px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--primary); outline-offset: -1px; border-color: var(--primary); }
.has-error input, .has-error select, .has-error textarea { border-color: var(--danger); }
.field-error { color: var(--danger); font-size: .85rem; margin: 0; }
.checkbox { display: flex; gap: 8px; align-items: flex-start; font-weight: normal; }
.checkbox input { margin-top: 4px; }
.form-actions { display: flex; gap: 8px; margin-top: 20px; }
.search { display: flex; gap: 8px; margin-bottom: 16px; max-width: 520px; }
.search input { flex: 1; }

.alert { padding: 12px 16px; border-radius: 6px; margin-bottom: 16px; border: 1px solid transparent; }
.alert-success { background: var(--ok-bg); color: var(--ok-text); border-color: #bfe3c8; }
.alert-error { background: var(--overdue-bg); color: var(--overdue-text); border-color: #f4c2c2; }
.alert ul { margin: 4px 0 0; padding-left: 20px; }

/* login */
.auth-box { max-width: 400px; margin: 48px auto; }
.auth-box .field { margin-bottom: 16px; }

.mt { margin-top: 20px; }
.mb { margin-bottom: 12px; }
.field-end { justify-content: flex-end; }
.actions-end { justify-content: flex-end; }

/* ---- music */

.nav-search { margin-left: 8px; }
.nav-search input { width: 180px; padding: 6px 10px; border-radius: 99px; border: 0; background: rgba(255,255,255,.12); color: #fff; }
.nav-search input::placeholder { color: #aab3c2; }
.nav-search input:focus { background: #fff; color: var(--text); outline: none; }
.btn-player { background: var(--accent); border-color: var(--accent); color: #1d2330; font-weight: 600; }
.btn-player:hover { background: #ffa94d; }
@media (max-width: 860px) {
    .nav-search { margin: 8px 0; }
    .nav-search input { width: 100%; }
}

.stat-link { text-decoration: none; color: inherit; }
.stat-link:hover { border-color: var(--primary); }

.album-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 20px 16px; }
.album-card { display: flex; flex-direction: column; gap: 2px; text-decoration: none; color: inherit; min-width: 0; }
.album-card img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 6px; background: #e9ecef; margin-bottom: 6px; box-shadow: 0 1px 3px rgba(0,0,0,.12); }
.album-card img.round { border-radius: 50%; }
.album-card:hover img { box-shadow: 0 4px 14px rgba(0,0,0,.2); }
.album-card-title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.album-card-sub { color: var(--muted); font-size: .85rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 480px) { .album-grid { grid-template-columns: repeat(2, 1fr); } }

.album-head { display: flex; gap: 24px; align-items: flex-end; margin-bottom: 20px; flex-wrap: wrap; }
.album-cover { width: 220px; max-width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 8px; box-shadow: 0 4px 18px rgba(0,0,0,.2); background: #e9ecef; }
.album-head h1 { font-size: 2rem; }
.album-head p { margin: 4px 0; }

.list-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 12px; }
.tracks td { vertical-align: middle; }
.tracks .col-num { width: 56px; color: var(--muted); white-space: nowrap; }
.tracks .col-check, .files .col-check { width: 32px; }
.tracks .col-time { width: 90px; }
.tracks .col-move { width: 70px; }
.tracks tr[data-track] .icon-btn { visibility: hidden; }
.tracks tr[data-track]:hover .icon-btn, .tracks tr[data-track] .icon-btn:focus { visibility: visible; }
.tracks tr[data-track]:hover .num { display: none; }
.tracks tr[data-track] .col-move .icon-btn { visibility: visible; }
.track-title { font-weight: 500; }
.disc-row td { font-weight: 600; color: var(--muted); background: #f8f9fb; }
tr.dragging { opacity: .4; }
tr[draggable="true"] { cursor: grab; }
@media (hover: none) { .tracks tr[data-track] .icon-btn { visibility: visible; } .tracks tr[data-track] .num { display: none; } }
@media (max-width: 640px) { .col-quality { display: none; } }

.icon-btn { background: none; border: 0; padding: 2px 6px; font: inherit; color: var(--primary); cursor: pointer; border-radius: 4px; line-height: 1.2; }
.icon-btn:hover { background: #e8eefa; }
.icon-btn:disabled { color: #c4cad4; cursor: default; background: none; }

.add-to-playlist { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--border); }
.add-to-playlist label { font-weight: normal; color: var(--muted); }
.add-to-playlist select, .add-to-playlist input { width: auto; min-width: 200px; }

.letters { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 16px; }
.letters a { padding: 4px 9px; border-radius: 6px; text-decoration: none; background: var(--surface); border: 1px solid var(--border); font-size: .9rem; }
.letters a.active { background: var(--primary); border-color: var(--primary); color: #fff; }

.genre-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; }
.genre { display: flex; flex-direction: column; padding: 12px 14px; border: 1px solid var(--border); border-radius: 6px; text-decoration: none; color: inherit; }
.genre:hover { border-color: var(--primary); }
.genre span:first-child { font-weight: 600; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { padding: 6px 12px; border-radius: 99px; background: #eef2f8; text-decoration: none; }
.chip:hover { background: #dfe7f5; }

.pager { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 20px; }

.crumbs { display: flex; flex-wrap: wrap; gap: 6px; font-size: .9rem; margin-bottom: 8px; color: var(--muted); }
.file-list { list-style: none; margin: 0; padding: 0; }
.file-list li { padding: 8px 0; border-bottom: 1px solid var(--border); display: flex; gap: 12px; flex-wrap: wrap; }
a.dir { font-weight: 500; text-decoration: none; }
.code { background: #1d2330; color: #e9ecef; padding: 12px 16px; border-radius: 6px; overflow-x: auto; font-size: .85rem; }

/* ---- the player window */

.player-page {
    --p-bg: #14171f;
    --p-surface: #1e2230;
    --p-text: #eef1f6;
    --p-muted: #98a1b3;
    --p-accent: #f08c00;
    background: var(--p-bg);
    color: var(--p-text);
}
.player { max-width: 560px; margin: 0 auto; padding: 16px; display: flex; flex-direction: column; gap: 14px; min-height: 100vh; }
.player a { color: var(--p-muted); text-decoration: none; }
.player a:hover { color: var(--p-text); text-decoration: underline; }
.now { display: flex; flex-direction: column; gap: 12px; align-items: center; text-align: center; }
.now-cover { width: min(320px, 80vw); aspect-ratio: 1; object-fit: cover; border-radius: 10px; box-shadow: 0 10px 40px rgba(0,0,0,.5); background: var(--p-surface); }
.now-text { min-width: 0; max-width: 100%; }
.now-title { font-size: 1.25rem; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.now-sub { color: var(--p-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.seek { display: flex; align-items: center; gap: 10px; font-size: .85rem; color: var(--p-muted); font-variant-numeric: tabular-nums; }
.seek input { flex: 1; }
.player input[type=range] { accent-color: var(--p-accent); }
.controls { display: flex; justify-content: center; align-items: center; gap: 14px; }
.ctl { position: relative; width: 48px; height: 48px; border-radius: 50%; border: 0; background: none; color: var(--p-text); cursor: pointer; display: grid; place-items: center; padding: 0; }
.ctl:hover { background: rgba(255,255,255,.08); }
.ctl svg { width: 28px; height: 28px; fill: currentColor; }
.ctl-small svg { width: 22px; height: 22px; }
.ctl-small { color: var(--p-muted); }
.ctl-main { width: 64px; height: 64px; background: var(--p-accent); color: #14171f; }
.ctl-main:hover { background: #ffa94d; }
.ctl-main svg { width: 34px; height: 34px; }
#shuffle[aria-pressed="true"], #repeat:not([data-mode="off"]) { color: var(--p-accent); }
.repeat-one { position: absolute; top: 8px; right: 8px; font-size: .65rem; font-weight: 700; }
.settings { display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.volume { display: flex; align-items: center; gap: 6px; font-weight: normal; }
.volume svg { width: 20px; height: 20px; fill: var(--p-muted); }
.player select { width: auto; background: var(--p-surface); color: var(--p-text); border-color: #343a4d; }
.player-message { background: #3b2a12; color: #ffd8a8; padding: 8px 12px; border-radius: 6px; margin: 0; }
.queue-head { display: flex; justify-content: space-between; align-items: baseline; border-top: 1px solid #2a2f40; padding-top: 12px; }
.queue-head h2 { margin: 0; font-size: 1rem; }
.queue-head .muted, .player .muted { color: var(--p-muted); }
.player .link-button { color: var(--p-muted); }
.queue { list-style: none; margin: 0; padding: 0; overflow-y: auto; flex: 1; min-height: 120px; }
.queue li { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 6px; cursor: pointer; }
.queue li:hover { background: var(--p-surface); }
.queue li.current { background: var(--p-surface); }
.queue li.current .queue-title { color: var(--p-accent); }
.queue-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.queue-title, .queue-sub { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.queue-sub, .queue-time { color: var(--p-muted); font-size: .85rem; }
.queue-remove { background: none; border: 0; color: var(--p-muted); font-size: 1.2rem; cursor: pointer; padding: 0 4px; visibility: hidden; }
.queue li:hover .queue-remove { visibility: visible; }
@media (hover: none) { .queue-remove { visibility: visible; } }
.queue-empty { color: var(--p-muted); text-align: center; }
