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

:root {
    /* Colors */
    --c-primary: #7c3aed;
    --c-primary-dark: #5b21b6;
    --c-primary-light: #a78bfa;
    --c-accent: #c4b5fd;
    --c-bg-dark: #0f0a1a;
    --c-bg-darker: #0a0612;
    --c-bg-page: #1a1225;
    --c-bg-card: #251d35;
    --c-bg-card-light: #2d2440;
    --c-bg-surface: #1f1730;
    --c-text: #e8e4f0;
    --c-text-muted: #9b8fb5;
    --c-success: #10b981;
    --c-error: #ef4444;
    --c-warning: #f59e0b;
    --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.7); 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(196, 181, 253, 0.6); 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.5); }

@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-primary-light) 50%, var(--c-primary) 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(37, 29, 53, 0.9);
    border: 2px solid rgba(124, 58, 237, 0.3);
    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-primary);
    color: var(--c-accent);
    box-shadow: 0 0 25px rgba(124, 58, 237, 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(37, 29, 53, 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(124, 58, 237, 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-success); }

.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(124, 58, 237, 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(124, 58, 237, 0.2);
}

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

.form-select {
    width: 100%;
    padding: 12px 14px;
    background: var(--c-bg-surface);
    border: 1px solid rgba(124, 58, 237, 0.3);
    border-radius: 10px;
    font-size: 15px;
    color: var(--c-text);
}

/* ===== 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(124, 58, 237, 0.3);
}

.btn--success {
    background: linear-gradient(135deg, var(--c-success) 0%, #059669 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(16, 185, 129, 0.3);
}

.btn--inactive {
    background: var(--c-bg-surface);
    color: var(--c-text-muted);
}

.btn--locked { opacity: 0.4; cursor: not-allowed; }

/* ===== 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; }
.alert--warning { color: var(--c-warning); text-align: center; font-size: 12px; margin-top: var(--space-sm); }

/* ===== 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(124, 58, 237, 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(124, 58, 237, 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--entry { z-index: 10001; }
.page--list { z-index: 10002; }

/* ===== 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(124, 58, 237, 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-primary);
}

.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(124, 58, 237, 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(124, 58, 237, 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(124, 58, 237, 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(124, 58, 237, 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(124, 58, 237, 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(124, 58, 237, 0.2);
}

.part-banner__nav { display: flex; align-items: center; 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); }

.action-container { padding: var(--space-md) var(--space-lg); }

/* ===== Entry Content ===== */
.entry-content {
    flex: 1;
    padding: var(--space-lg);
    overflow-y: auto;
}

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

.entry-card {
    position: relative;
    margin-bottom: 10px;
    overflow: hidden;
    border-radius: 14px;
}

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

.entry-card__delete svg { width: 24px; height: 24px; stroke: white; fill: none; }

.entry-card__content {
    background: var(--c-bg-card-light);
    border-radius: 14px;
    padding: 14px;
    border: 1px solid rgba(124, 58, 237, 0.2);
    position: relative;
    transition: transform var(--transition-normal);
}

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

.entry-card__row { display: flex; gap: 10px; align-items: center; }

.entry-card__select {
    flex: 1;
    padding: 12px;
    border: 1px solid rgba(124, 58, 237, 0.3);
    border-radius: 10px;
    font-size: 15px;
    background: var(--c-bg-surface);
    color: var(--c-text);
}

.entry-card__qty {
    width: 70px;
    padding: 12px;
    border: 1px solid rgba(124, 58, 237, 0.3);
    border-radius: 10px;
    font-size: 15px;
    text-align: center;
    background: var(--c-bg-surface);
    color: var(--c-text);
}

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

.add-entry-btn {
    width: 100%;
    padding: 14px;
    background: var(--c-bg-surface);
    border: 2px dashed rgba(124, 58, 237, 0.4);
    border-radius: 14px;
    color: var(--c-primary-light);
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    margin-top: var(--space-md);
}

.add-entry-btn.hidden { display: none; }

/* ===== Variant Sub-Cards ===== */
.variant-list {
    display: none;
    flex-direction: column;
    gap: var(--space-sm);
    padding-top: var(--space-md);
    border-top: 1px solid rgba(124, 58, 237, 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(124, 58, 237, 0.15);
}

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

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

.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); }

/* ===== List Dropdown ===== */
.list-dropdown {
    width: 100%;
    padding: 14px var(--space-lg);
    border: 1px solid rgba(124, 58, 237, 0.3);
    border-radius: var(--radius-md);
    font-size: 16px;
    background: var(--c-bg-card);
    color: var(--c-text);
}

/* ===== Popup ===== */
.popup {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-normal);
    z-index: 20000;
    padding: var(--space-xl);
}

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

.popup__card {
    background: var(--c-bg-card);
    border-radius: var(--radius-xl);
    padding: 30px;
    max-width: 340px;
    width: 100%;
    text-align: center;
    transform: scale(0.9);
    transition: transform var(--transition-normal);
    border: 2px solid var(--c-primary);
}

.popup.active .popup__card { transform: scale(1); }

.popup__icon {
    width: 70px;
    height: 70px;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto var(--space-xl);
}

.popup__icon--success { background: linear-gradient(135deg, var(--c-success) 0%, #059669 100%); }
.popup__icon--error { background: linear-gradient(135deg, var(--c-error) 0%, #dc2626 100%); }
.popup__icon--confirm { background: linear-gradient(135deg, var(--c-primary) 0%, var(--c-primary-dark) 100%); }
.popup__icon svg { width: 35px; height: 35px; color: white; stroke: white; }

.popup__title { font-size: 22px; font-weight: 700; margin-bottom: 10px; color: var(--c-text); }
.popup__msg { font-size: 14px; color: var(--c-text-muted); margin-bottom: var(--space-2xl); line-height: 1.5; white-space: pre-line; }

.popup__btn { margin-bottom: 10px; }

/* ===== Loading Overlay ===== */
.loading-overlay {
    position: fixed;
    inset: 0;
    background: rgba(10, 6, 18, 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);
}
