/* ============================================================
   CURATIST — Design System
   ============================================================ */

/* ── Custom Properties — Dark Theme (default) ──────────────────── */
:root,
[data-theme="dark"] {
    --bg:              #0C0E13;
    --surface:         #161921;
    --surface-raised:  #1E2230;
    --border:          #2A2D3E;
    --border-subtle:   #1E2130;
    --text:            #F0F2F5;
    --text-secondary:  #8B8FA8;
    --text-disabled:   #555869;
    --accent:          #C9A257;
    --accent-hover:    #D4B06A;
    --accent-dim:      rgba(201, 162, 87, 0.12);
    --nav-bg:          rgba(12, 14, 19, 0.92);

    /* Shared */
    --accent-text:     #FFFFFF;
    --radius-sm:       4px;
    --radius-md:       8px;
    --radius-lg:       12px;
    --radius-xl:       16px;
    --radius-full:     9999px;
    --font-sans:       'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --shadow-sm:       0 1px 3px rgba(0, 0, 0, 0.15);
    --shadow-md:       0 4px 12px rgba(0, 0, 0, 0.2);
    --shadow-lg:       0 8px 24px rgba(0, 0, 0, 0.3);
    --transition:      150ms ease;
    --nav-height:      64px;
}

/* ── Light Theme ────────────────────────────────────────────────── */
[data-theme="light"] {
    --bg:              #F7F5F0;
    --surface:         #FFFFFF;
    --surface-raised:  #F0EDE6;
    --border:          #E0DDD5;
    --border-subtle:   #EAE8E3;
    --text:            #1A1915;
    --text-secondary:  #6B6860;
    --text-disabled:   #A09D97;
    --accent:          #A07C28;
    --accent-hover:    #8C6B20;
    --accent-dim:      rgba(160, 124, 40, 0.10);
    --nav-bg:          rgba(247, 245, 240, 0.92);
    --shadow-sm:       0 1px 3px rgba(0, 0, 0, 0.08);
    --shadow-md:       0 4px 12px rgba(0, 0, 0, 0.10);
    --shadow-lg:       0 8px 24px rgba(0, 0, 0, 0.14);
}

/* ── System preference fallback (no JS) ─────────────────────────── */
@media (prefers-color-scheme: light) {
    :root:not([data-theme]) {
        --bg:              #F7F5F0;
        --surface:         #FFFFFF;
        --surface-raised:  #F0EDE6;
        --border:          #E0DDD5;
        --border-subtle:   #EAE8E3;
        --text:            #1A1915;
        --text-secondary:  #6B6860;
        --text-disabled:   #A09D97;
        --accent:          #A07C28;
        --accent-hover:    #8C6B20;
        --accent-dim:      rgba(160, 124, 40, 0.10);
        --nav-bg:          rgba(247, 245, 240, 0.92);
        --shadow-sm:       0 1px 3px rgba(0, 0, 0, 0.08);
        --shadow-md:       0 4px 12px rgba(0, 0, 0, 0.10);
        --shadow-lg:       0 8px 24px rgba(0, 0, 0, 0.14);
    }
}

/* ── Smooth theme transitions ────────────────────────────────────── */
*,
*::before,
*::after {
    transition:
        background-color var(--transition),
        border-color var(--transition),
        color var(--transition),
        box-shadow var(--transition);
}

/* ── Reset / Base ────────────────────────────────────────────────── */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-sans);
    font-size: 1rem;
    line-height: 1.6;
    color: var(--text);
    background-color: var(--bg);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    min-height: 100dvh;
}

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

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

a:hover {
    color: var(--accent-hover);
}

button {
    font-family: var(--font-sans);
    cursor: pointer;
    border: none;
    background: none;
}

/* ── Typography Scale ───────────────────────────────────────────── */
h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    line-height: 1.25;
    color: var(--text);
}

h1 { font-size: clamp(1.75rem, 4vw, 2.5rem); }
h2 { font-size: clamp(1.25rem, 2.5vw, 1.75rem); }
h3 { font-size: 1.125rem; }
h4 { font-size: 1rem; }

p { margin-bottom: 0; }

/* ── Layout Shell ───────────────────────────────────────────────── */
.app-shell {
    display: flex;
    flex-direction: column;
    min-height: 100dvh;
}

