/* === Base === */
body { font-family: system-ui, sans-serif; font-size: min(14px, 1rem); max-width: 1200px; margin: 0 auto; padding: 20px; background: #1a1a2e; color: #eee; min-height: 100vh; display: flex; flex-direction: column; box-sizing: border-box; }
h1, h2 { color: #e94560; margin-top: 0; }
a { color: inherit; text-decoration: none; }
a:hover { color: #e94560; }

/* === Shared card pattern === */
.card, .top-tables > div, .now-playing-recent, .sidebar-section, .album-info, .track-card {
    background: #16213e; border-radius: 8px; padding: 15px;
}

/* === Dashboard: now playing === */
#recent { margin-bottom: 20px; }
.now-playing-layout { display: flex; gap: 20px; align-items: flex-start; }
.now-playing {
    width: 300px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    gap: 15px;
}
.now-playing-art { width: 100%; max-width: 100%; }
.now-playing-info {
    background: #16213e; border-radius: 8px; padding: 15px;
    display: flex; flex-direction: column; gap: 3px; color: inherit;
}
.now-playing-info:hover { color: inherit; }
.now-playing-info:hover .now-playing-title { color: #e94560; }
.now-playing-title { font-weight: bold; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.now-playing-artist { font-size: 0.85em; color: #aaa; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.now-playing-album { font-size: 0.85em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-top: 4px; }
.now-playing-circle { font-size: 0.85em; color: #aaa; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* === Progress bar === */
.now-playing-progress { margin: 8px -15px -15px; }
.progress-times { display: flex; justify-content: space-between; padding: 0 15px 4px; }
.progress-time { font-size: 0.75em; color: #e94560; font-variant-numeric: tabular-nums; white-space: nowrap; }
.progress-meta { color: #888; }
.progress-bar { height: 6px; background: #0f1a30; border-radius: 0 0 8px 8px; overflow: hidden; }
.progress-fill { height: 100%; width: 0%; background: #e94560; border-radius: 0 0 0 8px; transition: width 1s linear; }
.progress-bar.indeterminate .progress-fill {
    width: 100%; transition: none; animation: shimmer 2s ease-in-out infinite;
    background: linear-gradient(90deg, #e94560 0%, #e9456088 40%, #e94560 80%);
    background-size: 200% 100%;
}
@keyframes shimmer { 0%,100% { background-position: 200% 0; } 50% { background-position: -100% 0; } }

.now-playing-recent { flex: 1; min-width: 0; }
@media (max-width: 800px) {
    .now-playing-layout { flex-direction: column; }
    .now-playing { width: 100%; max-width: 500px; align-self: center; }
}
.grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 15px; margin-bottom: 20px; }
@media (max-width: 500px) { .grid { grid-template-columns: repeat(2, 1fr); } }
.card { text-align: center; }
.card .value { font-size: 2em; font-weight: bold; color: #e94560; }
.card .label { font-size: 0.85em; color: #aaa; }

/* === Dashboard: top tables === */
.top-tables { display: flex; flex-wrap: wrap; gap: 20px; align-items: stretch; }
.top-tables > div { flex: 1 1 280px; min-width: 0; display: flex; flex-direction: column; }
.top-tables > div > table { flex: 1; }

/* === Tables (shared) === */
table { width: 100%; border-collapse: collapse; table-layout: fixed; }
th, td { padding: 3px 0; text-align: left; vertical-align: middle; }
th { padding: 6px 5px; color: #e94560; }
th:not(:last-child), td:not(:last-child) { padding-right: 0; }
th:not(:last-child) > *, td:not(:last-child) > * { padding-right: 0; }
tr { border-bottom: 1px solid rgba(255,255,255,0.02); }
tbody tr:last-child { border-bottom: none; }

.plays { padding: 6px 10px; color: #e94560; font-weight: bold; width: 3em; text-align: right; }
.time { width: 5em; text-align: right; }

/* === Table entry links === */
.entry-link { padding: 3px 5px; display: flex; flex-direction: column; justify-content: center; min-height: 2.4em; }
.entry-link[href]:hover { background: rgba(0,0,0,0.2); border-radius: 4px; }
.entry-link > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; line-height: 1.2; }
.entry-link > span:not(:last-child) { margin-bottom: .2em; }
.entry-link > span:not(:first-child) { color: #aaa; font-size: 0.85em; }

/* === Navigation === */
.back-link, .external-link a { color: #e94560; font-size: 0.85em; }
.back-link { display: inline-block; margin-bottom: 15px; }
.back-link:hover, .external-link a:hover { opacity: 0.8; }
.external-link { text-align: center; }

/* === Error === */
.error { color: #e94560; padding: 10px; }

/* === Album layout === */
.album-layout {
    display: flex;
    gap: 20px;
    align-items: flex-start;
}
.album-sidebar {
    position: sticky;
    top: 20px;
    width: 360px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    gap: 15px;
}
.album-content {
    flex: 1;
    min-width: 0;
}
@media (max-width: 800px) {
    .album-layout { flex-direction: column; }
    .album-sidebar { position: static; width: 100%; align-items: stretch; }
    .album-content { width: 100%; }
    .album-art { align-self: center; }
}

/* === Album art === */
.album-art {
    width: 100%;
    max-width: 500px;
    aspect-ratio: 1;
    background: #16213e;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    overflow: hidden;
    transition: aspect-ratio 0.3s ease;
}
.album-art img { width: 100%; height: auto; display: block; opacity: 0; transition: opacity 0.3s ease; }
.album-art img.loaded { opacity: 1; }
.album-art-placeholder { font-size: 4em; color: #1e2a4a; }

/* === Album info card === */
.album-info h1 { margin: 0 0 5px; font-size: 1.3em; max-width: 500px; }
.circle-name { color: #aaa; margin-bottom: 10px; }
.album-stats { color: #aaa; font-size: 0.85em; margin-bottom: 5px; }
.album-dates { color: #aaa; font-size: 0.85em; display: flex; flex-direction: column; gap: 2px; }

/* === Sidebar sections (credits, etc.) === */
.sidebar-section h3 { margin: 0 0 10px; color: #e94560; font-size: 1em; }
.sidebar-section > :not(:last-child) { margin-bottom: 8px; }

.credit-label { color: #aaa; font-size: 0.85em; display: block; margin-bottom: 2px; }
.credit-value { font-size: 0.85em; line-height: 1.6; }
.credit-value a:not(:last-child)::after { content: " • "; color: #555; }
.credit-value a:hover { color: #e94560; }

.disc-section { position: relative; margin-bottom: 25px; }
.disc-section:last-child { margin-bottom: 0; }
.disc-section h2 { font-size: 1.1em; margin-bottom: 15px; }
.disc-section:first-child h2 { position: absolute; top: 0; margin: 0; transform: translateY(calc(-100% - 15px)); }
.disc-cat-code { color: #aaa; font-size: 0.85em; font-weight: normal; margin-left: 0.6em; }

.track-list { display: flex; flex-direction: column; gap: 8px; }

/* === Track cards === */
.track-card.highlighted { background: #1e2a4a; box-shadow: 0 0 0 2px #e94560; }
.track-main { display: flex; align-items: center; gap: 10px; }
.track-number { width: 24px; color: #e94560; font-weight: bold; text-align: right; flex-shrink: 0; }
.track-title { flex: 1; min-width: 0; }
.track-title .title { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.track-title .artist { display: block; font-size: 0.85em; color: #aaa; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.track-duration { color: #e94560; font-size: 0.85em; width: 45px; text-align: right; flex-shrink: 0; }
.track-plays { color: #e94560; font-size: 0.85em; width: 30px; text-align: right; flex-shrink: 0; }

/* === Track details === */
.track-details {
    margin-top: 8px;
    padding-left: 34px;
    font-size: 0.85em;
    color: #aaa;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: baseline;
}
.detail-label { color: #888; }
.detail-item a:not(:last-child)::after { content: " • "; color: #555; }
.detail-item a:hover { color: #e94560; }

/* === Empty state === */
.no-tracks { text-align: center; padding: 40px 20px; color: #aaa; }
.no-tracks .muted { font-size: 0.85em; color: #888; margin-top: 10px; }

/* === Footer === */
.site-footer { margin-top: auto; padding: 20px 0 0; text-align: center; font-size: 0.8em; color: #555; }
.site-footer a { color: #888; }
.site-footer a:hover { color: #e94560; }

