/* The app's look: near-black, amber accents, Caudex for the name (see maui/.../Brand.xaml). */
@font-face {
    font-family: "Caudex";
    src: url("../fonts/Caudex-Regular.ttf") format("truetype");
    font-display: swap;
}

:root {
    --bg: #0B0B0C;
    --panel: #161618;
    --line: #2A2A2D;
    --text: #F2F2F2;
    --muted: #9A9A9E;
    --amber: #F2AB54;
    --green: #6FCF97;
    color-scheme: dark;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

h1, h2 { font-weight: 600; line-height: 1.25; }
h1 { font-size: 1.6rem; margin: 0 0 0.25rem; }
h1:focus { outline: none; }
h2 { font-size: 1.1rem; margin: 0; }
a { color: var(--amber); }
.muted { color: var(--muted); }
.loading { color: var(--muted); padding: 2rem 1rem; text-align: center; }

button {
    font: inherit;
    font-weight: 600;
    color: #1A1206;
    background: var(--amber);
    border: 1px solid var(--amber);
    border-radius: 999px;
    padding: 0.5rem 1.25rem;
    cursor: pointer;
}
button.outline { color: var(--amber); background: transparent; }
button:focus-visible { outline: 2px solid var(--text); outline-offset: 2px; }

.top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.75rem;
    padding: 1rem;
    border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: baseline; gap: 0.75rem; flex-wrap: wrap; }
.brand .name { font-family: "Caudex", Georgia, serif; font-size: 1.5rem; color: var(--amber); }
.account { display: flex; align-items: center; gap: 0.75rem; min-width: 0; }
.account .email { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

main { max-width: 960px; margin: 0 auto; padding: 1.5rem 1rem 3rem; }

.panel {
    max-width: 32rem;
    margin: 2rem auto;
    padding: 1.5rem;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 12px;
}
.panel p { margin: 0.5rem 0 1.25rem; }

.albums {
    list-style: none;
    padding: 0;
    margin: 1.5rem 0 0;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 26rem), 1fr));
    gap: 0.75rem;
}
.album {
    display: flex;
    gap: 1rem;
    align-items: center;
    padding: 0.75rem;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 12px;
    min-width: 0;
}
.album img {
    width: 96px;
    height: 96px;
    flex: none;
    object-fit: cover;
    border-radius: 6px;
    background: var(--line);
}
.album .details { min-width: 0; }
.album .subtitle { margin: 0.1rem 0 0.5rem; color: var(--muted); }
.album .meta { margin: 0; display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; font-size: 0.9rem; }

.badge {
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    padding: 0.1rem 0.6rem;
    border-radius: 999px;
    border: 1px solid currentColor;
}
.badge.published { color: var(--green); }
.badge.unpublished { color: var(--muted); }
.badge.flag { color: var(--amber); }

#blazor-error-ui {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    padding: 0.75rem 1rem;
    background: #3A1E1E;
    color: var(--text);
}
#blazor-error-ui .reload { margin-left: 0.5rem; }
#blazor-error-ui .dismiss { cursor: pointer; position: absolute; right: 1rem; top: 0.75rem; }

