/* ===== CSS Reset & Variables ===== */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

:root {
    /* Colors - Mystical Forest with Vibrant Moss Accents */
    --c-primary: #4a6b52;
    --c-primary-dark: #2f453a;
    --c-primary-light: #8cb896;
    --c-accent: #a8d4ae;
    --c-accent-glow: #7ec989;
    --c-bg-dark: #0c1210;
    --c-bg-darker: #080c0a;
    --c-bg-page: #121a16;
    --c-bg-card: #1a2620;
    --c-bg-card-light: #212e28;
    --c-bg-card-alt: #1e2a24;
    --c-bg-surface: #161e1a;
    --c-text: #d4e0d8;
    --c-text-muted: #7a9484;
    --c-success: #4a8a62;
    --c-error: #c45a5a;
    --c-warning: #c9944a;
    --c-bricklink: #0055BF;
    
    /* Spacing */
    --space-xs: 4px;
    --space-sm: 8px;
    --space-md: 12px;
    --space-lg: 16px;
    --space-xl: 20px;
    --space-2xl: 24px;
    
    /* Border Radius */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    --radius-full: 50%;
    
    /* Transitions */
    --transition-fast: 0.2s ease;
    --transition-normal: 0.3s ease;
    
    /* Safe Areas */
    --safe-top: max(env(safe-area-inset-top, 20px), 50px);
    --safe-bottom: max(env(safe-area-inset-bottom, 20px), 30px);
}

html { background: var(--c-bg-darker); }

body {
    font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', system-ui, sans-serif;
    background: linear-gradient(180deg, var(--c-bg-dark) 0%, var(--c-bg-darker) 100%);
    min-height: 100vh;
    position: fixed;
    inset: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    color: var(--c-text);
    line-height: 1.5;
}

/* ===== Animated Stars Background ===== */
.stars {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
}

.star {
    position: absolute;
    animation: twinkle 3s ease-in-out infinite;
}

.star svg { fill: rgba(255, 255, 255, 0.6); width: 10px; height: 10px; }
.star:nth-child(odd) svg { width: 12px; height: 12px; }
.star:nth-child(even) svg { width: 8px; height: 8px; }
.star:nth-child(3n) svg { fill: rgba(168, 212, 174, 0.5); width: 10px; height: 10px; }
.star:nth-child(5n) svg { width: 6px; height: 6px; }
.star:nth-child(7n) svg { width: 14px; height: 14px; fill: rgba(255, 255, 255, 0.45); }

@keyframes twinkle { 
    0%, 100% { opacity: 0.3; transform: scale(1); } 
    50% { opacity: 1; transform: scale(1.2); } 
}

/* ===== Header ===== */
.header {
    padding: var(--space-sm) var(--space-lg);
    padding-top: var(--safe-top);
    text-align: center;
    flex-shrink: 0;
    position: relative;
    z-index: 1;
}

.brand-arc {
    width: 220px;
    height: 50px;
    margin: 0 auto -12px;
}

.brand-arc text {
    font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', system-ui, sans-serif;
    font-size: 20px;
    font-weight: 600;
    letter-spacing: 1px;
    fill: var(--c-text-muted);
}