.main-content {
    flex: 1;
    padding-top: var(--nav-height);
}

/* ── Container ──────────────────────────────────────────────────── */
.container {
    width: 100%;
    max-width: 1200px;
    margin-inline: auto;
    padding-inline: 1.5rem;
}

/* ── Top Navigation ─────────────────────────────────────────────── */
.top-nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    height: var(--nav-height);
    background: var(--nav-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-subtle);
}

.nav-container {
    display: flex;
    align-items: center;
    height: 100%;
    max-width: 1200px;
    margin-inline: auto;
    padding-inline: 1.5rem;
    gap: 1rem;
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    color: var(--text);
    text-decoration: none;
    flex-shrink: 0;
}

.nav-brand:hover {
    color: var(--text);
}

.nav-brand-icon {
    width: 28px;
    height: 28px;
    color: var(--text-secondary);
}

.nav-brand-text {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
}

.nav-brand-name {
    font-size: 1.0625rem;
    font-weight: 600;
    letter-spacing: -0.01em;
    color: var(--text);
}

.nav-brand-version {
    font-size: 0.625rem;
    color: var(--text-disabled);
    letter-spacing: 0.04em;
}

.nav-spacer {
    flex: 1;
}

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

.nav-user-name {
    font-size: 0.875rem;
    color: var(--text-secondary);
    font-weight: 500;
}

/* ── Theme Toggle ───────────────────────────────────────────────── */
.theme-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    background: transparent;
    border: 1px solid var(--border);
    cursor: pointer;
    flex-shrink: 0;
}

.theme-toggle:hover {
    color: var(--text);
    background: var(--surface-raised);
    border-color: var(--border);
}

.theme-toggle svg {
    width: 16px;
    height: 16px;
}

/* Show sun icon in dark mode, moon icon in light mode */
[data-theme="dark"] .theme-toggle .icon-sun  { display: none; }
[data-theme="dark"] .theme-toggle .icon-moon { display: block; }
[data-theme="light"] .theme-toggle .icon-sun  { display: block; }
[data-theme="light"] .theme-toggle .icon-moon { display: none; }
/* Default (dark) */
.theme-toggle .icon-sun  { display: none; }
.theme-toggle .icon-moon { display: block; }

/* ── Buttons ─────────────────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    font-family: var(--font-sans);
    font-size: 0.875rem;
    font-weight: 500;
    line-height: 1;
    border-radius: var(--radius-md);
    border: 1px solid transparent;
    cursor: pointer;
    text-decoration: none;
    white-space: nowrap;
    user-select: none;
    transition: background-color var(--transition), color var(--transition), border-color var(--transition), box-shadow var(--transition);
}

.btn svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

.btn-primary {
    background: var(--accent);
    color: var(--accent-text);
    border-color: var(--accent);
}

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

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
    border-color: var(--border);
}

.btn-ghost:hover {
    background: var(--surface-raised);
    color: var(--text);
    border-color: var(--border);
}

.btn-sm {
    padding: 0.375rem 0.75rem;
    font-size: 0.8125rem;
    border-radius: var(--radius-sm);
}

.btn-lg {
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    border-radius: var(--radius-lg);
}

/* ── Cards ───────────────────────────────────────────────────────── */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

.card-body {
    padding: 1.25rem;
}

/* ── Hero Section ────────────────────────────────────────────────── */
.landing {
    display: flex;
    flex-direction: column;
}

.hero {
    display: grid;
    grid-template-columns: 1fr 1fr;
    align-items: center;
    gap: 4rem;
    min-height: 60vh; /* Reduced from 100dvh minus nav to bring it up */
    max-width: 1200px;
    margin-inline: auto;
    padding: 0.5rem 1.5rem 4rem; /* Top padding reduced significantly */
}

@media (max-width: 768px) {
    .hero {
        grid-template-columns: 1fr;
        min-height: auto;
        padding: 3rem 1.5rem;
        gap: 3rem;
    }

    .hero-visual {
        order: -1;
    }
}

.hero-content {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.hero-eyebrow {
    display: inline-block;
    font-size: 0.8125rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--accent);
}

.hero-title {
    font-size: clamp(2rem, 5vw, 3.25rem);
    font-weight: 700;
    letter-spacing: -0.025em;
    line-height: 1.1;
    color: var(--text);
}

