:root {
    --bg-color: #000000; /* Pure Black */
    --surface-color: rgba(24, 24, 24, 0.7); /* Neutral dark grey */
    --primary-color: #10b981; /* Emerald 500 */
    --primary-hover: #059669; /* Emerald 600 */
    --text-main: #f8fafc; /* Slate 50 */
    --text-muted: #94a3b8; /* Slate 400 */
    --glass-border: rgba(255, 255, 255, 0.1);
    --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.3);
    --gradient-start: #34d399;
    --gradient-end: #10b981;
    --checkout-bg: linear-gradient(135deg, #171717, #3f3f46); /* Dark Grey/Black gradient */
    --checkout-shadow: 0 4px 14px 0 rgba(0, 0, 0, 0.5);
    --receipt-total: #10b981;
    --logo-blend-mode: screen; /* Removes black backgrounds from dark logos */
}

/* LIGHT PINK THEME */
[data-theme="light-pink"] {
    --bg-color: #fafafa;
    --surface-color: rgba(255, 255, 255, 0.85);
    --primary-color: #ec4899;
    --primary-hover: #db2777;
    --text-main: #000000;
    --text-muted: #4b5563;
    --glass-border: rgba(0, 0, 0, 0.1);
    --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.1);
    --gradient-start: #f472b6;
    --gradient-end: #ec4899;
    --checkout-bg: linear-gradient(135deg, #db2777, #ec4899);
    --checkout-shadow: 0 4px 14px 0 rgba(236, 72, 153, 0.39);
    --receipt-total: #ec4899;
    --logo-blend-mode: multiply; /* Removes white backgrounds from light logos */
}

/* MEDIUM AQUA THEME */
[data-theme="medium-aqua"] {
    --bg-color: #d1d5db;
    --surface-color: rgba(255, 255, 255, 0.75);
    --primary-color: #14b8a6;
    --primary-hover: #0d9488;
    --text-main: #1f2937;
    --text-muted: #4b5563;
    --glass-border: rgba(255, 255, 255, 0.5);
    --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.15);
    --gradient-start: #5eead4;
    --gradient-end: #14b8a6;
    --checkout-bg: linear-gradient(135deg, #0d9488, #14b8a6);
    --checkout-shadow: 0 4px 14px 0 rgba(20, 184, 166, 0.39);
    --receipt-total: #0d9488;
    --logo-blend-mode: multiply;
}


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

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-main);
    display: flex;
    justify-content: center;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

/* App Container - Focused on Mobile Experience */
.app-container {
    width: 100%;
    max-width: 500px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    background: radial-gradient(circle at top left, rgba(16, 185, 129, 0.15) 0%, transparent 50%), var(--bg-color);
    box-shadow: 0 0 50px rgba(0,0,0,0.5);
    position: relative;
    overflow-x: hidden;
}

/* Centralização Vertical no Desktop */
@media (min-width: 800px) {
    body {
        align-items: center;
        background-color: #0f172a; /* Cor de fundo externa para desktop */
    }
    .app-container {
        height: 92vh;
        min-height: auto;
        border-radius: 32px;
        border: 8px solid #1e293b;
        margin: auto;
    }
}

