/*
 * ============================================================
 * avikFM — Stylesheet
 * Version 0.2.0
 * ============================================================
 *
 * Design tokens → Reset → Layout → Sidebar → Navigation →
 * Main Content → Player Bar → Mobile Nav → Auth Pages →
 * Empty States → Error Pages → Forms → Buttons → Alerts →
 * Utilities → Responsive
 * ============================================================
 */

/* ==========================================================
   DESIGN TOKENS
   ========================================================== */
:root {
    /* Colour palette */
    --c-bg:             #0d0d0d;
    --c-surface:        #161616;
    --c-surface-raised: #1c1c1c;
    --c-surface-hover:  #222222;
    --c-surface-active: #282828;
    --c-border:         #2a2a2a;
    --c-border-subtle:  #1f1f1f;

    --c-text:           #e8e6e3;
    --c-text-secondary: #999999;
    --c-text-muted:     #555555;

    --c-accent:         #d4a44c;
    --c-accent-hover:   #e0b860;
    --c-accent-subtle:  rgba(212, 164, 76, 0.12);

    --c-danger:         #c44d4d;
    --c-danger-subtle:  rgba(196, 77, 77, 0.12);
    --c-success:        #5cb85c;

    /* Typography */
    --font-sans: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto,
                 'Helvetica Neue', Arial, sans-serif;
    --font-mono: 'SF Mono', 'Cascadia Code', 'Fira Code', Consolas, monospace;

    --fs-2xs:    0.6875rem;  /* 11px */
    --fs-xs:     0.75rem;    /* 12px */
    --fs-sm:     0.8125rem;  /* 13px */
    --fs-base:   0.875rem;   /* 14px */
    --fs-md:     1rem;       /* 16px */
    --fs-lg:     1.125rem;   /* 18px */
    --fs-xl:     1.375rem;   /* 22px */
    --fs-2xl:    1.75rem;    /* 28px */
    --fs-3xl:    2.25rem;    /* 36px */

    --fw-normal: 400;
    --fw-medium: 500;
    --fw-semi:   600;

    --lh-tight:  1.2;
    --lh-normal: 1.5;
    --lh-relaxed:1.7;

    /* Spacing */
    --sp-1: 0.25rem;    /* 4px */
    --sp-2: 0.5rem;     /* 8px */
    --sp-3: 0.75rem;    /* 12px */
    --sp-4: 1rem;       /* 16px */
    --sp-5: 1.25rem;    /* 20px */
    --sp-6: 1.5rem;     /* 24px */
    --sp-8: 2rem;       /* 32px */
    --sp-10: 2.5rem;    /* 40px */
    --sp-12: 3rem;      /* 48px */
    --sp-16: 4rem;      /* 64px */

    /* Layout dimensions */
    --sidebar-w:       240px;
    --player-h:        72px;
    --mobile-nav-h:    56px;
    --mobile-player-h: 56px;
    --safe-area-bottom: env(safe-area-inset-bottom, 0px);

    /* Borders */
    --radius-sm:  4px;
    --radius-md:  6px;
    --radius-lg:  8px;
    --radius-xl: 12px;
    --radius-full: 9999px;

    /* Transitions */
    --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
    --t-fast:   120ms var(--ease-out);
    --t-normal: 200ms var(--ease-out);
    --t-slow:   350ms var(--ease-out);

    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.3);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.4);
    --shadow-lg: 0 8px 30px rgba(0,0,0,0.5);
}


/* ==========================================================
   RESET & BASE
   ========================================================== */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font-sans);
    font-size: var(--fs-base);
    font-weight: var(--fw-normal);
    line-height: var(--lh-normal);
    color: var(--c-text);
    background-color: var(--c-bg);
    overflow: hidden;          /* prevent double scrollbars */
}

a {
    color: inherit;
    text-decoration: none;
}

button {
    font: inherit;
    color: inherit;
    background: none;
    border: none;
    cursor: pointer;
}

img, svg {
    display: block;
    max-width: 100%;
}

ul, ol {
    list-style: none;
}

input, textarea, select {
    font: inherit;
    color: inherit;
}

:focus-visible {
    outline: 2px solid var(--c-accent);
    outline-offset: 2px;
}