.hero-subtitle {
    font-size: 1.0625rem;
    line-height: 1.7;
    color: var(--text-secondary);
    max-width: 480px;
}

.hero-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-top: 0.5rem;
}

/* ── Vinyl Decoration ────────────────────────────────────────────── */
.hero-visual {
    display: flex;
    align-items: center;
    justify-content: center;
}

.vinyl-preview {
    position: relative;
    width: 320px;
    height: 320px;
    flex-shrink: 0;
}

@media (max-width: 768px) {
    .vinyl-preview {
        width: 200px;
        height: 200px;
    }
}

.vinyl-disc {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background:
        repeating-radial-gradient(
            circle at center,
            rgba(255, 255, 255, 0.03) 0px,
            rgba(255, 255, 255, 0.03) 1px,
            transparent 1px,
            transparent 6px
        ),
        radial-gradient(circle at center, #1a1a2e 0%, #0d0d1a 100%);
    box-shadow: var(--shadow-lg), inset 0 0 40px rgba(0, 0, 0, 0.5);
    animation: vinylSpin 20s linear infinite;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

[data-theme="light"] .vinyl-disc {
    background:
        repeating-radial-gradient(
            circle at center,
            rgba(0, 0, 0, 0.04) 0px,
            rgba(0, 0, 0, 0.04) 1px,
            transparent 1px,
            transparent 6px
        ),
        radial-gradient(circle at center, #2a2a2a 0%, #111111 100%);
}

@keyframes vinylSpin {
    from { transform: rotate(0deg); }
    to   { transform: rotate(360deg); }
}

.vinyl-label {
    width: 38%;
    height: 38%;
    border-radius: 50%;
    background: var(--accent-dim);
    border: 2px solid var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
}

.vinyl-label-text {
    font-size: clamp(0.5rem, 2vw, 0.6875rem);
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--accent);
    /* counter-rotate so text stays readable */
    animation: vinylSpin 20s linear infinite reverse;
}

/* ── Feature Cards ───────────────────────────────────────────────── */
.features {
    background: var(--surface);
    border-top: 1px solid var(--border);
    padding: 5rem 1.5rem;
}

.feature-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 1.5rem;
    max-width: 1200px;
    margin-inline: auto;
}

.feature-card {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    padding: 1.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.875rem;
    transition: border-color var(--transition), box-shadow var(--transition), transform var(--transition);
}

.feature-card:hover {
    border-color: var(--accent);
    box-shadow: var(--shadow-md), 0 0 0 1px var(--accent-dim);
    transform: translateY(-2px);
}

.feature-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: var(--radius-md);
    background: var(--accent-dim);
    color: var(--accent);
}

.feature-icon svg {
    width: 22px;
    height: 22px;
}

.feature-card h3 {
    font-size: 1rem;
    font-weight: 600;
}

.feature-card p {
    font-size: 0.875rem;
    line-height: 1.65;
    color: var(--text-secondary);
}

/* ── Dashboard ───────────────────────────────────────────────────── */
.dashboard {
    max-width: 1200px;
    margin-inline: auto;
    padding: 2.5rem 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 2.5rem;
}

.dashboard-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}

.dashboard-greeting {
    font-size: clamp(1.5rem, 3vw, 2rem);
    font-weight: 700;
    letter-spacing: -0.02em;
    margin-bottom: 0.25rem;
}

.dashboard-section {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

/* ── Collection Grid ─────────────────────────────────────────────── */
.collection-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
}

.collection-card {
    border-radius: var(--radius-lg);
    aspect-ratio: 1;
    position: relative;
    overflow: hidden;
    cursor: pointer;
    background-color: var(--surface);
    background-size: cover;
    background-position: center;
    transition: box-shadow var(--transition), transform var(--transition);
}

/* Dark tinted glass overlay */
.collection-card::before {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    border-radius: inherit;
    pointer-events: none;
    z-index: 0;
}

/* Subtle inner border sheen */
.collection-card::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    border: 1px solid rgba(255, 255, 255, 0.10);
    pointer-events: none;
    z-index: 3;
    transition: border-color var(--transition);
}

.collection-card:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
}

.collection-card:hover::after {
    border-color: var(--accent);
}

