:root {
    /* Color Palette - Premium Dark Theme with Green Accents */
    --bg-main: #0f172a;
    --bg-card: #1e293b;
    --bg-elevated: #334155;
    
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    
    --accent-primary: #10b981; /* Emerald green - signifies money/positivity */
    --accent-hover: #059669;
    --accent-glow: rgba(16, 185, 129, 0.4);
    
    --danger: #ef4444;
    --danger-hover: #dc2626;
    
    --border-color: rgba(255, 255, 255, 0.1);
    
    /* Layout */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 20px;
    --radius-full: 9999px;
    
    --spacing-xs: 4px;
    --spacing-sm: 8px;
    --spacing-md: 16px;
    --spacing-lg: 24px;
    --spacing-xl: 32px;
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background-color: var(--bg-main);
    color: var(--text-primary);
    line-height: 1.5;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

/* App Container (Mobile First) */
.app-container {
    max-width: 600px; /* Tablet constraint */
    margin: 0 auto;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    padding: var(--spacing-md);
    gap: var(--spacing-md);
}

/* Header */
.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--spacing-sm) 0;
}

.logo {
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.logo .accent {
    color: var(--accent-primary);
}

.status-indicator {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    font-size: 0.875rem;
    color: var(--text-secondary);
    background-color: var(--bg-card);
    padding: 4px 12px;
    border-radius: var(--radius-full);
    border: 1px solid var(--border-color);
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: var(--text-muted);
    transition: background-color 0.3s ease;
}

.status-indicator.listening .status-dot {
    background-color: var(--accent-primary);
    box-shadow: 0 0 8px var(--accent-glow);
    animation: pulse 1.5s infinite;
}

/* Voice Section */
.voice-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--spacing-md);
    background: linear-gradient(145deg, var(--bg-card), var(--bg-main));
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: var(--spacing-xl) var(--spacing-md);
    text-align: center;
}

.mic-btn {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background-color: var(--bg-elevated);
    color: var(--text-primary);
    border: 2px solid var(--border-color);
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

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

.mic-btn.active {
    background-color: var(--accent-primary);
    border-color: var(--accent-primary);
    box-shadow: 0 0 24px var(--accent-glow);
    color: #fff;
}

.transcript-container {
    min-height: 48px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.transcript-text {
    font-size: 1.125rem;
    color: var(--text-secondary);
    font-style: italic;
    transition: color 0.3s;
}

.transcript-text.recognized {
    color: var(--accent-primary);
    font-weight: 500;
    font-style: normal;
}

/* Waveform Animation */
.waveform {
    display: flex;
    align-items: flex-end;
    gap: 4px;
    height: 24px;
    margin-top: var(--spacing-sm);
}

.waveform.hidden {
    display: none;
}

.waveform .bar {
    width: 4px;
    background-color: var(--accent-primary);
    border-radius: 2px;
    animation: wave 1s infinite ease-in-out;
}

.waveform .bar:nth-child(1) { animation-delay: 0.0s; height: 10px; }
.waveform .bar:nth-child(2) { animation-delay: 0.1s; height: 16px; }
.waveform .bar:nth-child(3) { animation-delay: 0.2s; height: 24px; }
.waveform .bar:nth-child(4) { animation-delay: 0.3s; height: 18px; }
.waveform .bar:nth-child(5) { animation-delay: 0.4s; height: 12px; }
.waveform .bar:nth-child(6) { animation-delay: 0.5s; height: 8px; }

@keyframes wave {
    0%, 100% { transform: scaleY(0.5); }
    50% { transform: scaleY(1); }
}

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

/* Cart Section */
.cart-section {
    flex: 1;
    background-color: var(--bg-card);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.cart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--spacing-md);
    border-bottom: 1px solid var(--border-color);
}

.cart-header h2 {
    font-size: 1.125rem;
    font-weight: 600;
}

.cart-actions {
    display: flex;
    gap: var(--spacing-sm);
}

.icon-btn {
    background: none;
    border: none;
    font-size: 1.25rem;
    cursor: pointer;
    padding: 6px;
    border-radius: var(--radius-sm);
    transition: background-color 0.2s;
    opacity: 0.8;
}

.icon-btn:hover {
    background-color: var(--bg-elevated);
    opacity: 1;
}

.cart-table-container {
    flex: 1;
    overflow-y: auto;
    padding: 0 var(--spacing-md);
}

.cart-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

.cart-table th {
    color: var(--text-secondary);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: var(--spacing-sm) 0;
    position: sticky;
    top: 0;
    background-color: var(--bg-card);
    z-index: 10;
}

.cart-table td {
    padding: var(--spacing-sm) 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    font-size: 0.9375rem;
}

.cart-table tr:last-child td {
    border-bottom: none;
}

.col-qty { width: 15%; text-align: center; }
.col-item { width: 45%; }
.col-price { width: 20%; text-align: right; }
.col-total { width: 20%; text-align: right; font-weight: 600; }

.cart-table th.col-qty { text-align: center; }
.cart-table th.col-price, .cart-table th.col-total { text-align: right; }

.empty-state td {
    text-align: center !important;
    color: var(--text-muted);
    padding: var(--spacing-xl) 0 !important;
    font-style: italic;
}

.item-row {
    animation: slideIn 0.3s ease-out;
}

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

/* Footer & Total */
.app-footer {
    background-color: var(--bg-card);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    padding: var(--spacing-md);
    display: flex;
    flex-direction: column;
    gap: var(--spacing-md);
}

.total-container {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    padding-bottom: var(--spacing-md);
    border-bottom: 1px solid var(--border-color);
}

.total-label {
    font-size: 1.25rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.total-value {
    font-size: 2.5rem;
    font-weight: 800;
    color: var(--accent-primary);
    text-shadow: 0 0 20px var(--accent-glow);
    transition: transform 0.2s ease;
}

.total-value.bump {
    transform: scale(1.1);
}

.action-buttons {
    display: flex;
    gap: var(--spacing-md);
}

.btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px;
    border: none;
    border-radius: var(--radius-md);
    font-size: 1.125rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
}

.btn-primary {
    background-color: var(--accent-primary);
    color: white;
    box-shadow: 0 4px 12px var(--accent-glow);
}

.btn-primary:hover {
    background-color: var(--accent-hover);
    transform: translateY(-2px);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-secondary {
    background-color: var(--bg-elevated);
    color: var(--text-primary);
}

.btn-secondary:hover {
    background-color: var(--text-muted);
}

/* Print Styles (hidden normally) */
.print-only {
    display: none;
}

@media print {
    body * {
        visibility: hidden;
    }
    
    .print-only, .print-only * {
        visibility: visible;
    }
    
    .print-only {
        position: absolute;
        left: 0;
        top: 0;
        width: 100%;
        display: block;
        color: black;
        background: white;
        padding: 20px;
        font-family: monospace;
    }
    
    .receipt-header {
        text-align: center;
        margin-bottom: 20px;
    }
    
    .receipt-table {
        width: 100%;
        border-collapse: collapse;
        margin-bottom: 20px;
    }
    
    .receipt-table th, .receipt-table td {
        text-align: left;
        padding: 4px 0;
    }
    
    .receipt-table .text-right {
        text-align: right;
    }
    
    .receipt-table border-bottom {
        border-bottom: 1px dashed black;
    }
}