::selection {
    background: var(--c-accent);
    color: var(--c-bg);
}

/* Scrollbar styling (Webkit) */
::-webkit-scrollbar {
    width: 6px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: var(--c-border);
    border-radius: var(--radius-full);
}
::-webkit-scrollbar-thumb:hover {
    background: var(--c-text-muted);
}


/* ==========================================================
   BRAND
   ========================================================== */
.brand {
    font-size: var(--fs-lg);
    font-weight: var(--fw-semi);
    letter-spacing: -0.02em;
    display: inline-block;
    color: var(--c-text);
    text-decoration: none;
    transition: color var(--t-fast);
}
.brand:hover {
    color: var(--c-accent);
}
.brand-accent {
    color: var(--c-accent);
    font-weight: var(--fw-semi);
    letter-spacing: 0.04em;
    margin-left: 0.03em;
}
.brand--lg {
    font-size: var(--fs-2xl);
}


/* ==========================================================
   APP LAYOUT (CSS Grid)
   ========================================================== */
.app-layout {
    display: grid;
    grid-template-columns: var(--sidebar-w) 1fr;
    grid-template-rows: 1fr var(--player-h);
    grid-template-areas:
        "sidebar main"
        "player  player";
    height: 100vh;
    height: 100dvh;      /* dynamic viewport for mobile */
    overflow: hidden;
}


/* ==========================================================
   SIDEBAR
   ========================================================== */
.sidebar {
    grid-area: sidebar;
    background: var(--c-surface);
    border-right: 1px solid var(--c-border-subtle);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.sidebar-header {
    padding: var(--sp-6) var(--sp-5);
    flex-shrink: 0;
}

.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 0 var(--sp-3) var(--sp-4);
}

.sidebar-footer {
    flex-shrink: 0;
    padding: var(--sp-3);
    border-top: 1px solid var(--c-border-subtle);
}


/* ==========================================================
   NAVIGATION ITEMS
   ========================================================== */
.nav-group {
    margin-bottom: var(--sp-4);
}

.nav-group-title {
    font-size: var(--fs-2xs);
    font-weight: var(--fw-semi);
    color: var(--c-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    padding: var(--sp-4) var(--sp-3) var(--sp-2);
}

.nav-item {
    display: flex;
    align-items: center;
    gap: var(--sp-3);
    padding: var(--sp-2) var(--sp-3);
    border-radius: var(--radius-md);
    font-size: var(--fs-sm);
    font-weight: var(--fw-medium);
    color: var(--c-text-secondary);
    transition: color var(--t-fast), background-color var(--t-fast);
    width: 100%;
    text-align: left;
}

.nav-item:hover {
    color: var(--c-text);
    background-color: var(--c-surface-hover);
}

.nav-item.is-active {
    color: var(--c-text);
    background-color: var(--c-surface-active);
}

.nav-item.is-active .nav-icon {
    color: var(--c-accent);
}

.nav-icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.nav-empty-hint {
    font-size: var(--fs-xs);
    color: var(--c-text-muted);
    padding: var(--sp-1) var(--sp-3);
    font-style: italic;
}

/* Logout button — inherits nav-item styling */
.logout-form {
    width: 100%;
}
.logout-btn {
    color: var(--c-text-muted);
}
.logout-btn:hover {
    color: var(--c-danger);
    background-color: var(--c-danger-subtle);
}


/* ==========================================================
   MAIN CONTENT
   ========================================================== */
.main-content {
    grid-area: main;
    overflow-y: auto;
    background: var(--c-bg);
}

.content-wrapper {
    max-width: 1200px;
    padding: var(--sp-8) var(--sp-8) var(--sp-16);
}


/* ==========================================================
   PAGE HEADER
   ========================================================== */
.page-header {
    margin-bottom: var(--sp-8);
}

.page-title {
    font-size: var(--fs-2xl);
    font-weight: var(--fw-semi);
    letter-spacing: -0.02em;
    color: var(--c-text);
}


/* ==========================================================
   PLAYER BAR (placeholder — Phase 1)
   ========================================================== */
.player-bar {
    grid-area: player;
    background: var(--c-surface);
    border-top: 1px solid var(--c-border-subtle);
    display: flex;
    align-items: center;
    justify-content: center;
}

.player-placeholder {
    display: flex;
    align-items: center;
    gap: var(--sp-3);
    color: var(--c-text-muted);
}

.player-placeholder-icon {
    width: 20px;
    height: 20px;
    opacity: 0.5;
}

.player-placeholder-text {
    font-size: var(--fs-xs);
    letter-spacing: 0.02em;
}


/* ==========================================================
   MOBILE BOTTOM NAVIGATION
   ========================================================== */
.mobile-nav {
    display: none;          /* Hidden on desktop */
    grid-area: mobilenav;
    background: var(--c-surface);
    border-top: 1px solid var(--c-border-subtle);
    align-items: center;
    justify-content: space-around;
    padding: 0 var(--sp-2);
}

.mobile-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: var(--sp-2) var(--sp-3);
    font-size: var(--fs-2xs);
    font-weight: var(--fw-medium);
    color: var(--c-text-muted);
    transition: color var(--t-fast);
    min-width: 48px;      /* Comfortable touch target */
    -webkit-tap-highlight-color: transparent;
}