/* Bottom gradient fade for text legibility */
.collection-card-link {
    display: flex;
    width: 100%;
    height: 100%;
    flex-direction: column;
    justify-content: flex-end;
    align-items: flex-start;
    padding: 0.875rem 1rem;
    gap: 0.25rem;
    text-decoration: none;
    color: #fff;
    position: relative;
    z-index: 1;
    background: linear-gradient(to top, rgba(0,0,0,0.70) 0%, rgba(0,0,0,0) 55%);
}

.collection-card-actions {
    position: absolute;
    top: 0.625rem;
    right: 0.625rem;
    z-index: 2;
}

.collection-add-item-btn {
    width: 1.75rem;
    height: 1.75rem;
    border-radius: var(--radius-full);
    border: 1px solid rgba(255, 255, 255, 0.25);
    background: rgba(0, 0, 0, 0.35);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    line-height: 1;
    font-weight: 600;
    text-decoration: none;
    backdrop-filter: blur(4px);
}

.collection-add-item-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: rgba(0, 0, 0, 0.55);
}

/* Type badge anchored top-left inside card */
.collection-type-badge {
    position: absolute;
    top: 0.625rem;
    left: 0.625rem;
    z-index: 2;
    backdrop-filter: blur(6px);
    background: rgba(201, 162, 87, 0.85) !important;
    color: #0c0c0a !important;
    font-size: 0.6875rem;
    font-weight: 600;
    padding: 0.2rem 0.55rem;
    border-radius: var(--radius-full);
    border: none;
    pointer-events: none;
}

.collection-card-name {
    font-size: 0.9375rem;
    font-weight: 600;
    color: #fff;
    margin: 0;
    line-height: 1.2;
    text-shadow: 0 1px 4px rgba(0,0,0,0.5);
}

.collection-card-view {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.65);
    margin: 0;
}

.collection-card.add-card {
    border-style: dashed;
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.collection-card.add-card svg {
    width: 28px;
    height: 28px;
    opacity: 0.5;
}

.collection-card.add-card:hover {
    color: var(--accent);
    border-color: var(--accent);
    background: var(--accent-dim);
}

.collection-card.add-card:hover svg {
    opacity: 1;
}

/* ── Section Header ──────────────────────────────────────────────── */
.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.section-header h2 {
    font-size: 1.0625rem;
    font-weight: 600;
}

/* ── Recently Updated ────────────────────────────────────────────── */
.recently-updated {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.recently-updated.empty-state {
    padding: 2.5rem;
    text-align: center;
}

.recent-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.875rem 1.25rem;
    border-bottom: 1px solid var(--border-subtle);
    transition: background-color var(--transition);
}

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

.recent-item:hover {
    background: var(--surface-raised);
}

/* ── Badges / Tags ───────────────────────────────────────────────── */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.1875rem 0.5rem;
    font-size: 0.6875rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    border-radius: var(--radius-full);
    background: var(--accent-dim);
    color: var(--accent);
}

/* ── Utility Classes ─────────────────────────────────────────────── */
.text-muted     { color: var(--text-secondary); }
.text-accent    { color: var(--accent); }
.text-secondary { color: var(--text-secondary); }
.text-disabled  { color: var(--text-disabled); }

.mt-1 { margin-top: 0.25rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-3 { margin-top: 0.75rem; }
.mt-4 { margin-top: 1rem; }

.search-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.search-results {
    display: grid;
    gap: 0.5rem;
}

.search-result-card {
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--surface-raised);
    color: var(--text);
    padding: 0.625rem 0.75rem;
    text-align: left;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.search-result-card:hover {
    border-color: var(--accent);
}

.scanner-video {
    width: 100%;
    max-width: 24rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: #000;
    aspect-ratio: 3 / 4;
    object-fit: cover;
    display: block;
}

.scanner-video-large {
    max-width: 100%;
    max-height: min(70vh, 40rem);
}

.capture-sheet-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(8, 12, 18, 0.78);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    z-index: 1200;
    backdrop-filter: blur(8px);
}

.capture-sheet {
    width: min(100%, 34rem);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: 0 1.5rem 3rem rgba(0, 0, 0, 0.35);
    padding: 1rem;
}

.capture-sheet-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 0.75rem;
}