/* Compact Mobile Header */
.glass-header {
    background: var(--bg-color);
    padding: 1rem 1.2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 2px solid var(--glass-border);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.header-main-info {
    display: flex;
    flex-direction: column;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.total-display {
    display: flex;
    flex-direction: column;
}

.total-label {
    font-size: 0.7rem;
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

#totalValue {
    font-size: 2rem;
    font-weight: 800;
    color: var(--text-main);
}

.items-count-badge {
    color: var(--primary-color);
    font-weight: 700;
    font-size: 0.85rem;
}

.receipt-box-btn {
    width: 50px;
    height: 50px;
    background: var(--bg-color);
    border: 2px solid var(--glass-border);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
}

.receipt-box-btn:hover {
    background: var(--surface-color);
    transform: translateY(-2px);
}

.receipt-emoji {
    font-size: 1.6rem;
}

.camera-toggle-btn {
    width: 42px;
    height: 42px;
    background: var(--surface-color);
    border: 1px solid var(--glass-border);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
}

.camera-toggle-btn:hover {
    border-color: var(--primary-color);
    background: rgba(255,255,255,0.05);
}

.theme-switcher {
    display: flex;
    gap: 8px;
    background: var(--surface-color);
    padding: 6px;
    border-radius: 12px;
    border: 1px solid var(--glass-border);
}

.theme-btn {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: 2px solid transparent;
    cursor: pointer;
    transition: transform 0.2s, border-color 0.2s;
    outline: none;
    box-shadow: 0 4px 10px rgba(0,0,0,0.2);
}

.theme-btn:hover { transform: scale(1.1); }
.theme-btn.active { border-color: var(--text-main); transform: scale(1.15); }

.theme-dark { background: #000000; border-color: rgba(255,255,255,0.3); }
.theme-light-pink { background: #ec4899; }
.theme-medium-aqua { background: #14b8a6; }

/* App Footer & Language Switcher */
.app-footer-minimal {
    margin-top: auto;
    padding: 1rem;
    text-align: center;
    border-top: 1px solid var(--glass-border);
}

.lang-switcher {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: var(--surface-color);
    padding: 4px 12px;
    border-radius: 20px;
    border: 1px solid var(--glass-border);
}

.lang-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 0.7rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    padding: 2px;
}

.lang-btn:hover { color: var(--text-main); }
.lang-btn.active { color: var(--primary-color); }
.lang-divider { color: var(--glass-border); font-size: 0.6rem; }


/* Main Layout (Pure Vertical Column) */
.main-layout {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 1rem;
    gap: 1.5rem;
    width: 100%;
}

.mobile-vertical {
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* Compact Mobile Header */
.glass-header {
    background: var(--bg-color);
    padding: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 2px solid var(--glass-border);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-main-info {
    display: flex;
    flex-direction: column;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.total-display {
    display: flex;
    flex-direction: column;
}

.total-label {
    font-size: 0.7rem;
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

#totalValue {
    font-size: 1.8rem;
    font-weight: 800;
    color: var(--text-main);
    line-height: 1;
    margin: 2px 0;
}

.items-count-badge {
    color: var(--primary-color);
    font-weight: 700;
    font-size: 0.8rem;
}

/* Sections Structure - Vertical Only */
.scanner-section,
.list-section {
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 500px;
}

.scanner-section {
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    max-height: 80vh;
    opacity: 1;
    overflow: hidden;
}

.scanner-section.collapsed {
    max-height: 0;
    opacity: 0;
    margin: 0;
    padding: 0;
    pointer-events: none;
}

/* Camera Container & Viewfinder */
.camera-container {
    position: relative;
    width: 100%;
    aspect-ratio: 4 / 3;
    background: #000;
    border-radius: 24px;
    overflow: hidden;
    box-shadow: 0 10px 40px rgba(0,0,0,0.4);
    border: 1px solid var(--glass-border);
}

.glow-corner {
    position: absolute;
    width: 40px;
    height: 40px;
    border: 4px solid #f59e0b; /* Amber 500 */
    border-radius: 8px;
    z-index: 10;
    box-shadow: 0 0 15px rgba(245, 158, 11, 0.8);
}

.top-left { top: 30px; left: 30px; border-right: none; border-bottom: none; }
.top-right { top: 30px; right: 30px; border-left: none; border-bottom: none; }
.bottom-left { bottom: 30px; left: 30px; border-right: none; border-top: none; }
.bottom-right { bottom: 30px; right: 30px; border-left: none; border-top: none; }

.zoom-pill {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(5px);
    padding: 6px 12px;
    border-radius: 30px;
    display: flex;
    gap: 10px;
    z-index: 20;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.zoom-btn {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    border: none;
    background: #333;
    color: white;
    font-weight: 700;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.2s;
}

.zoom-btn.active {
    background: #ec4899;
}

#cameraScanner {
    width: 100%;
    height: 100%;
    object-fit: cover;
    will-change: transform;
    transform: translateZ(0); /* Force GPU */
    backface-visibility: hidden;
}

#snapPreview {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: 5;
    background: #000;
    will-change: transform;
    transform: translateZ(0); /* Force GPU */
}

#snapPreview.hidden {
    display: none;
}

/* Efeito de Flash na Captura */
.camera-container.snapping::after {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: white;
    z-index: 100;
    animation: snap-flash 0.4s ease-out forwards;
    pointer-events: none;
}

@keyframes snap-flash {
    0% { opacity: 0; }
    20% { opacity: 0.8; }
    100% { opacity: 0; }
}

/* Animação de Scanner no Snap */
.camera-container.processing::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: var(--accent);
    box-shadow: 0 0 15px var(--accent);
    z-index: 10;
    animation: scanLine 2s linear infinite;
    pointer-events: none;
}

@keyframes scanLine {
    0% { top: 30%; opacity: 0; }
    10% { opacity: 1; }
    90% { opacity: 1; }
    100% { top: 70%; opacity: 0; }
}

/* Camera Off Overlay */
.camera-off-overlay {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 2;
    color: var(--text-muted);
}

.camera-off-overlay.hidden {
    display: none;
}

.camera-off-icon {
    font-size: 3rem;
    margin-bottom: 10px;
    filter: grayscale(1);
    opacity: 0.5;
}

/* Zoom Controls */
.zoom-controls {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 15px;
    background: rgba(0, 0, 0, 0.6);
    padding: 10px 15px;
    border-radius: 30px;
    backdrop-filter: blur(8px);
    z-index: 10;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.zoom-btn {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border: 1px solid transparent;
    border-radius: 50%;
    width: 44px;
    height: 44px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    font-family: inherit;
}

.zoom-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

.zoom-btn.active {
    background: var(--primary-color);
    border-color: var(--primary-hover);
    color: white;
    box-shadow: 0 0 15px rgba(16, 185, 129, 0.4);
    transform: scale(1.05);
}

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

/* Auto Scan Switch overlay */
.control-pill {
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
    padding: 8px 12px;
    border-radius: 20px;
    display: flex;
    align-items: center;
    gap: 8px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: white;
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.2s;
}

.control-pill:hover {
    background: rgba(0, 0, 0, 0.8);
}

.camera-top-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 10;
}

.auto-scan-switch {
    /* Removed absolute positioning since it's now in flex container */
}

.switch {
    position: relative;
    display: inline-block;
    width: 34px;
    height: 20px;
}

.switch input { 
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0; left: 0; right: 0; bottom: 0;
    background-color: #4b5563;
    transition: .4s;
}

.slider:before {
    position: absolute;
    content: "";
    height: 14px;
    width: 14px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .4s;
}

input:checked + .slider {
    background-color: var(--primary-color);
}

input:focus + .slider {
    box-shadow: 0 0 1px var(--primary-color);
}

input:checked + .slider:before {
    transform: translateX(14px);
}

.slider.round {
    border-radius: 34px;
}

.slider.round:before {
    border-radius: 50%;
}

.switch-label {
    font-size: 0.8rem;
    color: white;
    font-weight: 500;
}

/* Scanner Overlay Target */
.overlay-target {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 85%;
    height: 60%;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}

.scan-hint {
    background: rgba(0,0,0,0.6);
    padding: 6px 16px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 500;
    color: rgba(255,255,255,0.9);
    backdrop-filter: blur(4px);
    transition: opacity 0.3s;
}

.camera-container.scanning .scan-hint {
    opacity: 0;
}

.corner {
    position: absolute;
    width: 25px;
    height: 25px;
    border-color: var(--primary-color);
    border-style: solid;
    transition: all 0.3s ease;
}

.camera-container.scanning .corner {
    border-color: #fbbf24;
    box-shadow: 0 0 15px rgba(251, 191, 36, 0.5);
}

.top-left { top: 0; left: 0; border-width: 4px 0 0 4px; border-top-left-radius: 12px;}
.top-right { top: 0; right: 0; border-width: 4px 4px 0 0; border-top-right-radius: 12px;}
.bottom-left { bottom: 0; left: 0; border-width: 0 0 4px 4px; border-bottom-left-radius: 12px;}
.bottom-right { bottom: 0; right: 0; border-width: 0 4px 4px 0; border-bottom-right-radius: 12px;}

/* Compact Command Bar: 🎙️ | 📸 | 🔄 */
.command-bar-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    width: 100%;
}

.command-bar {
    background: var(--surface-color);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border: 1px solid var(--glass-border);
    padding: 8px 12px;
    border-radius: 40px;
    display: flex;
    align-items: center;
    gap: 15px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
}

.cmd-btn {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: none;
    background: rgba(255, 255, 255, 0.05);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    flex-shrink: 0;
}

.cmd-btn .btn-icon {
    font-size: 1.4rem;
}

.cmd-btn.main-action {
    width: 65px;
    height: 65px;
    background: #ec4899;
    box-shadow: 0 5px 20px rgba(236, 72, 153, 0.4);
}

.cmd-btn.main-action .btn-icon {
    font-size: 2rem;
}

.cmd-btn:active {
    transform: scale(0.9);
}

.cmd-btn.active {
    background: var(--primary-color);
    box-shadow: 0 0 15px var(--primary-color);
}

.auto-status-label {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-left: -5px;
    margin-right: 5px;
}

.cmd-btn.active .auto-status-label {
    color: white;
}

/* Simular Button in List Header */
.list-header-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.simular-btn {
    background: var(--surface-color);
    border: 1px solid var(--glass-border);
    color: var(--text-main);
    padding: 8px 16px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s;
}

.simular-btn:hover {
    background: rgba(255,255,255,0.05);
    border-color: var(--primary-color);
}

.status-indicator {
    text-align: center;
    color: #ec4899;
    font-weight: 600;
    font-size: 0.9rem;
    min-height: 1.2rem;
}

.trigger-btn:active {
    transform: scale(0.96);
    box-shadow: 0 4px 10px rgba(16, 185, 129, 0.2);
    filter: brightness(0.9);
}

.debug-btn {
    flex: 0.8;
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-muted);
    border: 1px solid var(--glass-border);
    padding: 8px;
    font-size: 0.75rem;
    border-radius: 12px;
    cursor: pointer;
    backdrop-filter: blur(4px);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 4px;
    transition: all 0.2s;
}

.debug-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-main);
}