.mobile-nav-item:hover,
.mobile-nav-item.is-active {
    color: var(--c-text);
}

.mobile-nav-item.is-active .mobile-nav-icon {
    color: var(--c-accent);
}

.mobile-nav-icon {
    width: 22px;
    height: 22px;
}


/* ==========================================================
   AUTH PAGES (Login / Setup)
   ========================================================== */
.auth-body {
    overflow: auto;
}

.auth-layout {
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--sp-6);
}

.auth-card {
    width: 100%;
    max-width: 380px;
    background: var(--c-surface);
    border: 1px solid var(--c-border);
    border-radius: var(--radius-xl);
    padding: var(--sp-10) var(--sp-8);
}

.auth-card--wide {
    max-width: 480px;
}

.auth-brand {
    text-align: center;
    margin-bottom: var(--sp-8);
}

.auth-tagline {
    font-size: var(--fs-sm);
    color: var(--c-text-secondary);
    margin-top: var(--sp-2);
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: var(--sp-5);
}


/* ==========================================================
   FORMS
   ========================================================== */
.form-group {
    display: flex;
    flex-direction: column;
    gap: var(--sp-2);
}

.form-label {
    font-size: var(--fs-sm);
    font-weight: var(--fw-medium);
    color: var(--c-text-secondary);
}

.form-input {
    width: 100%;
    padding: var(--sp-3) var(--sp-4);
    background: var(--c-bg);
    border: 1px solid var(--c-border);
    border-radius: var(--radius-md);
    color: var(--c-text);
    font-size: var(--fs-base);
    transition: border-color var(--t-fast), box-shadow var(--t-fast);
}

.form-input:hover {
    border-color: var(--c-text-muted);
}

.form-input:focus {
    outline: none;
    border-color: var(--c-accent);
    box-shadow: 0 0 0 3px var(--c-accent-subtle);
}

.form-input::placeholder {
    color: var(--c-text-muted);
}

.form-hint {
    font-size: var(--fs-xs);
    color: var(--c-text-muted);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--sp-4);
}


/* ==========================================================
   BUTTONS
   ========================================================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--sp-2);
    padding: var(--sp-3) var(--sp-6);
    font-size: var(--fs-sm);
    font-weight: var(--fw-medium);
    border-radius: var(--radius-md);
    transition: background-color var(--t-fast), color var(--t-fast),
                transform var(--t-fast), box-shadow var(--t-fast);
    cursor: pointer;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}
.btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    padding: 0;
    margin: 0;
    border-radius: 50%;
    color: var(--c-text-muted);
    background-color: transparent;
    transition: background-color var(--t-fast), color var(--t-fast);
}

.btn-icon:hover {
    color: var(--c-text);
    background-color: var(--c-surface-active); /* Make it distinct from row hover */
}

.btn:active {
    transform: scale(0.98);
}

.btn--primary {
    background-color: var(--c-accent);
    color: var(--c-bg);
}

.btn--primary:hover {
    background-color: var(--c-accent-hover);
}

.btn--primary:focus-visible {
    box-shadow: 0 0 0 3px var(--c-accent-subtle);
}