.capture-sheet-header h3 {
    margin: 0;
    font-size: 1.05rem;
}

.capture-sheet-header p {
    margin: 0.25rem 0 0;
}

.capture-sheet-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.capture-status {
    display: flex;
    align-items: center;
    gap: 0.9rem;
    padding: 0.9rem 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--surface-raised);
}

.external-links {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.ai-assessment-card {
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 14px;
    padding: 1rem 1.1rem;
    background: rgba(255, 255, 255, 0.03);
}

.ai-assessment-header {
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    margin-bottom: 0.65rem;
    opacity: 0.8;
}

.ai-assessment-values {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.ai-assessment-disclaimer {
    margin: 0;
    font-size: 0.92rem;
    line-height: 1.45;
    opacity: 0.8;
}

.capture-spinner {
    width: 1.1rem;
    height: 1.1rem;
    border-radius: 50%;
    border: 2px solid color-mix(in srgb, var(--text) 20%, transparent);
    border-top-color: var(--accent);
    animation: capture-spin 0.9s linear infinite;
    flex: 0 0 auto;
}

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

.unified-search-wrap {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.unified-search-shell {
    position: relative;
    display: flex;
    align-items: center;
}

.unified-search-input {
    width: 100%;
    padding-right: 8rem;
}

.search-icon-btn {
    width: 2rem;
    height: 2rem;
    border-radius: var(--radius-full);
    border: 1px solid var(--border);
    background: var(--surface-raised);
    color: var(--text);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 700;
    line-height: 1;
    position: absolute;
    right: 3rem;
    cursor: pointer;
}

.text-search-btn {
    right: 5.5rem;
}

.search-icon-btn svg {
    width: 1rem;
    height: 1rem;
}

.barcode-btn {
    right: 3rem;
}

.camera-btn {
    right: 0.5rem;
}

.search-icon-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.cover-upload-hidden {
    display: none;
}
.mt-6 { margin-top: 1.5rem; }
.mt-8 { margin-top: 2rem; }

.mb-1 { margin-bottom: 0.25rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-3 { margin-bottom: 0.75rem; }
.mb-4 { margin-bottom: 1rem; }
.mb-6 { margin-bottom: 1.5rem; }
.mb-8 { margin-bottom: 2rem; }

/* ── Blazor Error UI ─────────────────────────────────────────────── */
#blazor-error-ui {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: #b91c1c;
    color: #fff;
    padding: 0.75rem 1.5rem;
    font-size: 0.875rem;
    display: none;
    z-index: 1000;
    gap: 1rem;
    align-items: center;
    justify-content: center;
}

#blazor-error-ui[data-nosnippet] {
    display: none;
}

#blazor-error-ui .reload {
    color: #fff;
    text-decoration: underline;
    font-weight: 600;
}

#blazor-error-ui .dismiss {
    cursor: pointer;
    font-size: 1rem;
    margin-left: auto;
}

a, .btn-link {
    color: #006bb7;
}

.btn-primary {
    color: #fff;
    background-color: #1b6ec2;
    border-color: #1861ac;
}

.btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-check-input:focus {
  box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem #258cfb;
}

.content {
    padding-top: 1.1rem;
}

h1:focus {
    outline: none;
}

.valid.modified:not([type=checkbox]) {
    outline: 1px solid #26b050;
}

.invalid {
    outline: 1px solid #e50000;
}

.validation-message {
    color: #e50000;
}