.primary-btn {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-hover));
    color: white;
    border: none;
    border-radius: 9999px;
    padding: 1rem 2rem;
    font-size: 1.125rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    cursor: pointer;
    box-shadow: 0 4px 14px 0 rgba(16, 185, 129, 0.39);
    transition: transform 0.2s, box-shadow 0.2s, background 0.2s;
    width: 100%;
    justify-content: center;
    letter-spacing: 0.02em;
}

.primary-btn .btn-icon {
    font-size: 1.25rem;
}

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

.primary-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    background: var(--surface-color);
    box-shadow: none;
    color: var(--text-muted);
}

/* Status Indicator */
.status-indicator {
    text-align: center;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-muted);
    min-height: 1.5rem;
}
.status-indicator.processing {
    color: #fbbf24;
    animation: pulse 1s infinite alternate;
}
.status-indicator.success { color: var(--primary-color); }
.status-indicator.error { color: #ef4444; }

@keyframes pulse {
    0% { opacity: 0.6; }
    100% { opacity: 1; }
}

/* List Section & Controls */
.list-section {
    background: var(--surface-color);
    border-radius: 24px;
    padding: 1.5rem;
    border: 1px solid var(--glass-border);
    box-shadow: var(--glass-shadow);
    backdrop-filter: blur(10px);
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.list-controls {
    display: flex;
    justify-content: center;
}

.voice-command-btn {
    width: 100%;
    background: #e0f2f1;
    color: #14b8a6;
    border: 1px solid #b2dfdb;
    border-radius: 16px;
    padding: 1rem;
    font-weight: 700;
    font-size: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 4px 10px rgba(0,0,0,0.05);
}

.voice-command-btn:active {
    transform: scale(0.98);
    background: #b2dfdb;
}

.cmd-btn.listening {
    background: rgba(239, 68, 68, 0.4) !important;
    color: #ef4444 !important;
    border-color: rgba(239, 68, 68, 0.8) !important;
    animation: listening-pulse 1.5s infinite;
}

@keyframes listening-pulse {
    0% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4); }
    70% { box-shadow: 0 0 0 10px rgba(239, 68, 68, 0); }
    100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
}