/* Album list: heading, Publish bar, reorder arrows. */
.heading { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
a.button {
    display: inline-block;
    font-weight: 600;
    color: #1A1206;
    background: var(--amber);
    border: 1px solid var(--amber);
    border-radius: 999px;
    padding: 0.5rem 1.25rem;
    text-decoration: none;
}
a.button.outline { color: var(--amber); background: transparent; }
button:disabled { opacity: 0.45; cursor: default; }

.publish {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-top: 1rem;
    padding: 0.75rem 1rem;
    border: 1px solid var(--line);
    border-radius: 12px;
}
.publish p { margin: 0; }
.publish.pending { border-color: var(--amber); }
.actions { display: flex; gap: 0.75rem; flex-wrap: wrap; align-items: center; }

.album { padding: 0; }
.album a.open {
    display: flex;
    gap: 1rem;
    align-items: center;
    flex: 1;
    min-width: 0;
    padding: 0.75rem;
    color: inherit;
    text-decoration: none;
    border-radius: 12px;
}
.album a.open:hover h2 { color: var(--amber); }
.album .move { display: flex; flex-direction: column; gap: 0.25rem; padding-right: 0.5rem; }

button.icon {
    color: var(--muted);
    background: transparent;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 0.2rem 0.5rem;
    font-size: 0.8rem;
    line-height: 1.2;
}
button.icon:not(:disabled):hover { color: var(--amber); border-color: var(--amber); }

.problems {
    margin: 1rem 0;
    padding: 0.75rem 1rem;
    border: 1px solid #FF6B6B;
    border-radius: 12px;
    background: #2A1515;
}
.problems p { margin: 0; }
.problems ul { margin: 0.5rem 0 0; padding-left: 1.25rem; }

/* Album editor. */
.editor { display: flex; flex-direction: column; gap: 1.25rem; margin-top: 1.5rem; }
.field {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding: 1rem;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 12px;
    min-width: 0;
}
.field h2, .field > label:not(.check) { font-size: 1rem; font-weight: 600; margin: 0; }
.field p { margin: 0; }
.field.social > label:not(:first-child) { margin-top: 0.75rem; }
.hint { color: var(--muted); font-size: 0.9rem; }
.cover img { width: 200px; height: 200px; object-fit: cover; border-radius: 8px; }
.check { display: flex; gap: 0.5rem; align-items: center; }
.check input { width: 1.1rem; height: 1.1rem; accent-color: var(--amber); }

input:not([type=checkbox]):not([type=file]), textarea {
    font: inherit;
    color: var(--text);
    background: var(--bg);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 0.5rem 0.65rem;
    width: 100%;
    min-width: 0;
}
input:focus, textarea:focus { outline: 2px solid var(--amber); outline-offset: -1px; }
textarea { resize: vertical; }
input[type=file] { color: var(--muted); }

.songs { width: 100%; border-collapse: collapse; }
.songs th { text-align: left; font-weight: 600; font-size: 0.85rem; color: var(--muted); padding: 0 0.25rem 0.25rem; }
.songs td { padding: 0.25rem; vertical-align: middle; }
.songs .number { color: var(--muted); width: 2rem; text-align: right; }
.songs input.time { width: 6rem; }
.songs .row-actions { white-space: nowrap; width: 1%; }

/* Phones: each song's fields stack. */
@media (max-width: 640px) {
    .songs thead { display: none; }
    .songs tr { display: grid; grid-template-columns: 2rem 1fr; gap: 0.25rem; padding: 0.5rem 0; border-bottom: 1px solid var(--line); }
    .songs td { padding: 0; }
    .songs td:not(.number) { grid-column: 2; }
    .songs .number { grid-row: 1 / span 4; text-align: left; }
    .songs input.time { width: 100%; }
}

/* Album audio: the upload rules, progress, and what the check found. */
.upload-rules {
    padding: 0.75rem 1rem;
    border: 1px dashed var(--line);
    border-radius: 8px;
}
.upload-rules ul { margin: 0.25rem 0 0.5rem; padding-left: 1.25rem; }
progress { width: 100%; height: 0.6rem; accent-color: var(--amber); }
.error { color: #FF8A8A; }
.warnings { margin: 0; padding-left: 1.25rem; color: var(--amber); font-size: 0.9rem; }
button.link {
    color: var(--amber);
    background: none;
    border: none;
    padding: 0;
    font-weight: normal;
    text-decoration: underline;
}
input[readonly] { color: var(--muted); }

/* Songs: one file each. */
.hidden { display: none; }
.songs td.length { color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.song-warning { margin: 0.25rem 0 0; color: var(--amber); font-size: 0.85rem; }
.file-problems { margin: 0; padding-left: 1.25rem; color: #FF8A8A; font-size: 0.9rem; }
@media (max-width: 640px) {
    .songs td.length { grid-column: 2; }
}
.file-notes { margin: 0; padding-left: 1.25rem; color: var(--muted); font-size: 0.9rem; }

/* Header: Albums and Metrics. */
.tabs { display: flex; gap: 1.25rem; margin-right: auto; padding-left: 0.5rem; }
.tabs a { color: var(--muted); text-decoration: none; font-weight: 600; padding: 0.25rem 0; border-bottom: 2px solid transparent; }
.tabs a:hover { color: var(--text); }
.tabs a.active { color: var(--amber); border-bottom-color: var(--amber); }

/* Metrics. */
.period { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; margin: 1rem 0 1.25rem; }
.period .month { min-width: 9.5rem; text-align: center; font-weight: 600; }
.period .all { margin-left: 0.75rem; }
button.chosen { color: #1A1206; background: var(--amber); }
.tiles {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 12rem), 1fr));
    gap: 0.75rem;
}
.tile {
    padding: 1rem;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 12px;
}
.tile .label { color: var(--muted); font-size: 0.85rem; letter-spacing: 0.05em; text-transform: uppercase; }
.tile .value { font-size: 2rem; font-weight: 600; font-variant-numeric: tabular-nums; line-height: 1.2; margin-top: 0.25rem; }
.tile .note { color: var(--muted); font-size: 0.85rem; }
.report { margin-top: 2rem; }
.report h2 { margin-bottom: 0.5rem; }
.numbers { width: 100%; border-collapse: collapse; }
.numbers th { text-align: right; font-weight: 600; font-size: 0.85rem; color: var(--muted); padding: 0.4rem 0.5rem; border-bottom: 1px solid var(--line); }
.numbers td { text-align: right; padding: 0.4rem 0.5rem; border-bottom: 1px solid var(--line); font-variant-numeric: tabular-nums; white-space: nowrap; }
.numbers th:first-child, .numbers td:first-child { text-align: left; white-space: normal; }
.numbers .album-cell { display: flex; align-items: center; gap: 0.75rem; min-width: 0; }
.numbers .album-cell img { width: 40px; height: 40px; border-radius: 4px; object-fit: cover; flex: none; background: var(--line); }
.numbers .listener-id { font-family: ui-monospace, Consolas, monospace; font-size: 0.85rem; overflow-wrap: anywhere; }.definitions { margin-top: 2rem; color: var(--muted); font-size: 0.9rem; }
.definitions dt { color: var(--text); font-weight: 600; margin-top: 0.5rem; }
.definitions dd { margin: 0; }
@media (max-width: 640px) {
    .numbers .hide-narrow { display: none; }
    .tile .value { font-size: 1.6rem; }
}

/* Messages and notifications */
.messages, .notifications { list-style: none; margin: 1.25rem 0 0; padding: 0; display: flex; flex-direction: column; gap: 0.75rem; }
.messages li, .notifications li { border: 1px solid var(--line); border-radius: 8px; background: var(--panel); }
.messages a.open { display: flex; gap: 1rem; padding: 0.75rem; color: inherit; text-decoration: none; min-width: 0; }
.messages a.open:hover h2 { color: var(--amber); }
.messages img { width: 96px; height: 72px; object-fit: cover; border-radius: 6px; flex: none; }
.messages .details { min-width: 0; }
.messages .meta { margin: 0.25rem 0; display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; font-size: 0.9rem; }
.messages .excerpt { margin: 0; font-size: 0.9rem; }
.message-image img { max-width: 100%; max-height: 360px; width: auto; border-radius: 8px; align-self: flex-start; }
.notifications li { display: flex; gap: 1rem; align-items: flex-start; justify-content: space-between; padding: 0.75rem; }
.notifications h3 { font-size: 1rem; margin: 0; }
.notifications p { margin: 0.25rem 0 0; }
.check.notify { align-items: flex-start; margin: 0.75rem 0; }
.check.notify input { flex: none; margin-top: 0.15rem; }
select {
    font: inherit; color: var(--text); background: var(--bg); border: 1px solid var(--line);
    border-radius: 8px; padding: 0.5rem 0.65rem; width: 100%;
}
.publish .check.notify { flex: 1 1 100%; margin: 0; }
