/* Galactic Radio MusicGen — Space Theme */

:root {
    /* Background */
    --bg-deep: #050a15;
    --bg-surface: #0a1628;

    /* Glass */
    --glass-bg: rgba(255, 255, 255, 0.04);
    --glass-border: rgba(255, 255, 255, 0.08);
    --glass-hover: rgba(255, 255, 255, 0.07);

    /* Accents */
    --cyan: #00d4ff;
    --cyan-dim: rgba(0, 212, 255, 0.15);
    --cyan-glow: rgba(0, 212, 255, 0.3);
    --purple: #7c3aed;
    --purple-dim: rgba(124, 58, 237, 0.15);

    /* Text */
    --text-bright: #f0f4ff;
    --text-primary: #c8d6e5;
    --text-muted: #8a9dbf;

    /* Status */
    --green: #10b981;
    --green-dim: rgba(16, 185, 129, 0.15);
    --amber: #f59e0b;
    --amber-dim: rgba(245, 158, 11, 0.15);
    --red: #ef4444;
    --red-dim: rgba(239, 68, 68, 0.15);

    /* Sizing */
    --radius: 12px;
    --radius-sm: 8px;
    --max-width: 640px;
    --sidebar-width: 220px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

/* Global focus ring for keyboard users (WCAG 2.4.7) */
:focus-visible {
    outline: 2px solid var(--cyan);
    outline-offset: 2px;
}

/* Reduced motion for vestibular disorders (WCAG 2.3.3) */
@media (prefers-reduced-motion: reduce) {
    .stars { animation: none !important; }
    .toast { animation: none !important; }
    .spinner { animation: none !important; }
}

html, body {
    height: 100%;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Inter, Roboto, sans-serif;
    background: var(--bg-deep);
    color: var(--text-primary);
    line-height: 1.6;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

/* ======================== STAR FIELD ======================== */
.stars-bg {
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    background: linear-gradient(180deg, #050a15 0%, #0a1628 40%, #0d1b30 100%);
}

.stars {
    position: absolute;
    inset: 0;
    background-repeat: repeat;
}

.stars-sm {
    background-image:
        radial-gradient(1px 1px at 50px 80px, rgba(255,255,255,0.6), transparent),
        radial-gradient(1px 1px at 180px 150px, rgba(255,255,255,0.5), transparent),
        radial-gradient(1px 1px at 320px 40px, rgba(255,255,255,0.4), transparent),
        radial-gradient(1px 1px at 450px 200px, rgba(255,255,255,0.5), transparent),
        radial-gradient(1px 1px at 90px 270px, rgba(255,255,255,0.3), transparent),
        radial-gradient(1px 1px at 600px 100px, rgba(255,255,255,0.5), transparent),
        radial-gradient(1px 1px at 250px 320px, rgba(255,255,255,0.4), transparent),
        radial-gradient(1px 1px at 700px 260px, rgba(255,255,255,0.5), transparent),
        radial-gradient(1px 1px at 400px 350px, rgba(255,255,255,0.3), transparent),
        radial-gradient(1px 1px at 550px 50px, rgba(255,255,255,0.6), transparent);
    background-size: 800px 400px;
    animation: drift 120s linear infinite;
}

.stars-md {
    background-image:
        radial-gradient(1.5px 1.5px at 100px 200px, rgba(255,255,255,0.7), transparent),
        radial-gradient(1.5px 1.5px at 350px 100px, rgba(255,255,255,0.5), transparent),
        radial-gradient(1.5px 1.5px at 520px 300px, rgba(255,255,255,0.6), transparent),
        radial-gradient(1.5px 1.5px at 200px 50px, rgba(255,255,255,0.4), transparent),
        radial-gradient(1.5px 1.5px at 680px 180px, rgba(255,255,255,0.5), transparent);
    background-size: 900px 400px;
    animation: drift 180s linear infinite;
}

.stars-lg {
    background-image:
        radial-gradient(2px 2px at 150px 130px, rgba(0, 212, 255, 0.5), transparent),
        radial-gradient(2px 2px at 500px 250px, rgba(124, 58, 237, 0.4), transparent),
        radial-gradient(2px 2px at 300px 350px, rgba(255, 255, 255, 0.8), transparent);
    background-size: 700px 500px;
    animation: drift 240s linear infinite reverse;
}

@keyframes drift {
    from { transform: translateY(0); }
    to { transform: translateY(-400px); }
}

/* ======================== TOAST ======================== */
#toast-container {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    pointer-events: none;
}

.toast {
    pointer-events: auto;
    padding: 0.75rem 1.25rem;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    font-weight: 500;
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    animation: toast-in 0.3s ease-out;
    max-width: 380px;
}

.toast.success { background: var(--green-dim); color: var(--green); border-color: rgba(16,185,129,0.25); }
.toast.error { background: var(--red-dim); color: var(--red); border-color: rgba(239,68,68,0.25); }
.toast.info { background: var(--cyan-dim); color: var(--cyan); border-color: rgba(0,212,255,0.2); }

.toast.fade-out { animation: toast-out 0.3s ease-in forwards; }

@keyframes toast-in {
    from { opacity: 0; transform: translateX(40px); }
    to { opacity: 1; transform: translateX(0); }
}
@keyframes toast-out {
    from { opacity: 1; transform: translateX(0); }
    to { opacity: 0; transform: translateX(40px); }
}

/* ======================== LANDING ======================== */
.landing {
    position: relative;
    z-index: 1;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem 1.5rem 2rem;
}

.landing-content {
    max-width: var(--max-width);
    width: 100%;
    text-align: center;
}

.logo-mark {
    margin-bottom: 1.5rem;
}

.logo-icon {
    width: 64px;
    height: 64px;
    color: var(--cyan);
    filter: drop-shadow(0 0 12px var(--cyan-glow));
}

.hero-title {
    font-size: clamp(2rem, 5vw, 3.2rem);
    font-weight: 700;
    color: var(--text-bright);
    margin-bottom: 0.5rem;
    letter-spacing: -0.02em;
}

.title-accent {
    background: linear-gradient(135deg, var(--cyan), var(--purple));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Google Sign-In Button */
.google-signin-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.8rem 2rem;
    background: white;
    color: #3c4043;
    border: none;
    border-radius: 50px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: box-shadow 0.2s, transform 0.15s;
    font-family: inherit;
    margin-bottom: 3rem;
}

.google-signin-btn:hover:not(:disabled) {
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3), 0 0 40px var(--cyan-glow);
    transform: translateY(-1px);
}

.google-signin-btn:active:not(:disabled) { transform: scale(0.98); }
.google-signin-btn:disabled { opacity: 0.5; cursor: wait; }

/* Landing Footer */
.landing-footer {
    margin-top: auto;
    padding-top: 3rem;
    text-align: center;
}

/* ======================== APP VIEW (sidebar layout) ======================== */
.app {
    position: relative;
    z-index: 1;
    min-height: 100vh;
    display: flex;
}

/* ======================== SIDEBAR ======================== */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: var(--sidebar-width);
    background: rgba(5, 10, 21, 0.92);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-right: 1px solid var(--glass-border);
    display: flex;
    flex-direction: column;
    z-index: 200;
    padding: 0;
}