.manual-entry-area {
    width: 100%;
}

.add-btn {
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 8px;
    padding: 0 1.5rem;
    font-weight: 700;
    cursor: pointer;
}

.section-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 0.5rem;
}

.list-container {
    min-height: 200px;
}

.checkout-footer {
    margin-top: auto;
    padding-top: 1rem;
    border-top: 1px dashed var(--glass-border);
}

/* Manual Add Form */
.manual-add-form {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    background: var(--surface-color);
    padding: 1rem;
    border-radius: 12px;
    border: 1px solid var(--glass-border);
}

.input-row {
    display: flex;
    gap: 0.75rem;
}

.glass-input {
    background: var(--surface-color);
    border: 1px solid var(--glass-border);
    color: var(--text-main);
    padding: 0.75rem 1rem;
    border-radius: 8px;
    font-size: 1rem;
    font-family: 'Inter', sans-serif;
    width: 100%;
    transition: border-color 0.2s;
}

.glass-input:focus {
    outline: none;
    border-color: var(--primary-color);
}

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

.price-input {
    flex: 1;
}

.secondary-btn {
    background: rgba(16, 185, 129, 0.15);
    color: var(--primary-color);
    border: 1px solid rgba(16, 185, 129, 0.3);
    border-radius: 8px;
    padding: 0 1.25rem;
    font-weight: 600;
    font-family: 'Inter', sans-serif;
    cursor: pointer;
    transition: all 0.2s;
}