.blazor-error-boundary {
    background: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTYiIGhlaWdodD0iNDkiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIG92ZXJmbG93PSJoaWRkZW4iPjxkZWZzPjxjbGlwUGF0aCBpZD0iY2xpcDAiPjxyZWN0IHg9IjIzNSIgeT0iNTEiIHdpZHRoPSI1NiIgaGVpZ2h0PSI0OSIvPjwvY2xpcFBhdGg+PC9kZWZzPjxnIGNsaXAtcGF0aD0idXJsKCNjbGlwMCkiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC0yMzUgLTUxKSI+PHBhdGggZD0iTTI2My41MDYgNTFDMjY0LjcxNyA1MSAyNjUuODEzIDUxLjQ4MzcgMjY2LjYwNiA1Mi4yNjU4TDI2Ny4wNTIgNTIuNzk4NyAyNjcuNTM5IDUzLjYyODMgMjkwLjE4NSA5Mi4xODMxIDI5MC41NDUgOTIuNzk1IDI5MC42NTYgOTIuOTk2QzI5MC44NzcgOTMuNTEzIDI5MSA5NC4wODE1IDI5MSA5NC42NzgyIDI5MSA5Ny4wNjUxIDI4OS4wMzggOTkgMjg2LjYxNyA5OUwyNDAuMzgzIDk5QzIzNy45NjMgOTkgMjM2IDk3LjA2NTEgMjM2IDk0LjY3ODIgMjM2IDk0LjM3OTkgMjM2LjAzMSA5NC4wODg2IDIzNi4wODkgOTMuODA3MkwyMzYuMzM4IDkzLjAxNjIgMjM2Ljg1OCA5Mi4xMzE0IDI1OS40NzMgNTMuNjI5NCAyNTkuOTYxIDUyLjc5ODUgMjYwLjQwNyA1Mi4yNjU4QzI2MS4yIDUxLjQ4MzcgMjYyLjI5NiA1MSAyNjMuNTA2IDUxWk0yNjMuNTg2IDY2LjAxODNDMjYwLjczNyA2Ni4wMTgzIDI1OS4zMTMgNjcuMTI0NSAyNTkuMzEzIDY5LjMzNyAyNTkuMzEzIDY5LjYxMDIgMjU5LjMzMiA2OS44NjA4IDI1OS4zNzEgNzAuMDg4N0wyNjEuNzk1IDg0LjAxNjEgMjY1LjM4IDg0LjAxNjEgMjY3LjgyMSA2OS43NDc1QzI2Ny44NiA2OS43MzA5IDI2Ny44NzkgNjkuNTg3NyAyNjcuODc5IDY5LjMxNzkgMjY3Ljg3OSA2Ny4xMTgyIDI2Ni40NDggNjYuMDE4MyAyNjMuNTg2IDY2LjAxODNaTTI2My41NzYgODYuMDU0N0MyNjEuMDQ5IDg2LjA1NDcgMjU5Ljc4NiA4Ny4zMDA1IDI1OS43ODYgODkuNzkyMSAyNTkuNzg2IDkyLjI4MzcgMjYxLjA0OSA5My41Mjk1IDI2My41NzYgOTMuNTI5NSAyNjYuMTE2IDkzLjUyOTUgMjY3LjM4NyA5Mi4yODM3IDI2Ny4zODcgODkuNzkyMSAyNjcuMzg3IDg3LjMwMDUgMjY2LjExNiA4Ni4wNTQ3IDI2My41NzYgODYuMDU0N1oiIGZpbGw9IiNGRkU1MDAiIGZpbGwtcnVsZT0iZXZlbm9kZCIvPjwvZz48L3N2Zz4=) no-repeat 1rem/1.8rem, #b32121;
    padding: 1rem 1rem 1rem 3.7rem;
    color: white;
}

    .blazor-error-boundary::after {
        content: "An error has occurred."
    }

.darker-border-checkbox.form-check-input {
    border-color: #929292;
}

.form-floating > .form-control-plaintext::placeholder, .form-floating > .form-control::placeholder {
    color: var(--bs-secondary-color);
    text-align: end;
}

.form-floating > .form-control-plaintext:focus::placeholder, .form-floating > .form-control:focus::placeholder {
    text-align: start;
}
/* ── Vinyl CRUD Form ───────────────────────────────────────────── */
.add-form-panel {
    padding: 1.25rem;
}

/* Allow absolutely-positioned dropdowns (e.g. typeahead) to escape the panel */
.recently-updated.add-form-panel {
    overflow: visible;
}

.vinyl-form-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.75rem;
}

.vinyl-form-field {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.vinyl-form-field-wide {
    grid-column: span 3;
}

.vinyl-form-field label {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.vinyl-input {
    width: 100%;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--surface-raised);
    color: var(--text);
    padding: 0.55rem 0.65rem;
    outline: none;
}

.vinyl-input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px var(--accent-dim);
}

.vinyl-record-card {
    cursor: default;
    align-items: flex-start;
    text-align: left;
    justify-content: flex-start;
}

