:root {
    --bg: #fafafa;
    --fg: #1a1a1a;
    --muted: #6b6b6b;
    --border: #ddd;
    --accent: #6a3de8;
    --accent-fg: #fff;
    --error-fg: #a4262c;
    --success-bg: #eafaf0;
    --success-fg: #1e7a3a;
    --track-bg: #ececec;
}

* { box-sizing: border-box; }

dialog.quick-add-modal {
    border: none;
    border-radius: 8px;
    padding: 1.5rem;
    max-width: 360px;
    width: 90%;
    background: var(--bg);
    color: var(--fg);
}
dialog.quick-add-modal::backdrop { background: rgba(0, 0, 0, 0.5); }
dialog.quick-add-modal h2 { margin-top: 0; }
dialog.quick-add-modal .modal-error {
    background: #fff;
    color: var(--error-fg);
    font-weight: 700;
    padding: 0.5rem;
    border-radius: 4px;
}

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: var(--bg);
    color: var(--fg);
    line-height: 1.5;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3 {
    font-family: "Fraunces", Georgia, "Times New Roman", serif;
    font-weight: 600;
    font-optical-sizing: auto;
}

.site-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1rem;
    padding: 1rem 1.5rem;
    background: #fff;
    border-bottom: 1px solid var(--border);
}

.site-header .brand {
    font-family: "Fraunces", Georgia, "Times New Roman", serif;
    font-weight: 700;
    font-size: 1.3rem;
    color: var(--fg);
}

.site-header nav { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; }

.search-form input { padding: 0.4rem 0.6rem; border: 1px solid var(--border); border-radius: 4px; }

.page-filter { display: block; margin: 1rem 0; max-width: 320px; }

.breadcrumbs { font-size: 0.85rem; color: var(--muted); margin-bottom: 0.75rem; }
.breadcrumbs a { color: var(--muted); text-decoration: underline; }
.breadcrumbs a:hover { color: var(--accent); }

.container { max-width: 960px; margin: 0 auto; padding: 1.5rem; }

.muted { color: var(--muted); font-size: 0.9rem; }

.flash { padding: 0.75rem 1rem; border-radius: 4px; margin-bottom: 1rem; }
.flash-error {
    background: #fff;
    color: var(--error-fg);
    font-weight: 700;
    text-transform: uppercase;
    border: 1px solid var(--error-fg);
}
.flash-success { background: var(--success-bg); color: var(--success-fg); }
.flash-info { background: #eef2ff; color: #33389c; }

.artist-list, .album-list {
    list-style: none;
    padding: 0;
    margin: 1rem 0;
}
.artist-list li, .album-list li {
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border);
}
.album-list-year {
    display: inline-block;
    width: 3.5em;
    color: var(--muted);
}
.album-list-cover {
    display: inline-block;
    width: 24px;
    height: 24px;
    vertical-align: middle;
    margin-right: 0.5rem;
    border-radius: 3px;
    object-fit: cover;
}
.album-list-cover-missing {
    background: var(--track-bg);
    border: 1px dashed var(--muted);
}

.az-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    margin: 1rem 0;
    font-weight: 600;
}
.az-nav a, .az-nav-empty {
    display: inline-block;
    width: 1.6em;
    text-align: center;
    border-radius: 4px;
}
.az-nav a { background: var(--bg); }
.az-nav-empty { color: var(--border); }
.jump-nav-group h2 { margin-bottom: 0.25rem; }

.album-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 1rem;
    margin: 1rem 0;
}