.secondary-btn:hover {
    background: rgba(16, 185, 129, 0.25);
}

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

/* Voice Command Button */
.voice-btn {
    border-radius: 8px;
    font-size: 1.25rem;
    padding: 0 1rem;
    background: rgba(255, 255, 255, 0.05); /* subtle background */
}

.voice-btn.listening {
    background: rgba(239, 68, 68, 0.2); /* Red tint when listening */
    color: #ef4444;
    border-color: rgba(239, 68, 68, 0.5);
    animation: listening-pulse 1.5s infinite;
}

@keyframes listening-pulse {
    0% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4); }
    70% { box-shadow: 0 0 0 10px rgba(239, 68, 68, 0); }
    100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
}

.voice-status-hint {
    font-size: 0.8rem;
    color: #ef4444; /* Alert color */
    text-align: center;
    margin-top: 5px;
    font-weight: 500;
    transition: opacity 0.3s;
}

.voice-status-hint.hidden {
    display: none;
}

/* Items List */
.items-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.item-card {
    background: var(--surface-color);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    animation: slideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
}

.item-card.checked {
    background: rgba(30, 41, 59, 0.3);
    border-color: rgba(16, 185, 129, 0.2);
}

.check-btn {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    border: 2px solid var(--text-muted);
    background: transparent;
    color: transparent;
    font-size: 1rem;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: all 0.2s;
    flex-shrink: 0;
}

.item-card.checked .check-btn {
    border-color: var(--primary-color);
    background: rgba(16, 185, 129, 0.2);
    color: var(--primary-color);
}

@keyframes slideUp {
    from { opacity: 0; transform: translateY(15px); }
    to { opacity: 1; transform: translateY(0); }
}