.btn--full {
    width: 100%;
    padding: var(--sp-3) var(--sp-4);
}


/* ==========================================================
   ALERTS
   ========================================================== */
.alert {
    padding: var(--sp-3) var(--sp-4);
    border-radius: var(--radius-md);
    font-size: var(--fs-sm);
    line-height: var(--lh-relaxed);
    margin-bottom: var(--sp-4);
}

.alert--error {
    background: var(--c-danger-subtle);
    color: var(--c-danger);
    border: 1px solid rgba(196, 77, 77, 0.25);
}


/* ==========================================================
   SETUP – Migration Results
   ========================================================== */
.setup-migrations {
    margin-bottom: var(--sp-6);
    padding: var(--sp-4);
    background: var(--c-bg);
    border-radius: var(--radius-md);
    border: 1px solid var(--c-border);
}

.setup-migrations-title {
    font-size: var(--fs-sm);
    font-weight: var(--fw-semi);
    color: var(--c-text-secondary);
    margin-bottom: var(--sp-3);
}

.migration-result {
    display: flex;
    align-items: center;
    gap: var(--sp-3);
    padding: var(--sp-1) 0;
    font-size: var(--fs-xs);
    font-family: var(--font-mono);
}

.migration-result--success .migration-status {
    color: var(--c-success);
}

.migration-result--error .migration-status {
    color: var(--c-danger);
}

.migration-name {
    color: var(--c-text-secondary);
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.migration-message {
    width: 100%;
    color: var(--c-danger);
    font-size: var(--fs-2xs);
    margin-top: var(--sp-1);
}


/* ==========================================================
   HOME PAGE
   ========================================================== */
.page-home {
    /* No special container needed; inherits from content-wrapper */
}

.home-welcome {
    margin-bottom: var(--sp-12);
}

.home-title {
    font-size: var(--fs-3xl);
    font-weight: var(--fw-semi);
    letter-spacing: -0.03em;
    line-height: var(--lh-tight);
    color: var(--c-text);
}

.home-subtitle {
    font-size: var(--fs-md);
    color: var(--c-text-secondary);
    margin-top: var(--sp-2);
}


/* ==========================================================
   EMPTY STATES
   ========================================================== */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: var(--sp-16) var(--sp-6);
    max-width: 420px;
    margin: 0 auto;
}

.empty-state--home {
    padding-top: var(--sp-8);
}

.track-duration {
    text-align: right;
    width: 60px;
    color: var(--c-text-muted);
    font-variant-numeric: tabular-nums;
}

.track-actions {
    width: 48px;
    min-width: 48px;
    text-align: right;
    display: flex;
    justify-content: flex-end;
    align-items: center;
}

.empty-state-icon {
    width: 80px;
    height: 80px;
    color: var(--c-text-muted);
    margin-bottom: var(--sp-6);
    opacity: 0.6;
}

.empty-state-icon svg {
    width: 100%;
    height: 100%;
}

.empty-state-title {
    font-size: var(--fs-lg);
    font-weight: var(--fw-semi);
    color: var(--c-text);
    margin-bottom: var(--sp-3);
}

.empty-state-text {
    font-size: var(--fs-sm);
    color: var(--c-text-secondary);
    line-height: var(--lh-relaxed);
}


/* ==========================================================
   ERROR PAGES
   ========================================================== */
.error-page {
    text-align: center;
}

.error-page .brand {
    display: block;
    margin-bottom: var(--sp-8);
}

.error-content {
    margin-bottom: var(--sp-6);
}

.error-code {
    font-size: 4rem;
    font-weight: var(--fw-semi);
    color: var(--c-text-muted);
    letter-spacing: -0.03em;
    line-height: 1;
    margin-bottom: var(--sp-4);
}

.error-message {
    font-size: var(--fs-md);
    color: var(--c-text-secondary);
    max-width: 380px;
    margin: 0 auto;
}

.error-home-link {
    display: inline-flex;
    align-items: center;
    gap: var(--sp-2);
    font-size: var(--fs-sm);
    font-weight: var(--fw-medium);
    color: var(--c-accent);
    transition: color var(--t-fast);
}

.error-home-link:hover {
    color: var(--c-accent-hover);
}


/* ==========================================================
   LIBRARY COMPONENTS
   ========================================================== */