.album-card {
    position: relative;
    display: block;
    color: var(--fg);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 0.75rem;
    background: var(--card-tint, #fff);
}
.album-card img { width: 100%; height: auto; border-radius: 4px; margin-bottom: 0.5rem; }
.album-card-title { font-weight: 600; }
.album-card-artist { color: var(--muted); font-size: 0.9rem; }

.album-detail {
    display: flex;
    align-items: flex-start;
    gap: 1.5rem;
    flex-wrap: wrap;
    margin-bottom: 1.5rem;
    padding: 1rem 1.25rem;
    border-radius: 8px;
    background: var(--card-tint, transparent);
}
.album-cover { max-width: 220px; height: auto; border-radius: 6px; }
.artist-photo { max-width: 220px; height: auto; border-radius: 6px; }

.genre-banner {
    padding: 1.25rem 1.5rem;
    border-radius: 8px;
    margin-bottom: 1.5rem;
    background: var(--genre-tint, #e6e6e6);
}
.genre-banner h1 { margin-top: 0; }
.genre-banner p:last-child { margin-bottom: 0; }

.genre-swatch {
    display: inline-block;
    width: 0.7em;
    height: 0.7em;
    border-radius: 50%;
    border: 1px solid rgba(0,0,0,0.15);
    margin-right: 0.4em;
    vertical-align: middle;
}

.pdf-embed-wrap {
    position: relative;
    width: 50%;
}
.pdf-embed {
    display: block;
    width: 100%;
    height: 40vh;
    max-height: 450px;
    border: 1px solid var(--border);
    border-radius: 6px;
}
/* An <img> (used when the stored "PDF" is actually a plain image) needs
 * object-fit to shrink the whole picture down to the box - the browser's
 * default is to render it at native pixel size and let the box crop it. */
img.pdf-embed {
    object-fit: contain;
    background: #fff;
}
/* The embed's content (a PDF or image, loaded via pdf_proxy.php) is a
 * separate document - clicks inside it never reach this page's JS, even
 * though the iframe is same-origin. This transparent button sits on top of
 * the whole iframe so "click the file" has something to actually catch. */
.pdf-embed-expand {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    padding: 0;
    background: transparent;
    border: none;
    border-radius: 6px;
    cursor: zoom-in;
}
.pdf-embed-expand:hover {
    background: rgba(0, 0, 0, 0.04);
}

dialog.pdf-lightbox {
    border: none;
    border-radius: 8px;
    padding: 1rem;
    width: 95vw;
    max-width: 1100px;
    height: 92vh;
    background: var(--bg);
    color: var(--fg);
}
/* display must stay scoped to [open] - an unconditional "display: flex"
 * here would override the browser's own "display: none" while closed,
 * leaving the (invisible) dialog still in the layout and intercepting
 * clicks on the page underneath it. */
dialog.pdf-lightbox[open] {
    display: flex;
    flex-direction: column;
}
dialog.pdf-lightbox::backdrop {
    background: rgba(0, 0, 0, 0.7);
}
dialog.pdf-lightbox .pdf-lightbox-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}
dialog.pdf-lightbox h2 {
    margin: 0;
}
dialog.pdf-lightbox .pdf-lightbox-close {
    background: none;
    border: none;
    font-size: 1.75rem;
    line-height: 1;
    cursor: pointer;
    color: var(--fg);
}
.pdf-lightbox-frame {
    flex: 1;
    width: 100%;
    border: 1px solid var(--border);
    border-radius: 6px;
}
img.pdf-lightbox-frame {
    display: none; /* toggled on by pdf_lightbox.js for the image case */
    object-fit: contain;
    background: #fff;
}

table { width: 100%; border-collapse: collapse; margin: 1rem 0; }
th, td { text-align: left; padding: 0.5rem; border-bottom: 1px solid var(--border); }
.track-table tbody tr { background: var(--card-tint, transparent); }

.bulk-event-block {
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 0.5rem 1rem 1rem;
    margin: 0 0 1.25rem;
}
.bulk-event-block legend { font-weight: 600; padding: 0 0.4rem; }
.bulk-event-fields {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 0.6rem;
    margin-bottom: 0.75rem;
}
.bulk-event-fields label { display: flex; flex-direction: column; gap: 0.2rem; font-size: 0.85rem; }
.bulk-performer-list {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    padding: 0.6rem;
    margin-bottom: 0.75rem;
    background: var(--bg);
    border-radius: 4px;
}
.bulk-performer-row {
    display: grid;
    grid-template-columns: 7rem 1fr 10rem;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
}

form.admin-form, form.auth-form {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    max-width: 480px;
}
form.admin-form label, form.auth-form label { display: flex; flex-direction: column; gap: 0.25rem; font-size: 0.9rem; }
input, select, textarea {
    padding: 0.5rem;
    border: 1px solid var(--border);
    border-radius: 4px;
    font: inherit;
}

button {
    background: var(--accent);
    color: var(--accent-fg);
    border: none;
    border-radius: 4px;
    padding: 0.5rem 1rem;
    cursor: pointer;
    font: inherit;
}
button:hover { opacity: 0.9; }

form.inline-form { display: inline; }
form.inline-form button:not(.btn) {
    background: none;
    color: var(--error-fg);
    padding: 0;
    text-decoration: underline;
}

.btn {
    display: inline-block;
    background: var(--accent);
    color: var(--accent-fg);
    border-radius: 4px;
    padding: 0.5rem 1rem;
    font: inherit;
    text-decoration: none;
    border: 1px solid var(--accent);
}
.btn:hover { opacity: 0.9; text-decoration: none; }
.btn-secondary {
    background: #fff;
    color: var(--fg);
    border: 1px solid var(--border);
}
.btn-secondary:hover { background: var(--bg); opacity: 1; }
.btn-danger {
    background: #fff;
    color: var(--error-fg);
    border: 1px solid var(--error-fg);
}
.btn-danger:hover { background: var(--error-fg); color: #fff; opacity: 1; }
.btn-sm { padding: 0.25rem 0.6rem; font-size: 0.85rem; }

.btn-row { display: flex; gap: 0.5rem; flex-wrap: wrap; align-items: center; margin: 1rem 0; }
.actions { display: inline-flex; gap: 0.4rem; align-items: center; flex-wrap: wrap; }

.compare-artists { display: flex; gap: 1.5rem; flex-wrap: wrap; margin: 1rem 0; }
.compare-artist-card {
    flex: 1 1 320px;
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 1rem;
    background: #fff;
}
.compare-artist-card h3 { margin-top: 0; }

.event-entry { border-top: 1px solid var(--border); padding: 0.75rem 0; display: flex; gap: 0.75rem; align-items: center; }
.event-entry:first-of-type { border-top: none; padding-top: 0; }
.event-entry-body { flex: 1; min-width: 0; }
.event-header-line { margin: 1rem 0; }
.event-entry:first-of-type .event-header-line { margin-top: 0; }
.event-tickets { width: 220px; flex-shrink: 0; display: flex; flex-direction: column; align-items: center; gap: 0.5rem; }
.event-ticket { max-width: 220px; max-height: 320px; width: auto; height: auto; border-radius: 6px; }
.event-photo-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 0.5rem;
    margin: 0.5rem 0;
    max-width: 50%;
}
.event-photo-grid img { width: 100%; height: 220px; object-fit: cover; border-radius: 4px; }

.video-entry { border-top: 1px solid var(--border); padding: 0.75rem 0; }
.video-entry:first-of-type { border-top: none; padding-top: 0; }
.video-header-line { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
.video-toggle {
    background: none;
    border: none;
    padding: 0;
    font: inherit;
    font-weight: bold;
    color: var(--accent);
    cursor: pointer;
}
.video-toggle:hover { text-decoration: underline; }
.video-panel { margin-top: 0.75rem; }
.video-player { display: block; width: 100%; max-width: 640px; aspect-ratio: 16 / 9; border: none; border-radius: 6px; }
video.video-player { aspect-ratio: auto; max-height: 480px; }

.spotify-link { background: none; border: none; padding: 0; cursor: pointer; vertical-align: middle; }
h1 .spotify-link { vertical-align: -1px; }
.album-list .spotify-link { vertical-align: -2px; }
.spotify-panel { margin: 0.75rem 0; }
.spotify-player { display: block; width: 100%; max-width: 640px; height: 352px; border: none; border-radius: 12px; }

.library-link { background: none; border: none; padding: 0; cursor: pointer; vertical-align: middle; }
.library-panel { margin-top: 0.5rem; }
.library-player { display: block; width: 100%; max-width: 360px; }

.playlist-link { background: none; border: none; padding: 0; cursor: pointer; vertical-align: middle; }
h1 .playlist-link { vertical-align: -1px; }
.playlist-panel { margin: 0.75rem 0; }
.playlist-player { display: block; width: 100%; max-width: 360px; }
.playlist-now-playing { margin: 0 0 0.25rem; font-size: 0.9rem; }

.site-footer { text-align: center; color: var(--muted); padding: 1.5rem; font-size: 0.85rem; }
.site-footer hr { border: none; border-top: 1px solid var(--border); margin: 0 0 1rem; }

.masthead h1 { margin: 0 0 0.15rem; }
.masthead .tagline { color: var(--muted); margin: 0 0 1.5rem; }

.stat-row {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
    margin-bottom: 1.5rem;
}
.stat-tile {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 1rem 1.25rem;
    text-align: center;
}
.stat-tile .stat-num {
    font-family: "Fraunces", Georgia, serif;
    font-weight: 700;
    font-size: 1.9rem;
    font-variant-numeric: tabular-nums;
    display: block;
}
.stat-tile .stat-label {
    color: var(--muted);
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.dash-card.stat-tile { display: flex; flex-direction: column; justify-content: center; }
.dash-card.stat-tile .stat-label { white-space: nowrap; }

.dash-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.1rem;
    margin-bottom: 1.5rem;
}
@media (max-width: 620px) {
    .dash-grid { grid-template-columns: 1fr; }
    .stat-row { grid-template-columns: 1fr; }
}

.dash-card {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 1.1rem 1.25rem 1.25rem;
}
.dash-card h2 { margin: 0 0 0.9rem; font-size: 1.1rem; }
.dash-card .album-grid { margin-top: 0; }
.wide-card { grid-column: 1 / -1; }

.now-playing-card {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0.9rem 1.25rem 1.1rem;
    margin-bottom: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}
.now-playing-card h2 { margin: 0 0 0.4rem; font-size: 1.1rem; }
.now-playing-row { display: flex; align-items: baseline; justify-content: space-between; gap: 0.6rem; }
.now-playing-badge {
    flex-shrink: 0;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--accent);
}
.now-playing-time { flex-shrink: 0; font-size: 0.85rem; color: var(--muted); }
.now-playing-current { font-weight: 600; }

.type-badge {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--muted);
    background: rgba(255, 255, 255, 0.85);
    border: 1px solid var(--border);
    border-radius: 3px;
    padding: 0.05rem 0.4rem;
}

.bar-list { display: flex; flex-direction: column; gap: 0.55rem; }
.bar-row {
    display: grid;
    grid-template-columns: 8.5rem 1fr 2.4rem;
    align-items: center;
    gap: 0.6rem;
    border-radius: 4px;
    padding: 0.15rem 0.3rem;
}
.bar-row:hover { background: var(--bg); }
.bar-row-name {
    font-size: 0.85rem;
    color: var(--fg);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.bar-track {
    background: var(--track-bg);
    border-radius: 3px;
    height: 0.65rem;
    overflow: hidden;
}
.bar-fill {
    height: 100%;
    min-width: 6px;
    border-radius: 3px;
    background: var(--accent);
}
.bar-row-value {
    font-size: 0.85rem;
    font-variant-numeric: tabular-nums;
    color: var(--muted);
    text-align: right;
}