.item-info {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    flex: 1;
    transition: opacity 0.3s;
}

.item-card.checked .item-name {
    text-decoration: line-through;
    opacity: 0.5;
}

.item-card.checked .item-price {
    opacity: 0.5;
}

.item-name {
    font-size: 1rem;
    color: var(--text-main);
    font-weight: 600;
    margin-bottom: 2px;
}

.item-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    margin-top: 4px;
}

.item-quantity-controls {
    display: flex;
    align-items: center;
    gap: 12px;
    background: rgba(255, 255, 255, 0.05);
    padding: 4px 8px;
    border-radius: 20px;
    border: 1px solid var(--glass-border);
}

.qty-btn {
    background: none;
    border: none;
    color: var(--primary-color);
    font-size: 1.2rem;
    font-weight: 800;
    cursor: pointer;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    border-radius: 50%;
}

.qty-btn:hover {
    background: rgba(16, 185, 129, 0.1);
    transform: scale(1.1);
}

.qty-btn:active {
    transform: scale(0.9);
}

.qty-value {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--text-main);
    min-width: 20px;
    text-align: center;
}

.item-price {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-main);
}

.remove-btn {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
    border: 1px solid rgba(239, 68, 68, 0.2);
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.2s;
}

.remove-btn:hover {
    background: rgba(239, 68, 68, 0.25);
    transform: scale(1.05);
}

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

/* Checkout Area */
.checkout-area {
    margin-top: 1rem;
    padding-top: 1.5rem;
    border-top: 1px dashed var(--glass-border);
    display: flex;
    justify-content: stretch;
}

.checkout-btn {
    width: 100%;
    background: var(--checkout-bg);
    box-shadow: var(--checkout-shadow);
}

.checkout-btn:hover:not(:disabled) {
    filter: brightness(1.15);
}

.checkout-btn:disabled {
    background: var(--surface-color);
    box-shadow: none;
    color: var(--text-muted);
    border: 1px solid var(--glass-border);
}

/* Modal Overlay & Animations */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 100;
    opacity: 1;
    transition: opacity 0.3s;
}

.modal-overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

/* Glass Panel Modal */
.glass-panel {
    background: var(--surface-color);
    border: 1px solid var(--primary-color);
    padding: 2.5rem 2rem;
    border-radius: 20px;
    width: 90%;
    max-width: 400px;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    box-shadow: 0 10px 40px rgba(0,0,0,0.5), 0 0 40px rgba(16, 185, 129, 0.2);
    text-align: center;
    transform: translateY(0) scale(1);
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.modal-overlay.hidden .glass-panel {
    transform: translateY(30px) scale(0.95);
}

.glass-panel h3 {
    font-size: 1.25rem;
    font-weight: 500;
    color: var(--text-muted);
}

.scanned-price-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    background: rgba(255, 255, 255, 0.05);
    padding: 1rem;
    border-radius: 16px;
    border: 1px solid var(--glass-border);
    margin: 0.5rem 0;
}

.currency-label {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color);
}

.scanned-price-input {
    background: none;
    border: none;
    font-size: 3.5rem;
    font-weight: 800;
    color: var(--text-main);
    width: 200px;
    text-align: center;
    font-family: 'Inter', sans-serif;
    outline: none;
    transition: color 0.2s;
}

.scanned-price-input:focus {
    color: var(--primary-color);
}

.scanned-price-input::-webkit-inner-spin-button,
.scanned-price-input::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

/* Receipt Panel styling */
.receipt-panel h3 {
    font-size: 1.5rem;
    color: #f8fafc;
    margin-bottom: 0.5rem;
}

.receipt-summary {
    background: rgba(15, 23, 42, 0.4);
    border-radius: 12px;
    padding: 1.5rem;
    margin: 0.5rem 0;
    border: 1px solid var(--glass-border);
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.receipt-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 1.1rem;
    color: var(--text-muted);
}

.receipt-row strong {
    color: var(--text-main);
    font-size: 1.25rem;
}