/* Section Headers */
.section-header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    margin-bottom: var(--sp-6);
}
.section-title {
    font-size: var(--fs-xl);
    font-weight: var(--fw-semi);
    color: var(--c-text);
}
.section-action {
    font-size: var(--fs-sm);
    color: var(--c-text-muted);
    transition: color var(--t-fast);
}
.section-action:hover {
    color: var(--c-accent);
}

/* Grids */
.library-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: var(--sp-6);
    margin-bottom: var(--sp-8);
}

/* Album Card */
.album-card {
    background: transparent;
    border-radius: var(--radius-md);
    transition: transform var(--t-fast), background-color var(--t-fast);
    padding: var(--sp-3);
    margin: calc(var(--sp-3) * -1); /* Negative margin to keep grid alignment but allow hover bg */
}
.album-card:hover {
    background: var(--c-surface-hover);
}
.album-artwork {
    width: 100%;
    aspect-ratio: 1 / 1;
    background: var(--c-surface-raised);
    border-radius: var(--radius-sm);
    overflow: hidden;
    margin-bottom: var(--sp-3);
    box-shadow: var(--shadow-sm);
}
.album-artwork img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform var(--t-slow);
}
.album-card:hover .album-artwork img {
    transform: scale(1.03);
}
.album-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.album-title {
    font-size: var(--fs-base);
    font-weight: var(--fw-semi);
    color: var(--c-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.album-artist {
    font-size: var(--fs-sm);
    color: var(--c-text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.album-meta {
    font-size: var(--fs-xs);
    color: var(--c-text-muted);
    margin-top: 2px;
}

/* Artist Card */
.artist-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: var(--sp-3);
    margin: calc(var(--sp-3) * -1);
    border-radius: var(--radius-md);
    transition: background-color var(--t-fast);
}
.artist-card:hover {
    background: var(--c-surface-hover);
}
.artist-artwork {
    width: 100%;
    aspect-ratio: 1 / 1;
    border-radius: 50%;
    background: var(--c-surface-raised);
    overflow: hidden;
    margin-bottom: var(--sp-4);
    box-shadow: var(--shadow-md);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--c-text-muted);
}
.artist-artwork img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.artist-name {
    font-size: var(--fs-base);
    font-weight: var(--fw-semi);
    color: var(--c-text);
    margin-bottom: 2px;
    width: 100%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.artist-meta {
    font-size: var(--fs-sm);
    color: var(--c-text-secondary);
}

/* Genre Card */
.genre-card {
    background: var(--c-surface-raised);
    border-radius: var(--radius-md);
    padding: var(--sp-6) var(--sp-4);
    text-align: center;
    transition: transform var(--t-fast), background-color var(--t-fast);
    border: 1px solid var(--c-border-subtle);
}
.genre-card:hover {
    transform: translateY(-2px);
    background: var(--c-surface-hover);
    border-color: var(--c-border);
}
.genre-name {
    font-size: var(--fs-lg);
    font-weight: var(--fw-semi);
    color: var(--c-text);
    margin-bottom: var(--sp-2);
}

/* Track List */
.track-list {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: var(--sp-8);
}
.track-list th {
    text-align: left;
    font-size: var(--fs-xs);
    font-weight: var(--fw-medium);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--c-text-muted);
    padding: var(--sp-3) var(--sp-4);
    border-bottom: 1px solid var(--c-border-subtle);
}
.track-row {
    transition: background-color var(--t-fast);
    border-radius: var(--radius-sm);
}
.track-row:hover {
    background-color: var(--c-surface-hover);
}
.track-row td {
    padding: var(--sp-3) var(--sp-4);
    font-size: var(--fs-sm);
    vertical-align: middle;
}
.track-num {
    color: var(--c-text-muted);
    width: 40px;
    text-align: right;
}
.track-title-cell {
    display: flex;
    align-items: center;
    gap: var(--sp-4);
}
.track-title-artwork {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-sm);
    object-fit: cover;
    background: var(--c-surface-raised);
    flex-shrink: 0;
}
.track-title-info {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.track-title {
    color: var(--c-text);
    font-weight: var(--fw-medium);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.track-artist {
    color: var(--c-text-secondary);
    font-size: var(--fs-xs);
    margin-top: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.track-album {
    color: var(--c-text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 250px;
}
.track-duration {
    color: var(--c-text-muted);
    text-align: right;
    width: 80px;
}

/* Detail Pages Hero */
.hero-section {
    display: flex;
    align-items: flex-end;
    gap: var(--sp-8);
    margin-bottom: var(--sp-10);
    padding-bottom: var(--sp-8);
    border-bottom: 1px solid var(--c-border-subtle);
}
.hero-artwork {
    width: 240px;
    height: 240px;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    background: var(--c-surface-raised);
    flex-shrink: 0;
}
.hero-artwork.artist {
    border-radius: 50%;
}
.hero-info {
    display: flex;
    flex-direction: column;
}
.hero-type {
    font-size: var(--fs-xs);
    font-weight: var(--fw-semi);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--c-text-muted);
    margin-bottom: var(--sp-2);
}
.hero-title {
    font-size: 4rem;
    font-weight: 700;
    line-height: 1.1;
    letter-spacing: -0.04em;
    color: var(--c-text);
    margin-bottom: var(--sp-4);
}
.hero-meta {
    font-size: var(--fs-sm);
    color: var(--c-text-secondary);
    display: flex;
    align-items: center;
    gap: var(--sp-2);
}
.hero-meta strong {
    color: var(--c-text);
    font-weight: var(--fw-medium);
}
.hero-meta .bullet {
    color: var(--c-text-muted);
}

/* Pagination & Controls */
.controls-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--sp-6);
}
.sort-select {
    background: var(--c-surface-raised);
    border: 1px solid var(--c-border);
    color: var(--c-text);
    padding: var(--sp-2) var(--sp-3);
    border-radius: var(--radius-sm);
    font-size: var(--fs-sm);
    cursor: pointer;
}
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--sp-4);
    margin-top: var(--sp-8);
}
.btn-secondary {
    background: transparent;
    border: 1px solid var(--c-border);
    color: var(--c-text);
}
.btn-secondary:hover {
    border-color: var(--c-text-muted);
    background: var(--c-surface-hover);
}
.pagination-info {
    font-size: var(--fs-sm);
    color: var(--c-text-muted);
}