.brand-icon {
    width: 55px;
    height: 55px;
    margin: 0 auto 2px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.brand-icon svg { width: 100%; height: 100%; fill: var(--c-accent); }

.app-title {
    font-size: 44px;
    font-weight: 700;
    letter-spacing: 2px;
    background: linear-gradient(135deg, var(--c-accent) 0%, var(--c-accent-glow) 40%, var(--c-primary-light) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* ===== Main Content ===== */
.main {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: var(--space-lg);
    padding-bottom: var(--safe-bottom);
    gap: var(--space-md);
    position: relative;
    z-index: 1;
    min-height: 0;
    overflow: hidden;
}

/* ===== Action Buttons ===== */
.action-btn {
    border-radius: var(--radius-full);
    background: rgba(26, 38, 32, 0.9);
    border: 2px solid rgba(74, 107, 82, 0.25);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--c-text-muted);
    cursor: pointer;
    transition: all var(--transition-normal);
    position: relative;
}

.action-btn svg { transition: all var(--transition-normal); }

.action-btn.active {
    border-color: var(--c-accent-glow);
    color: var(--c-accent);
    box-shadow: 0 0 25px rgba(126, 201, 137, 0.4);
}

.action-btn.active:active { transform: scale(0.95); }

.action-btn--camera { width: 140px; height: 140px; }
.action-btn--camera.active {
    background: radial-gradient(circle at center, rgba(26, 38, 32, 0.9) 0%, var(--c-primary-dark) 100%);
}
.action-btn--camera.active::before {
    content: '';
    position: absolute;
    inset: -2px;
    border-radius: var(--radius-full);
    background: conic-gradient(from 0deg, transparent, var(--c-primary), transparent);
    animation: rotate 3s linear infinite;
    z-index: -1;
}
.action-btn--camera svg { width: 50px; height: 50px; }

.action-btn--photo { width: 100px; height: 100px; }
.action-btn--photo svg { width: 40px; height: 40px; }

.action-btn--manual { width: 80px; height: 80px; }
.action-btn--manual svg { width: 32px; height: 32px; }

.action-btn--settings { width: 60px; height: 60px; }
.action-btn--settings svg { width: 24px; height: 24px; }

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

/* ===== Error Tooltip ===== */
.error-tooltip {
    position: fixed;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(239, 68, 68, 0.95);
    color: white;
    padding: 14px 24px;
    border-radius: var(--radius-md);
    font-size: 15px;
    font-weight: 600;
    opacity: 0;
    visibility: hidden;
    transition: opacity var(--transition-normal);
    z-index: 998;
    text-align: center;
    white-space: nowrap;
}

.error-tooltip.show { opacity: 1; visibility: visible; }

.error-tooltip::after {
    content: '';
    position: absolute;
    bottom: -12px;
    left: 50%;
    transform: translateX(-50%);
    border: 12px solid transparent;
    border-top-color: rgba(239, 68, 68, 0.95);
    border-bottom: none;
}

/* ===== Modal Base ===== */
.modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(8px);
    display: flex;
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-normal);
    z-index: 2000;
}

.modal.active { opacity: 1; visibility: visible; }

/* ===== Settings Modal ===== */
.modal--settings {
    align-items: flex-end;
    justify-content: center;
}

.settings-panel {
    background: var(--c-bg-page);
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    padding: var(--space-xl);
    padding-bottom: var(--safe-bottom);
    width: 100%;
    max-width: 500px;
    max-height: 85vh;
    overflow-y: auto;
    transform: translateY(100%);
    transition: transform 0.4s ease;
}

.modal--settings.active .settings-panel { transform: translateY(0); }

.settings-handle {
    width: 40px;
    height: 5px;
    background: var(--c-bg-card-light);
    border-radius: 3px;
    margin: 0 auto var(--space-lg);
}