.sidebar-header {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 1.25rem 1.25rem 1rem;
    border-bottom: 1px solid var(--glass-border);
}

.sidebar-logo {
    width: 28px;
    height: 28px;
    color: var(--cyan);
    flex-shrink: 0;
}

.sidebar-brand {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-bright);
    letter-spacing: -0.01em;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    padding: 0.75rem 0.75rem 0;
    gap: 0.2rem;
}

.sidebar-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 0.75rem;
    background: none;
    border: none;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    font-family: inherit;
    transition: background 0.15s, color 0.15s;
    text-align: left;
    width: 100%;
}

.sidebar-item:hover {
    background: var(--glass-hover);
    color: var(--text-primary);
}

.sidebar-item.active {
    background: var(--cyan-dim);
    color: var(--cyan);
}

.sidebar-divider {
    height: 1px;
    background: var(--glass-border);
    margin: 0.75rem 1rem;
}

.sidebar-links {
    display: flex;
    flex-direction: column;
    padding: 0 0.75rem;
    gap: 0.2rem;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 0.75rem;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    font-size: 0.82rem;
    font-weight: 500;
    text-decoration: none;
    transition: background 0.15s, color 0.15s;
}

.sidebar-link:hover {
    background: var(--glass-hover);
    color: var(--text-primary);
    text-decoration: none;
}