/* Disc Headers */
.disc-header {
    display: flex;
    align-items: center;
    gap: var(--sp-3);
    padding: var(--sp-6) var(--sp-4) var(--sp-2);
    color: var(--c-text-secondary);
    font-size: var(--fs-sm);
    font-weight: var(--fw-semi);
    letter-spacing: 0.05em;
}


/* ==========================================================
   RESPONSIVE — Tablet (≤ 1024px)
   ========================================================== */
@media (max-width: 1024px) {
    :root {
        --sidebar-w: 200px;
    }

    .content-wrapper {
        padding: var(--sp-6) var(--sp-6) var(--sp-12);
    }
    
    .hero-section {
        flex-direction: column;
        align-items: flex-start;
        gap: var(--sp-6);
    }
    
    .hero-title {
        font-size: 3rem;
    }
}


/* ==========================================================
   RESPONSIVE — Mobile (≤ 768px)
   ========================================================== */
@media (max-width: 768px) {
    body {
        overflow: auto;
        -webkit-text-size-adjust: 100%;
    }

    .app-layout {
        grid-template-columns: 1fr;
        grid-template-rows: 1fr var(--mobile-nav-h);
        grid-template-areas:
            "main"
            "mobilenav";
    }

    .sidebar {
        display: none;
    }

    .player-bar {
        display: none;
    }

    .mobile-nav {
        display: flex;
        padding-bottom: var(--safe-area-bottom);
    }

    /* Account for mini-player (56px) + bottom nav (56px) + safe area */
    .content-wrapper {
        padding: var(--sp-5) var(--sp-5) calc(var(--mobile-player-h) + var(--sp-8));
    }

    /* --- Hero sections: center on mobile for native app feel --- */
    .hero-section {
        flex-direction: column;
        align-items: center;
        text-align: center;
        gap: var(--sp-5);
    }
    
    .hero-artwork {
        width: 180px;
        height: 180px;
    }
    
    .hero-info {
        align-items: center;
    }
    
    .hero-title {
        font-size: 1.75rem;
    }
    
    .hero-meta {
        justify-content: center;
        flex-wrap: wrap;
    }

    /* --- Library grids --- */
    .library-grid {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
        gap: var(--sp-3);
    }
    
    .album-card,
    .artist-card {
        padding: var(--sp-2);
        margin: calc(var(--sp-2) * -1);
    }
    
    /* --- Track list: mobile-optimized --- */
    .track-list thead {
        display: none;
    }
    .track-list, .track-list tbody {
        display: block;
        width: 100%;
    }
    .track-row {
        display: flex;
        align-items: center;
        padding: var(--sp-3) var(--sp-2);
        min-height: 52px;
        border-bottom: 1px solid var(--c-border-subtle);
        -webkit-tap-highlight-color: transparent;
    }
    .track-row:active {
        background-color: var(--c-surface-active);
    }
    .track-num {
        display: none;
    }
    .track-title-cell {
        flex: 1;
        padding: 0;
        min-width: 0;
    }
    .track-album {
        display: none;
    }
    .track-duration {
        padding: 0;
        margin-left: var(--sp-3);
        flex-shrink: 0;
    }
    .track-actions {
        width: 40px;
        min-width: 40px;
    }

    /* --- Controls bar (sort/filter) --- */
    .controls-bar {
        flex-direction: column;
        align-items: stretch;
        gap: var(--sp-3);
    }
    .sort-select {
        width: 100%;
    }

    /* --- Typography scaling --- */
    .page-title {
        font-size: var(--fs-xl);
    }

    .home-title {
        font-size: var(--fs-2xl);
    }
    
    .section-title {
        font-size: var(--fs-lg);
    }

    /* --- Empty states --- */
    .empty-state {
        padding: var(--sp-10) var(--sp-4);
    }

    .empty-state-icon {
        width: 64px;
        height: 64px;
    }

    /* --- Pagination --- */
    .pagination {
        gap: var(--sp-3);
    }
    .btn-secondary {
        padding: var(--sp-2) var(--sp-4);
        font-size: var(--fs-xs);
    }

    /* --- Auth pages --- */
    .auth-card {
        padding: var(--sp-8) var(--sp-6);
        border-color: transparent;
        background: transparent;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    /* --- Edit Track Modal --- */
    .modal-content {
        width: 95% !important;
        max-width: none !important;
        padding: 1.5rem !important;
        margin: var(--sp-4);
        max-height: 90vh;
        overflow-y: auto;
    }

    /* --- Touch-friendly affordances --- */
    .btn,
    .nav-item,
    .album-card,
    .artist-card,
    .genre-card,
    .mobile-nav-item {
        -webkit-tap-highlight-color: transparent;
    }

    .genre-card {
        padding: var(--sp-4) var(--sp-3);
    }

    /* --- Disc headers --- */
    .disc-header {
        padding: var(--sp-4) var(--sp-2) var(--sp-2);
    }
}


/* ==========================================================
   RESPONSIVE — Mid-range Mobile (≤ 480px)
   ========================================================== */
@media (max-width: 480px) {
    .hero-artwork {
        width: 150px;
        height: 150px;
    }
    
    .hero-title {
        font-size: 1.5rem;
    }

    .library-grid {
        grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
        gap: var(--sp-2);
    }
    
    .home-welcome {
        margin-bottom: var(--sp-8);
    }
    
    .home-subtitle {
        font-size: var(--fs-sm);
    }
    
    .section-header {
        margin-bottom: var(--sp-4);
    }
}


/* ==========================================================
   RESPONSIVE — Small Mobile (≤ 360px)
   ========================================================== */
@media (max-width: 360px) {
    .auth-layout {
        padding: var(--sp-4);
    }

    .content-wrapper {
        padding-left: var(--sp-3);
        padding-right: var(--sp-3);
    }

    .mobile-nav-item {
        padding: var(--sp-2) var(--sp-1);
        font-size: 0.625rem;
    }

    .mobile-nav-icon {
        width: 20px;
        height: 20px;
    }
    
    .hero-artwork {
        width: 130px;
        height: 130px;
    }
    
    .hero-title {
        font-size: 1.375rem;
    }

    .library-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}