.settings-title {
    font-size: 22px;
    font-weight: 700;
    text-align: center;
    margin-bottom: var(--space-xl);
    background: linear-gradient(135deg, var(--c-accent) 0%, var(--c-primary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* ===== Settings Card ===== */
.settings-card {
    background: var(--c-bg-card);
    border-radius: var(--radius-lg);
    margin-bottom: var(--space-md);
    overflow: hidden;
    border: 1px solid rgba(74, 107, 82, 0.2);
    transition: all var(--transition-normal);
}

.settings-card.disabled { opacity: 0.5; pointer-events: none; }

.settings-card__header {
    padding: var(--space-lg);
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
}

.settings-card__title { font-size: 16px; font-weight: 600; color: var(--c-text); }
.settings-card__subtitle { font-size: 12px; color: var(--c-text-muted); margin-top: 2px; }

.settings-card__status {
    font-size: 13px;
    font-weight: 600;
    color: var(--c-success);
}

.settings-card__status.disconnected { color: var(--c-primary-light); }

.settings-card__body {
    padding: 0 var(--space-lg) var(--space-lg);
    display: none;
}

.settings-card__body.expanded { display: block; }

/* ===== Toggle Switch ===== */
.toggle {
    width: 51px;
    height: 31px;
    background: var(--c-bg-surface);
    border-radius: var(--radius-lg);
    position: relative;
    cursor: pointer;
    transition: background var(--transition-normal);
    flex-shrink: 0;
    border: none;
}

.toggle.active { background: var(--c-primary); }

.toggle::after {
    content: '';
    position: absolute;
    width: 27px;
    height: 27px;
    background: white;
    border-radius: var(--radius-full);
    top: 2px;
    left: 2px;
    transition: transform var(--transition-normal);
    box-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.toggle.active::after { transform: translateX(20px); }

/* ===== Form Elements ===== */
.form-group { margin-bottom: 14px; }

.form-label {
    display: block;
    font-size: 11px;
    font-weight: 600;
    color: var(--c-text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 6px;
}

.form-input {
    width: 100%;
    padding: 12px 14px;
    background: var(--c-bg-surface);
    border: 1px solid rgba(74, 107, 82, 0.3);
    border-radius: 10px;
    font-size: 16px;
    color: var(--c-text);
    transition: all var(--transition-fast);
}

.form-input:focus {
    outline: none;
    border-color: var(--c-primary);
    box-shadow: 0 0 0 3px rgba(74, 107, 82, 0.2);
}

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

/* ===== Buttons ===== */
.btn {
    width: 100%;
    padding: 14px;
    border: none;
    border-radius: var(--radius-md);
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.btn--primary {
    background: linear-gradient(135deg, var(--c-primary) 0%, var(--c-primary-dark) 100%);
    color: white;
}

.btn--primary:disabled { background: var(--c-bg-surface); color: var(--c-text-muted); cursor: not-allowed; }

.btn--secondary {
    background: var(--c-bg-card);
    color: var(--c-text);
    border: 1px solid rgba(74, 107, 82, 0.3);
}

/* ===== Auth Links ===== */
.auth-links {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
    margin: var(--space-md) 0;
}

.auth-link {
    color: var(--c-primary-light);
    font-size: 13px;
    text-decoration: none;
    text-align: center;
}

/* ===== Alert ===== */
.alert {
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    margin-bottom: var(--space-md);
    display: none;
}

.alert.active { display: block; }
.alert--error { background: var(--c-error); color: white; }

/* ===== Hidden File Inputs ===== */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

/* ===== Toast Notification ===== */
.toast {
    position: fixed;
    top: 45%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: var(--c-bg-card);
    border: 2px solid var(--c-primary);
    color: var(--c-text);
    padding: var(--space-lg) var(--space-2xl);
    border-radius: var(--radius-lg);
    font-size: 16px;
    font-weight: 600;
    text-align: center;
    max-width: 280px;
    opacity: 0;
    visibility: hidden;
    transition: all 0.25s ease;
    z-index: 3000;
    box-shadow: 0 10px 40px rgba(74, 107, 82, 0.3);
}

.toast.show { opacity: 1; visibility: visible; }

/* ===== Manual Entry Modal ===== */
.modal--center {
    align-items: center;
    justify-content: center;
    padding: var(--space-xl);
}

.modal-card {
    background: var(--c-bg-card);
    border-radius: var(--radius-xl);
    padding: var(--space-2xl);
    width: 100%;
    max-width: 340px;
    border: 1px solid var(--c-primary);
}

.modal-card__title {
    font-size: 20px;
    font-weight: 700;
    text-align: center;
    margin-bottom: var(--space-xl);
    color: var(--c-accent);
}

.modal-card__input {
    width: 100%;
    padding: 14px var(--space-lg);
    background: var(--c-bg-surface);
    border: 1px solid rgba(74, 107, 82, 0.3);
    border-radius: var(--radius-md);
    font-size: 18px;
    color: var(--c-text);
    text-align: center;
    margin-bottom: var(--space-lg);
}

.modal-card__input:focus { outline: none; border-color: var(--c-primary); }

.modal-card__actions { display: flex; gap: 10px; }
.modal-card__actions .btn { flex: 1; }

/* ===== Image Preview Modal ===== */
.modal--preview {
    background: rgba(0,0,0,0.95);
    align-items: center;
    justify-content: center;
    z-index: 30000;
    padding: var(--space-xl);
}

.preview-img {
    max-width: 90%;
    max-height: 80vh;
    object-fit: contain;
    border-radius: var(--radius-lg);
    background: white;
}

.preview-close {
    position: absolute;
    top: var(--safe-top);
    right: var(--space-xl);
    width: 44px;
    height: 44px;
    background: rgba(255,255,255,0.2);
    border: none;
    border-radius: var(--radius-full);
    color: white;
    font-size: 24px;
    cursor: pointer;
}

/* ===== Page Slide ===== */
.page {
    position: fixed;
    inset: 0;
    background: var(--c-bg-page);
    transform: translateX(100%);
    transition: transform var(--transition-normal);
    display: flex;
    flex-direction: column;
    z-index: 10000;
}

.page.active { transform: translateX(0); }
.page--detail { z-index: 10001; }

/* ===== Page Header ===== */
.page-header {
    background: var(--c-bg-card);
    padding: var(--space-md) var(--space-xl);
    padding-top: max(env(safe-area-inset-top, 12px), 12px);
    border-bottom: 1px solid rgba(74, 107, 82, 0.2);
    display: flex;
    align-items: center;
}

.back-btn {
    background: none;
    border: none;
    color: var(--c-primary-light);
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: var(--space-xs);
    padding: var(--space-sm);
}

.page-title {
    flex: 1;
    font-size: 18px;
    font-weight: 600;
    text-align: center;
    color: var(--c-text);
}

/* ===== Results Content ===== */
.results-content {
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: var(--space-lg);
}

.results-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px var(--space-xl);
    color: var(--c-text-muted);
    gap: var(--space-xl);
}

/* ===== Magic Loader ===== */
.loader {
    position: relative;
    width: 80px;
    height: 80px;
}

.loader--sm { width: 60px; height: 60px; }

.loader::before, .loader::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: var(--radius-full);
    border: 3px solid transparent;
}

.loader::before {
    border-top-color: var(--c-primary);
    border-right-color: var(--c-primary);
    animation: spin 1.2s ease-in-out infinite;
}

.loader::after {
    inset: 8px;
    border-bottom-color: var(--c-accent);
    border-left-color: var(--c-accent);
    animation: spin 1.2s ease-in-out infinite reverse;
}

.loader--sm::after { inset: 6px; }

.loader__orb {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 20px;
    height: 20px;
    background: radial-gradient(circle, var(--c-accent) 0%, var(--c-primary) 100%);
    border-radius: var(--radius-full);
    animation: pulse 1.2s ease-in-out infinite;
    box-shadow: 0 0 20px var(--c-accent-glow);
}

.loader--sm .loader__orb { width: 14px; height: 14px; }

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse {
    0%, 100% { transform: translate(-50%, -50%) scale(1); opacity: 1; }
    50% { transform: translate(-50%, -50%) scale(1.3); opacity: 0.7; }
}

/* ===== No Results ===== */
.no-results {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    text-align: center;
    color: var(--c-text-muted);
    padding: 40px;
}

.no-results__icon { font-size: 60px; margin-bottom: var(--space-xl); opacity: 0.5; }
.no-results__title { font-size: 20px; font-weight: 600; color: var(--c-text); margin-bottom: var(--space-sm); }

/* ===== Result Card ===== */
.card-wrap {
    position: relative;
    margin-bottom: var(--space-md);
    overflow: hidden;
    border-radius: var(--radius-lg);
}

.card-action {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    width: 100px;
    background: var(--c-bricklink);
    border-radius: var(--radius-lg);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: var(--space-xs);
    color: white;
    cursor: pointer;
    border: none;
}

.card-action svg { width: 50px; height: 50px; }
.card-action__text { font-size: 11px; font-weight: 600; }

.card {
    background: var(--c-bg-card);
    border-radius: var(--radius-lg);
    padding: var(--space-md);
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
    position: relative;
    transition: transform var(--transition-normal);
    cursor: pointer;
    border: 1px solid rgba(74, 107, 82, 0.2);
}

.card.swiped { transform: translateX(-100px); }

.card__main {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    width: 100%;
}

/* ===== Thumbnail with Glow ===== */
.thumb {
    width: 90px;
    height: 90px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    background: white;
    border-radius: var(--radius-md);
    position: relative;
    box-shadow: 
        0 0 15px 8px rgba(255, 255, 255, 0.4),
        0 0 30px 15px rgba(255, 255, 255, 0.2),
        0 0 45px 20px rgba(255, 255, 255, 0.1);
}

.thumb img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: var(--radius-md);
}

.thumb--sm {
    width: 60px;
    height: 60px;
    box-shadow: 
        0 0 10px 5px rgba(255, 255, 255, 0.3),
        0 0 20px 10px rgba(255, 255, 255, 0.15);
}

.thumb--sm img { border-radius: 10px; }

.card__info { flex: 1; min-width: 0; }
.card__name { font-size: 15px; font-weight: 600; margin-bottom: var(--space-xs); color: var(--c-text); }
.card__id { font-size: 13px; color: var(--c-text-muted); }

/* ===== Variant Badge ===== */
.variant-badge-placeholder {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-xs);
    margin-top: var(--space-sm);
}

.variant-badge {
    display: inline-flex;
    align-items: center;
    gap: var(--space-xs);
    background: rgba(74, 107, 82, 0.15);
    color: var(--c-primary-light);
    font-size: 11px;
    font-weight: 600;
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition-fast);
    border: none;
}

.variant-badge:hover { background: rgba(74, 107, 82, 0.25); }
.variant-badge.expanded { background: var(--c-primary); color: white; }
.variant-badge__chevron { transition: transform var(--transition-fast); font-size: 10px; }
.variant-badge.expanded .variant-badge__chevron { transform: rotate(180deg); }

.card__gradient {
    position: absolute;
    top: 0;
    left: 102px;
    right: 0;
    bottom: 0;
    pointer-events: none;
    border-radius: 0 var(--radius-lg) var(--radius-lg) 0;
}

/* ===== Not Found Section ===== */
.not-found {
    padding-top: var(--space-md);
    border-top: 1px solid rgba(74, 107, 82, 0.2);
    width: 100%;
}

.not-found__msg {
    font-size: 13px;
    color: var(--c-text-muted);
    margin-bottom: var(--space-md);
    line-height: 1.4;
}

.not-found__row { display: flex; gap: var(--space-sm); }

.not-found__input {
    flex: 1;
    padding: 10px 12px;
    background: var(--c-bg-surface);
    border: 1px solid rgba(74, 107, 82, 0.3);
    border-radius: var(--radius-sm);
    font-size: 14px;
    color: var(--c-text);
}

.not-found__input:focus { outline: none; border-color: var(--c-primary); }

.not-found__btn {
    padding: 10px var(--space-lg);
    background: var(--c-primary);
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
}

/* ===== Part Banner ===== */
.part-banner {
    background: var(--c-bg-card);
    padding: var(--space-md) var(--space-lg);
    padding-top: max(env(safe-area-inset-top, 8px), 8px);
    border-bottom: 1px solid rgba(74, 107, 82, 0.2);
}

.part-banner__nav { 
    display: flex; 
    align-items: center; 
    justify-content: space-between;
    margin-bottom: var(--space-sm); 
}
.part-banner__info { display: flex; align-items: center; gap: var(--space-md); }
.part-banner__details { flex: 1; }
.part-banner__name { font-size: 14px; font-weight: 600; margin-bottom: 2px; color: var(--c-text); }
.part-banner__id { font-size: 11px; color: var(--c-text-muted); }

/* Done button in header */
.done-btn {
    background: none;
    border: none;
    color: var(--c-primary-light);
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    padding: var(--space-sm);
}

/* ===== Detail Content ===== */
.detail-content {
    flex: 1;
    padding: var(--space-lg);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

/* ===== Metadata Card ===== */
.metadata-card {
    background: var(--c-bg-card);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    margin-bottom: var(--space-lg);
    border: 1px solid rgba(74, 107, 82, 0.2);
}

.metadata-card__header {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    margin-bottom: var(--space-md);
    padding-bottom: var(--space-md);
    border-bottom: 1px solid rgba(74, 107, 82, 0.15);
}

.metadata-card__icon { font-size: 18px; }

.metadata-card__title {
    font-size: 13px;
    font-weight: 600;
    color: var(--c-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.metadata-card__content {
    padding-left: 26px;
}

.metadata-card__content--no-indent {
    padding-left: 0;
}

/* ===== Category Breadcrumb ===== */
.category-breadcrumb {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    font-size: 13px;
}

.category-breadcrumb__item {
    color: var(--c-text);
    background: var(--c-bg-card-light);
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    border: 1px solid rgba(74, 107, 82, 0.3);
    font-weight: 500;
}

.category-breadcrumb__item--highlight {
    color: var(--c-accent);
    font-weight: 600;
    background: rgba(74, 107, 82, 0.25);
    border-color: var(--c-primary);
}

.category-breadcrumb__item--detail {
    color: var(--c-accent);
    font-weight: 500;
}

.category-breadcrumb__separator {
    color: var(--c-primary-light);
    font-weight: bold;
    padding: 0 2px;
    font-size: 14px;
}

/* ===== Inventory Section ===== */
.inventory-section {
    background: var(--c-bg-card);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    border: 1px solid rgba(74, 107, 82, 0.2);
}

.inventory-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-lg);
    padding-bottom: var(--space-md);
    border-bottom: 1px solid rgba(74, 107, 82, 0.15);
}

.inventory-header__title {
    font-size: 16px;
    font-weight: 600;
    color: var(--c-text);
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.inventory-header__icon {
    color: var(--c-accent);
}

.inventory-header__toggle {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.inventory-header__toggle-label {
    font-size: 11px;
    color: var(--c-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Small toggle switch */
.toggle--sm {
    width: 40px;
    height: 24px;
}

.toggle--sm::after {
    width: 20px;
    height: 20px;
}

.toggle--sm.active::after {
    transform: translateX(16px);
}

/* ===== Inventory List ===== */
.inventory-list {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.inventory-item {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    padding: var(--space-md);
    background: var(--c-bg-surface);
    border-radius: 0;
    transition: background var(--transition-fast);
}

.inventory-item:first-child {
    border-radius: var(--radius-md) var(--radius-md) 0 0;
}

.inventory-item:last-child {
    border-radius: 0 0 var(--radius-md) var(--radius-md);
}

.inventory-item:only-child {
    border-radius: var(--radius-md);
}

.inventory-item:nth-child(odd) {
    background: var(--c-bg-surface);
}

.inventory-item:nth-child(even) {
    background: var(--c-bg-card-alt);
}

.inventory-item:hover {
    background: var(--c-bg-card-light);
}

.inventory-item__swatch {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-md);
    flex-shrink: 0;
    border: 2px solid rgba(255, 255, 255, 0.4);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}

.inventory-item__info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.inventory-item__name {
    font-size: 14px;
    font-weight: 500;
    color: var(--c-text);
}

.inventory-item__variants {
    font-size: 11px;
    color: var(--c-text-muted);
}

.inventory-item__part {
    font-size: 11px;
    color: var(--c-text-muted);
    font-family: monospace;
}

.inventory-item__qty {
    font-size: 16px;
    font-weight: 700;
    color: var(--c-primary-light);
    padding: 4px 12px;
    background: rgba(74, 107, 82, 0.12);
    border-radius: var(--radius-sm);
}

/* ===== Color Group Cards (for mold variant view) ===== */
.inventory-color-group {
    background: var(--c-bg-surface);
    border-radius: var(--radius-md);
    margin-bottom: var(--space-sm);
    overflow: hidden;
    border: 1px solid rgba(74, 107, 82, 0.15);
}

.inventory-color-header {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    padding: var(--space-md);
    background: var(--c-bg-card-alt);
    border-bottom: 1px solid rgba(74, 107, 82, 0.1);
}

.inventory-color-header__swatch {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-md);
    flex-shrink: 0;
    border: 2px solid rgba(255, 255, 255, 0.4);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}

.inventory-color-header__name {
    flex: 1;
    font-size: 14px;
    font-weight: 600;
    color: var(--c-text);
}

.inventory-color-header__qty {
    font-size: 14px;
    font-weight: 700;
    color: var(--c-primary-light);
    padding: 3px 10px;
    background: rgba(74, 107, 82, 0.15);
    border-radius: var(--radius-sm);
}

/* Mold variant sub-items */
.inventory-variant-item {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-sm) var(--space-md);
    padding-left: calc(48px + var(--space-md) + var(--space-md));
}

.inventory-variant-item--selected {
    background: rgba(74, 107, 82, 0.15) !important;
}

.inventory-variant-item__dot {
    color: var(--c-success);
    font-size: 10px;
    margin-right: 2px;
}

.inventory-variant-item:nth-child(odd) {
    background: transparent;
}

.inventory-variant-item:nth-child(even) {
    background: rgba(74, 107, 82, 0.05);
}

.inventory-variant-item__part {
    flex: 1;
    font-size: 12px;
    color: var(--c-text-muted);
    font-family: monospace;
}

.inventory-variant-item__qty {
    font-size: 13px;
    font-weight: 600;
    color: var(--c-text);
    padding: 2px 8px;
    background: rgba(74, 107, 82, 0.08);
    border-radius: var(--radius-sm);
}

/* ===== Inventory Total Footer ===== */
.inventory-total {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-md);
    margin-top: var(--space-md);
    border-top: 1px solid rgba(74, 107, 82, 0.2);
}

.inventory-total__label {
    font-size: 13px;
    font-weight: 600;
    color: var(--c-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.inventory-total__qty {
    font-size: 18px;
    font-weight: 700;
    color: var(--c-primary-light);
    padding: 4px 14px;
    background: rgba(74, 107, 82, 0.15);
    border-radius: var(--radius-md);
}

/* ===== Empty Inventory ===== */
.inventory-empty {
    text-align: center;
    padding: var(--space-2xl) var(--space-lg);
}

.inventory-empty__icon {
    font-size: 48px;
    opacity: 0.5;
    margin-bottom: var(--space-lg);
}

.inventory-empty__title {
    font-size: 16px;
    font-weight: 600;
    color: var(--c-text);
    margin-bottom: var(--space-sm);
}

.inventory-empty__subtitle {
    font-size: 13px;
    color: var(--c-text-muted);
    line-height: 1.4;
}

/* ===== Done Button (bottom of list) ===== */
.btn--done {
    width: 100%;
    padding: var(--space-lg);
    margin-top: var(--space-xl);
    background: linear-gradient(135deg, var(--c-primary) 0%, var(--c-primary-dark) 100%);
    color: white;
    border: none;
    border-radius: var(--radius-lg);
    font-size: 18px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(74, 107, 82, 0.3);
    transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}

.btn--done:active {
    transform: scale(0.98);
    box-shadow: 0 2px 10px rgba(74, 107, 82, 0.2);
}

/* ===== Variant Sub-Cards ===== */
.variant-list {
    display: none;
    flex-direction: column;
    gap: var(--space-sm);
    padding-top: var(--space-md);
    border-top: 1px solid rgba(74, 107, 82, 0.2);
    width: 100%;
}

.variant-list.expanded { display: flex; }

.variant-section {
    margin-bottom: var(--space-sm);
}

.variant-section__header {
    font-size: 11px;
    font-weight: 600;
    color: var(--c-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin: var(--space-sm) 0 var(--space-xs) 20px;
    display: flex;
    align-items: center;
    gap: var(--space-xs);
}

.variant-section__header::before {
    content: '';
    width: 8px;
    height: 2px;
    background: var(--c-primary);
    border-radius: 1px;
}

.subcard-wrap {
    position: relative;
    margin-left: 20px;
    border-radius: var(--radius-md);
    overflow: hidden;
}

.subcard-action {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    width: 80px;
    background: var(--c-bricklink);
    border-radius: var(--radius-md);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    color: white;
    cursor: pointer;
    border: none;
    font-size: 10px;
    font-weight: 600;
}

.subcard-action svg { width: 32px; height: 32px; }

.subcard {
    background: var(--c-bg-card-light);
    border-radius: var(--radius-md);
    padding: 10px;
    display: flex;
    align-items: center;
    gap: 10px;
    position: relative;
    transition: transform var(--transition-normal);
    cursor: pointer;
    border: 1px solid rgba(74, 107, 82, 0.15);
}

.subcard.swiped { transform: translateX(-80px); }

.subcard--current {
    border: 2px solid var(--c-primary);
    background: #35204a;
}

.subcard__thumb {
    width: 50px;
    height: 50px;
    flex-shrink: 0;
    background: white;
    border-radius: var(--radius-sm);
    box-shadow: 
        0 0 8px 4px rgba(255, 255, 255, 0.3),
        0 0 16px 8px rgba(255, 255, 255, 0.15);
}

.subcard__thumb img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: var(--radius-sm);
}

.subcard__info { flex: 1; min-width: 0; }
.subcard__name { font-size: 13px; font-weight: 600; color: var(--c-text); margin-bottom: 2px; }
.subcard__id { font-size: 11px; color: var(--c-text-muted); }

/* ===== Loading Overlay ===== */
.loading-overlay {
    position: fixed;
    inset: 0;
    background: rgba(10, 5, 16, 0.95);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 19000;
}

.loading-overlay.active { display: flex; }

/* ===== API Info Modal ===== */
.api-info {
    background: var(--c-bg-card);
    border-radius: var(--radius-xl);
    padding: var(--space-2xl);
    max-width: 360px;
    width: 100%;
    border: 1px solid var(--c-primary);
}

.api-info__title {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: var(--space-lg);
    color: var(--c-accent);
    text-align: center;
}

.api-info__text {
    font-size: 14px;
    line-height: 1.6;
    color: var(--c-text-muted);
    margin-bottom: var(--space-xl);
}