@media (max-width: 900px) {
    .vinyl-form-grid {
        grid-template-columns: 1fr;
    }

    .vinyl-form-field-wide {
        grid-column: span 1;
    }
}

/* ── Cover Previews ────────────────────────────────────────────── */
.cover-preview-large {
    width: 200px; /* At least 100px as requested, 200px looks better on large forms */
    height: 200px;
    object-fit: cover;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border);
}

.item-detail-preview {
    display: flex;
    gap: 1.5rem;
    align-items: flex-start;
}

.cover-preview-prominent {
    width: 200px;
    height: 200px;
    object-fit: cover;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border);
}

.item-thumbnail {
    width: 64px;
    height: 64px;
    object-fit: cover;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-subtle);
    flex-shrink: 0;
}

.empty-thumbnail {
    background: var(--surface-raised);
    display: flex;
    align-items: center;
    justify-content: center;
}

@media (max-width: 600px) {
    .item-detail-preview {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }
}

/* ── Splash Hero ──────────────────────────────────────────────── */
.splash-hero {
    width: min(420px, 85vw);
    height: min(420px, 85vw); /* Square */
    object-fit: cover;
    object-position: center;
    filter: drop-shadow(0 18px 40px rgba(0, 0, 0, 0.22));
    border-radius: var(--radius-lg);
}

/* ── Listen Dropdown ─────────────────────────────────────────── */
.listen-dropdown-wrap {
    display: inline-flex;
    align-items: center;
    position: relative;
}

.listen-btn {
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
}

.dropdown-trigger {
    position: relative;
    display: inline-block;
}

.dropdown-toggle-btn {
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
    padding-left: 4px;
    padding-right: 4px;
    min-width: 24px;
    border-left: 1px solid rgba(255, 255, 255, 0.2);
}

.listen-dropdown-menu {
    position: absolute;
    top: 100%;
    right: 0;
    background: var(--surface-raised);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    display: none;
    flex-direction: column;
    z-index: 100;
    min-width: 140px;
    margin-top: 4px;
    overflow: hidden;
}

.dropdown-trigger:hover .listen-dropdown-menu {
    display: flex;
}

.listen-dropdown-menu button {
    padding: 0.625rem 1rem;
    text-align: left;
    font-size: 0.8125rem;
    color: var(--text-secondary);
    width: 100%;
    transition: background 150ms;
}

.listen-dropdown-menu button:hover {
    background: var(--surface);
    color: var(--text);
}

.listen-dropdown-menu button.active {
    color: var(--accent);
    font-weight: 600;
}

/* ── User Dropdown ────────────────────────────────────────────── */
.user-dropdown {
    position: relative;
    display: inline-block;
}

/* Invisible bridge fills the gap between button and menu so hover isn't lost */
.user-dropdown::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    height: 0.5rem;
}

.user-dropdown .nav-user-name {
    display: flex;
    align-items: center;
    padding: 0.5rem 0.75rem;
    border-radius: var(--radius-md);
    transition: background 150ms;
    border: none;
    background: transparent;
    cursor: pointer;
    font-size: 0.875rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.user-dropdown:hover .nav-user-name {
    background: var(--surface-raised);
    color: var(--text);
}

.user-dropdown-menu {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 0.5rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    min-width: 160px;
    display: flex;
    flex-direction: column;
    z-index: 1000;
    overflow: hidden;
    visibility: hidden;
    opacity: 0;
    pointer-events: none;
    transition: opacity 150ms ease, visibility 0s linear 2500ms;
}

.user-dropdown:hover .user-dropdown-menu {
    visibility: visible;
    opacity: 1;
    pointer-events: auto;
    transition: opacity 150ms ease, visibility 0s linear 0ms;
}

.user-dropdown-menu a {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    font-size: 0.875rem;
    color: var(--text-secondary);
    transition: all 150ms;
    text-decoration: none;
}

.user-dropdown-menu a:hover {
    background: var(--surface-raised);
    color: var(--text);
}

.user-dropdown-menu a svg {
    opacity: 0.7;
}

.user-dropdown-menu a.text-danger:hover {
    color: #ef4444;
    background: rgba(239, 68, 68, 0.08);
}

.p-3 { padding: 1rem; }

.border-bottom { border-bottom: 1px solid var(--border-subtle); }

.list-controls {
    display: flex;
    gap: 1rem;
    background: var(--surface);
}

.search-box-wrap { flex: 2; }
.sort-box-wrap { flex: 1; }

.items-list-container {
    display: flex;
    flex-direction: column;
}

/* ── Swipe to Delete ─────────────────────────────────────────── */
.swipe-container {
    position: relative;
    overflow: hidden;
    background: #e50000; /* Red delete background */
}

.swipe-actions-under {
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    width: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1;
}

.swipe-delete-action {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    cursor: pointer;
}

.swipe-item {
    position: relative;
    z-index: 2;
    background: var(--surface);
    transition: transform 0.3s ease;
    touch-action: pan-y;
}

/* On mobile/touch, we can use :active or a small JS helper, 
   but for CSS-only we can simulate with hover on desktop 
   or just rely on the delete icon. 
   Let's add a class that can be toggled if we want full swipe.
*/
.swipe-container:hover .swipe-item {
    /* Optional: peek on hover */
    /* transform: translateX(-20px); */
}

/* ── Icon Buttons ────────────────────────────────────────────── */
.icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: var(--radius-full);
    color: var(--text-secondary);
    transition: all var(--transition);
    background: transparent;
}