.receipt-total {
    border-top: 1px dashed var(--glass-border);
    padding-top: 1rem;
    margin-top: 0.25rem;
}

.receipt-total span {
    font-weight: 600;
    color: var(--text-main);
}

/* History Panel styling */
.history-panel {
    max-width: 500px;
    padding: 1.5rem;
}

.history-filters {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.filter-group {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    text-align: left;
}

.filter-group label {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.date-input {
    padding: 0.5rem;
    font-size: 0.9rem;
}

.history-summary-box {
    background: var(--surface-color);
    padding: 1rem;
    border-radius: 12px;
    border: 1px solid var(--primary-color);
    margin-bottom: 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.history-summary-box strong {
    font-size: 1.5rem;
    color: var(--primary-color);
}

.history-list {
    max-height: 300px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
    padding-right: 5px;
}

/* Custom Scrollbar */
.history-list::-webkit-scrollbar {
    width: 6px;
}
.history-list::-webkit-scrollbar-track {
    background: rgba(0,0,0,0.1);
}
.history-list::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: 10px;
}

.history-card {
    background: rgba(15, 23, 42, 0.4);
    border: 1px solid var(--glass-border);
    border-radius: 10px;
    padding: 0.75rem 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    text-align: left;
}

.history-card-info {
    display: flex;
    flex-direction: column;
}

.history-date {
    font-size: 0.85rem;
    color: var(--text-main);
    font-weight: 600;
}

.history-items-count {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.history-price {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--primary-color);
}

.receipt-total strong {
    font-size: 1.75rem;
    color: var(--receipt-total);
}

.receipt-message {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin: 0.5rem 0 1rem;
}

/* Quantity Control */
.quantity-control {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    align-items: center;
    margin-top: 0.5rem;
}

.stepper {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.stepper-btn {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    border: 1px solid var(--glass-border);
    background: rgba(30, 41, 59, 0.8);
    color: var(--text-main);
    font-size: 1.5rem;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: all 0.2s;
}

.stepper-btn:hover { 
    background: rgba(255, 255, 255, 0.1); 
    border-color: var(--primary-color);
}

.stepper-btn:active {
    transform: scale(0.9);
}

.center-text { 
    text-align: center; 
    width: 80px; 
    font-size: 1.5rem; 
    padding: 0.5rem;
    font-weight: 600;
}

/* Modal Actions */
.modal-actions {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-top: 1rem;
}

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

.success-btn { 
    width: 100%; 
    padding: 1.25rem;
    font-size: 1.2rem;
}

/* Override scanning borders */
.camera-container.scanning .corner {
    animation: scannerBreath 1.5s infinite;
}

@keyframes scannerBreath {
    0% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.1); opacity: 0.5; }
    100% { transform: scale(1); opacity: 1; }
}

/* --- PREMIUM FEATURES STYLING --- */

/* Budget Tracker */
.budget-display-wrapper {
    margin-top: 8px;
    width: 100%;
}

.budget-progress-bar {
    width: 100%;
    height: 6px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 4px;
}

.budget-fill {
    height: 100%;
    background: var(--primary-color);
    width: 0%;
    transition: width 0.5s ease-out, background 0.3s;
}

.budget-stats {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

#budgetText {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
}

.edit-budget-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 0.8rem;
    padding: 2px;
    opacity: 0.6;
    transition: opacity 0.2s;
}

.edit-budget-btn:hover {
    opacity: 1;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(5px); }

    to { opacity: 1; transform: translateY(0); }
}

/* Editable Price Styling */
.editable-price {
    cursor: pointer;
    transition: all 0.2s;
    border-bottom: 1px dashed rgba(255, 255, 255, 0.3);
    padding-bottom: 2px;
}

.editable-price:hover {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
}


/* WhatsApp Button */
.whatsapp-btn {
    background: #25d366 !important;
    color: white !important;
    box-shadow: 0 4px 14px rgba(37, 211, 102, 0.3) !important;
}

.list-tools {
    display: flex;
    gap: 8px;
}