/* Ensure no underlines on any links in sidebar or top-nav */
.sidebar a,
.sidebar a:visited,
.sidebar a:hover,
.sidebar a:active,
.top-nav a,
.top-nav a:visited,
.top-nav a:hover,
.top-nav a:active {
    text-decoration: none;
}

.sidebar-link.active {
    background: var(--glass-hover);
    color: var(--cyan);
}

/* Sidebar overlay (mobile) */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 199;
    background: rgba(0, 0, 0, 0.5);
}

/* Hamburger toggle (hidden on desktop) */
.sidebar-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0.25rem;
    border-radius: var(--radius-sm);
    transition: color 0.2s;
}

.sidebar-toggle:hover {
    color: var(--text-bright);
}

/* ======================== APP MAIN ======================== */
.app-main {
    flex: 1;
    margin-left: var(--sidebar-width);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* Top Nav */
.top-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1.5rem;
    background: rgba(5, 10, 21, 0.85);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--glass-border);
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav-left {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.nav-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-bright);
}

.nav-right {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.user-chip {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.3rem 0.75rem 0.3rem 0.3rem;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 50px;
}

.user-avatar {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    object-fit: cover;
}

.user-email {
    font-size: 0.8rem;
    color: var(--text-primary);
    max-width: 160px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.credits-badge {
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--cyan);
    background: var(--cyan-dim);
    padding: 0.15rem 0.5rem;
    border-radius: 20px;
}

.btn-logout {
    background: none;
    border: 1px solid var(--glass-border);
    color: var(--text-muted);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: color 0.2s, border-color 0.2s;
}

.btn-logout:hover {
    color: var(--red);
    border-color: rgba(239, 68, 68, 0.3);
}

/* API Key Banner */
.api-key-banner {
    background: var(--green-dim);
    border-bottom: 1px solid rgba(16, 185, 129, 0.2);
    padding: 1rem 1.5rem;
}

.api-key-banner-inner {
    max-width: 100%;
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.api-key-banner p {
    font-size: 0.85rem;
    color: var(--green);
    font-weight: 500;
}

.api-key-banner code {
    font-size: 0.82rem;
    background: rgba(0,0,0,0.3);
    padding: 0.3rem 0.75rem;
    border-radius: var(--radius-sm);
    color: var(--text-bright);
    word-break: break-all;
}

.api-key-actions {
    display: flex;
    gap: 0.5rem;
    margin-left: auto;
}

/* Buttons */
.btn-sm {
    padding: 0.35rem 0.9rem;
    font-size: 0.78rem;
    font-weight: 500;
    border-radius: var(--radius-sm);
    cursor: pointer;
    border: none;
    transition: background 0.2s, color 0.2s;
    font-family: inherit;
}

.btn-glass {
    background: var(--glass-bg);
    color: var(--text-primary);
    border: 1px solid var(--glass-border);
}

.btn-glass:hover {
    background: var(--glass-hover);
    color: var(--text-bright);
}

.btn-ghost {
    background: transparent;
    color: var(--text-muted);
    border: 1px solid transparent;
}

.btn-ghost:hover {
    color: var(--text-primary);
    border-color: var(--glass-border);
}

/* Glass Card */
.glass-card {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius);
    padding: 2rem;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

/* ======================== PAGE CONTENT ======================== */
.page-content {
    flex: 1;
    width: 100%;
    padding: 2rem 2rem;
}

.section-title {
    font-size: 1.3rem;
    font-weight: 600;
    color: var(--text-bright);
    margin-bottom: 1.25rem;
}

/* ======================== SONG GENERATION FORM ======================== */
.gen-section {
    margin-bottom: 3rem;
}

.gen-card {
    max-width: 720px;
}

.gen-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.form-row {
    display: flex;
    gap: 1rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.flex-1 { flex: 1; }
.flex-2 { flex: 2; }

.form-group label {
    font-size: 0.78rem;
    font-weight: 500;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.form-group input,
.form-group textarea,
.form-group select {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-sm);
    padding: 0.6rem 0.75rem;
    font-size: 0.9rem;
    color: var(--text-bright);
    font-family: inherit;
    transition: border-color 0.2s;
}

.form-group input::placeholder,
.form-group textarea::placeholder {
    color: var(--text-muted);
    opacity: 0.6;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--cyan);
    box-shadow: 0 0 0 2px var(--cyan-dim);
}

.form-group select {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%238a9dbf' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    padding-right: 2rem;
}

.form-group select option {
    background: var(--bg-deep);
    color: var(--text-primary);
}

.form-group textarea {
    resize: vertical;
    min-height: 80px;
}

.form-group input[type="file"] {
    border: 2px dashed var(--glass-border);
    border-radius: var(--radius-sm);
    padding: 1rem;
    cursor: pointer;
    transition: border-color 0.2s;
}

.form-group input[type="file"]:hover {
    border-color: var(--cyan);
}

/* Generate Button */
.btn-generate {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 2rem;
    background: linear-gradient(135deg, var(--cyan), var(--purple));
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.2s, transform 0.15s;
    font-family: inherit;
    margin-top: 0.5rem;
}

.btn-generate:hover:not(:disabled) {
    opacity: 0.9;
    transform: translateY(-1px);
}

.btn-generate:active:not(:disabled) {
    transform: scale(0.98);
}

.btn-generate:disabled {
    opacity: 0.5;
    cursor: wait;
}

/* Loading Spinner */
.gen-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    padding: 2rem 0;
}

.gen-loading p {
    font-size: 0.9rem;
    color: var(--text-muted);
}

/* ===== Provider selection ===== */
.provider-options {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
}

.provider-option {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    flex: 1;
    min-width: 150px;
    padding: 0.6rem 0.75rem;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
}

.provider-option:hover { background: var(--glass-hover); }

.provider-option:has(input:checked) {
    border-color: var(--cyan);
    background: var(--cyan-dim);
}

.provider-option input { accent-color: var(--cyan); }

.provider-name {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-bright);
}

