/* Layout of the web interface; tokens come from app.css. */

h1,
h2 {
    margin: 0 0 8px;
}

h2 {
    font-size: 15px;
}

h2:not(:first-child) {
    margin-top: 20px;
}

.muted {
    color: var(--muted);
}

.btn {
    display: inline-block;
    padding: 7px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface-2);
    color: var(--fg);
    text-decoration: none;
    cursor: pointer;
    white-space: nowrap;
}

.btn:disabled {
    opacity: 0.4;
    cursor: default;
}

.btn-primary {
    border-color: var(--accent);
    background: var(--accent);
    color: var(--accent-fg);
}

.btn-danger {
    border-color: var(--danger);
    background: none;
    color: var(--danger);
}

.btn-link {
    padding-left: 0;
    padding-right: 0;
    border: 0;
    background: none;
    color: var(--accent);
}

.btn-icon {
    padding: 4px 8px;
}

.login {
    display: grid;
    place-items: center;
    min-height: 100vh;
    padding: 16px;
}

.login-card {
    width: 100%;
    max-width: 360px;
    padding: 28px;
    border-radius: 12px;
    background: var(--surface);
    text-align: center;
}

.topbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px 14px;
    padding: 10px 16px;
    border-bottom: 1px solid var(--border);
    background: var(--surface);
}

.brand {
    font-size: 16px;
}

.user {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: auto;
}

.user img {
    width: 28px;
    height: 28px;
    border-radius: 50%;
}

.user a {
    color: var(--muted);
}

.page {
    max-width: 1200px;
    margin: 0 auto;
    padding: 16px;
}

.empty {
    padding: 40px 16px;
    text-align: center;
    color: var(--muted);
}

.tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 16px;
    border-bottom: 1px solid var(--border);
    overflow-x: auto;
}

.tabs a {
    padding: 8px 12px;
    border-bottom: 2px solid transparent;
    color: var(--muted);
    text-decoration: none;
    white-space: nowrap;
}

.tabs a.is-active {
    border-bottom-color: var(--accent);
    color: var(--fg);
}

.panel:not(.is-active) {
    display: none;
}

.panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
}

.panel-head p,
.panel-head h2 {
    margin: 0;
}

.box {
    min-width: 0;
    padding: 16px;
    border-radius: 12px;
    background: var(--surface);
}

.box .ctl-now {
    background: var(--surface-2);
}

.grid-2,
.grid-playlists {
    display: grid;
    gap: 16px;
    align-items: start;
}

@media (min-width: 860px) {
    .grid-2 {
        grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    }

    .grid-playlists {
        grid-template-columns: 300px minmax(0, 1fr);
    }
}

.copy-row {
    display: flex;
    gap: 8px;
    margin: 8px 0;
}

.copy-row input {
    flex: 1;
}

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

.list li {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px;
    border-radius: 6px;
}

.list li.is-active,
.list li.is-clickable:hover {
    background: var(--surface-2);
}

.list li.is-clickable {
    cursor: pointer;
}

.list .grow {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.list img {
    width: 28px;
    height: 28px;
    border-radius: 50%;
}

.tag {
    padding: 1px 6px;
    border-radius: 4px;
    background: var(--surface-2);
    font-size: 11px;
    color: var(--muted);
}

.overlay-list {
    display: grid;
    gap: 16px;
}

@media (min-width: 860px) {
    .overlay-list {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 10px;
    margin: 10px 0;
}

.form-grid label {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 12px;
    color: var(--muted);
}

.form-grid input,
.form-grid select {
    color: var(--fg);
}

.form-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.form-actions .spacer {
    flex: 1;
}

.track-search {
    display: flex;
    gap: 8px;
    margin: 8px 0;
}

.track-search input {
    flex: 1;
}

.playlist-cols {
    display: grid;
    gap: 16px;
}

@media (min-width: 1100px) {
    .playlist-cols {
        grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    }
}

.scroll {
    max-height: 520px;
    overflow-y: auto;
}

.sub {
    display: block;
    font-size: 12px;
    color: var(--muted);
}

.toast {
    position: fixed;
    right: 16px;
    bottom: 16px;
    left: 16px;
    max-width: 420px;
    margin-left: auto;
    padding: 10px 14px;
    border-radius: var(--radius);
    background: var(--fg);
    color: var(--bg);
}

.toast.is-error {
    background: var(--danger);
    color: #fff;
}

/* ---------- Library ---------- */

.filter-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 8px;
}

.filter-row input[type="search"] {
    flex: 1 1 220px;
}

.filter-row select {
    flex: 0 1 180px;
}

.thumb {
    flex: none;
    width: 30px;
    height: 40px;
    border-radius: 4px;
    object-fit: cover;
}

.list img.thumb {
    width: 30px;
    height: 40px;
    border-radius: 4px;
}

.thumb-empty {
    background: var(--surface-2);
}

.dialog {
    width: min(760px, calc(100vw - 32px));
    max-height: calc(100vh - 32px);
    padding: 20px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--surface);
    color: var(--fg);
}

.dialog::backdrop {
    background: rgba(0, 0, 0, 0.55);
}

.dialog [hidden] {
    display: none !important;
}

.field {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin: 10px 0;
    font-size: 12px;
    color: var(--muted);
}

.field input,
.field select {
    color: var(--fg);
    font-size: 14px;
}

.field-label {
    font-size: 12px;
}

.field-check {
    flex-direction: row !important;
    align-self: end;
    padding-bottom: 8px;
}

#track-preview {
    width: 100%;
    margin-bottom: 4px;
}

#upload-files {
    max-height: 240px;
    overflow-y: auto;
}

#upload-files input {
    min-width: 0;
}

.game-picker {
    display: flex;
    flex-direction: column;
    gap: 6px;
    color: var(--fg);
    font-size: 14px;
}

.game-selected {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 8px;
    border-radius: var(--radius);
    background: var(--surface-2);
}

.game-results {
    max-height: 260px;
    overflow-y: auto;
}

#track-moods {
    margin-bottom: 0;
}