.icon-btn:hover {
    background: var(--surface-raised);
    color: var(--accent);
}

.icon-btn.text-danger:hover {
    color: #ef4444;
    background: rgba(239, 68, 68, 0.1);
}

.recent-item-details {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.recent-item-actions {
    margin-left: auto;
    display: flex;
    gap: 0.25rem;
}

@media (max-width: 600px) {
    .d-none-mobile { display: none; }
    .list-controls { flex-direction: column; }
}

.auth-shell {
    min-height: calc(100vh - 84px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.auth-status-card {
    width: min(560px, 100%);
    padding: 2rem;
    border-radius: var(--radius-lg);
    background: var(--surface);
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: var(--shadow-lg);
    display: grid;
    gap: 1rem;
    text-align: center;
}

.auth-status-card h1 {
    margin: 0;
}

.auth-status-card p {
    margin: 0;
    color: var(--text-secondary);
}

.auth-status-card-error {
    border-color: rgba(239, 68, 68, 0.35);
}

.auth-spinner {
    width: 48px;
    height: 48px;
    margin: 0 auto;
    border-radius: 999px;
    border: 3px solid rgba(255, 255, 255, 0.12);
    border-top-color: var(--accent);
    animation: auth-spin 0.9s linear infinite;
}

.auth-timeout-panel {
    display: grid;
    gap: 1rem;
    padding-top: 0.5rem;
}

@keyframes auth-spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* Catalog lock */
.catalog-lock-notice {
    display: flex;
    align-items: center;
    padding: 0.5rem 0.75rem;
    border-radius: var(--radius);
    background: var(--accent-dim);
    color: var(--text-secondary);
    font-size: 0.8125rem;
}

.catalog-field-badge {
    display: inline-block;
    margin-left: 0.4rem;
    padding: 0.0625rem 0.375rem;
    font-size: 0.625rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    border-radius: var(--radius-full);
    background: var(--accent-dim);
    color: var(--text-secondary);
    vertical-align: middle;
}

/* Catalog candidates panel */
.catalog-candidates-panel {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem;
    background: var(--surface-raised);
}

.catalog-candidates-title {
    font-weight: 600;
    margin-bottom: 0.75rem;
}

.catalog-candidate-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    width: 100%;
    padding: 0.625rem 0.75rem;
    margin-bottom: 0.5rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    cursor: pointer;
    text-align: left;
    transition: border-color 0.15s, background 0.15s;
}

.catalog-candidate-card:hover {
    border-color: var(--accent);
    background: var(--accent-dim);
}

.catalog-candidate-info {
    min-width: 0;
}

.catalog-confidence {
    flex-shrink: 0;
    font-size: 0.75rem;
    color: var(--text-secondary);
    white-space: nowrap;
}

.catalog-new-version-badge {
    display: inline-block;
    margin-left: 0.35rem;
    padding: 0.0625rem 0.35rem;
    font-size: 0.625rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    border-radius: var(--radius-full);
    background: var(--accent-dim);
    color: var(--accent);
    vertical-align: middle;
}