.provider-hint {
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-left: auto;
}

/* ===== Multi-provider results ===== */
.gen-results {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-top: 1.5rem;
}

.gen-results-head {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    font-size: 0.85rem;
    color: var(--text-bright);
    font-weight: 600;
}

.gen-results-credits {
    font-size: 0.72rem;
    font-weight: 400;
    color: var(--text-muted);
}

.gen-result-card {
    padding: 0.85rem 1rem;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-sm);
}

.gen-result-failed { border-color: rgba(239, 68, 68, 0.3); }

.gen-result-head {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.gen-result-name {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-bright);
}

.gen-result-badge {
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 0.1rem 0.45rem;
    border-radius: 999px;
}

.badge-text { background: var(--purple-dim); color: var(--purple); }
.badge-audio { background: var(--cyan-dim); color: var(--cyan); }
.badge-failed { background: var(--red-dim); color: var(--red); }

.gen-result-head .btn-sm { margin-left: auto; }

.gen-result-model {
    font-size: 0.7rem;
    color: var(--text-muted);
}

.gen-result-sub {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin: 0 0 0.4rem;
}

.gen-result-sub a, .gen-result-text a { color: var(--cyan); }

.gen-result-text {
    margin: 0;
    padding: 0.65rem 0.75rem;
    background: var(--bg-deep);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-sm);
    font-size: 0.78rem;
    color: var(--text-primary);
    white-space: pre-wrap;
    word-break: break-word;
    max-height: 260px;
    overflow-y: auto;
}

.gen-result-audio { width: 100%; margin-top: 0.25rem; }

.gen-result-error {
    margin: 0;
    font-size: 0.78rem;
    color: var(--red);
}

.spinner {
    width: 36px;
    height: 36px;
    border: 3px solid var(--glass-border);
    border-top-color: var(--cyan);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ======================== SONG LIST ======================== */
.songs-section {
    margin-bottom: 2rem;
}

.songs-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.songs-empty {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.9rem;
    padding: 2rem;
}

.song-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.5rem;
    gap: 1rem;
}

.song-info {
    flex: 1;
    min-width: 0;
}

.song-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-bright);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.song-meta {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.25rem;
    font-size: 0.78rem;
    color: var(--text-muted);
    flex-wrap: wrap;
}

.song-tag {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    padding: 0.1rem 0.5rem;
    border-radius: 20px;
    font-size: 0.72rem;
}

.song-tag-source {
    background: var(--purple-dim);
    border-color: rgba(124, 58, 237, 0.25);
    color: #a78bfa;
}

.song-status {
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.68rem;
    letter-spacing: 0.05em;
    padding: 0.1rem 0.4rem;
    border-radius: 4px;
}

.song-status-completed { color: var(--green); background: var(--green-dim); }
.song-status-generating { color: var(--amber); background: var(--amber-dim); }
.song-status-failed { color: var(--red); background: var(--red-dim); }
.song-status-pending { color: var(--text-muted); background: var(--glass-bg); }

/* Visibility badges */
.song-visibility {
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.68rem;
    letter-spacing: 0.05em;
    padding: 0.1rem 0.4rem;
    border-radius: 4px;
}

.song-visibility-public { color: var(--green); background: var(--green-dim); }
.song-visibility-private { color: var(--text-muted); background: var(--glass-bg); }
.song-visibility-scheduled { color: var(--amber); background: var(--amber-dim); }

.song-stats {
    display: flex;
    gap: 0.75rem;
    margin-top: 0.25rem;
    font-size: 0.72rem;
    color: var(--text-muted);
}

.song-actions {
    display: flex;
    gap: 0.5rem;
    flex-shrink: 0;
}

.btn-play:hover {
    background: var(--cyan-dim);
    color: var(--cyan);
    border-color: rgba(0, 212, 255, 0.3);
}

.btn-delete:hover {
    color: var(--red);
    border-color: rgba(239, 68, 68, 0.3);
}

/* ======================== SONG COVER ART ======================== */
.song-cover-art {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-sm);
    object-fit: cover;
    flex-shrink: 0;
}

/* Artist link in song meta */
.artist-link {
    color: var(--cyan);
    text-decoration: none;
}
.artist-link:hover {
    text-decoration: underline;
}

/* ======================== MODAL ======================== */
.modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 500;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.modal-content {
    width: 100%;
    max-width: 700px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    padding: 1.5rem;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
}

.modal-header h3 {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-bright);
}

.modal-content pre {
    flex: 1;
    overflow: auto;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-sm);
    padding: 1rem;
    font-size: 0.8rem;
    line-height: 1.5;
    color: var(--text-primary);
    white-space: pre-wrap;
    word-break: break-all;
    margin: 0;
}

/* ======================== FOOTER ======================== */
.app-footer, .landing-footer {
    padding: 1.5rem;
    text-align: center;
    border-top: 1px solid var(--glass-border);
}

.footer-copy {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* ======================== TOGGLE SWITCH ======================== */
.toggle-switch {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    user-select: none;
}

.toggle-switch input {
    display: none;
}

.toggle-slider {
    position: relative;
    width: 36px;
    height: 20px;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    transition: background 0.2s, border-color 0.2s;
}

.toggle-slider::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 14px;
    height: 14px;
    background: var(--text-muted);
    border-radius: 50%;
    transition: transform 0.2s, background 0.2s;
}

.toggle-switch input:checked + .toggle-slider {
    background: var(--green-dim);
    border-color: rgba(16, 185, 129, 0.3);
}

.toggle-switch input:checked + .toggle-slider::after {
    transform: translateX(16px);
    background: var(--green);
}

.toggle-label {
    font-size: 0.82rem;
    color: var(--text-primary);
}

/* ======================== RESPONSIVE ======================== */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.25s ease;
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .sidebar-overlay.open {
        display: block;
    }

    .sidebar-toggle {
        display: flex;
    }

    .app-main {
        margin-left: 0;
    }

    .top-nav {
        padding: 0.5rem 1rem;
    }

    .user-email {
        display: none;
    }

    .page-content {
        padding: 1.5rem 1rem;
    }

    .form-row {
        flex-direction: column;
        gap: 0.75rem;
    }

    .gen-card {
        padding: 1.25rem;
    }

    .song-card {
        flex-direction: column;
        align-items: flex-start;
        padding: 1rem;
    }

    .song-actions {
        width: 100%;
        justify-content: flex-end;
    }

    .artist-header {
        flex-direction: column;
        gap: 1rem;
    }

    .artist-header-actions {
        width: 100%;
        justify-content: flex-start;
    }
}

/* ======================== ARTISTS ======================== */

.sidebar-section-label {
    padding: 0.5rem 0.75rem 0.25rem;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
}

.sidebar-artists {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
    max-height: 240px;
    overflow-y: auto;
}

.sidebar-artists::-webkit-scrollbar {
    width: 4px;
}

.sidebar-artists::-webkit-scrollbar-thumb {
    background: var(--glass-border);
    border-radius: 2px;
}

.sidebar-new-artist {
    color: var(--text-muted);
    opacity: 0.8;
}

.sidebar-new-artist:hover {
    opacity: 1;
    color: var(--cyan);
}

.sidebar-artist-item span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Artist Detail Header */
.artist-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.5rem;
    padding: 1.25rem;
    margin-bottom: 1rem;
}

.artist-header-info {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex: 1;
    min-width: 0;
}

.artist-avatar {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
    border: 2px solid var(--glass-border);
}

.artist-avatar-placeholder {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    background: var(--glass-bg);
    border: 2px solid var(--glass-border);
    color: var(--text-muted);
    flex-shrink: 0;
}

.artist-header-text {
    min-width: 0;
}

.artist-header-name {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-bright);
    margin: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.artist-header-bio {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin: 0.2rem 0 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.artist-header-meta {
    display: flex;
    gap: 0.75rem;
    margin-top: 0.3rem;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.artist-slug {
    color: var(--cyan);
    opacity: 0.7;
}

.artist-header-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    flex-shrink: 0;
}

/* Artist Keys Section */
.artist-keys-section {
    margin-bottom: 1rem;
}

.artist-key-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--glass-border);
}

.artist-key-item:last-child {
    border-bottom: none;
}

.artist-key-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-width: 0;
}

.artist-key-prefix {
    font-family: monospace;
    font-size: 0.8rem;
    color: var(--cyan);
    opacity: 0.7;
}

.artist-key-name {
    font-size: 0.85rem;
    color: var(--text-primary);
}

.artist-key-status {
    font-size: 0.72rem;
    padding: 0.1rem 0.4rem;
    border-radius: 4px;
}

.artist-key-status-active {
    background: var(--green-dim);
    color: var(--green);
}

.artist-key-status-revoked {
    background: var(--red-dim);
    color: var(--red);
}

.artist-key-actions {
    display: flex;
    gap: 0.25rem;
}
