:root {
    --primary-color: #2563eb;
    --primary-hover: #1d4ed8;
    --secondary-color: #64748b;
    --success-color: #10b981;
    --danger-color: #ef4444;
    --warning-color: #f59e0b;
    --background: #f8fafc;
    --surface: #ffffff;
    --text-primary: #0f172a;
    --text-secondary: #64748b;
    --border-color: #e2e8f0;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1);
    --radius: 0.5rem;
    --transition: all 0.2s ease;
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background-color: var(--background);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
}

/* Header */
header {
    text-align: center;
    padding: 3rem 0 2rem;
}

h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    background: linear-gradient(135deg, var(--primary-color) 0%, #7c3aed 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.subtitle {
    font-size: 1.125rem;
    color: var(--text-secondary);
}

/* Upload Section */
.upload-section {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 2rem;
    box-shadow: var(--shadow-md);
    margin-bottom: 2rem;
}

.upload-area {
    border: 2px dashed var(--border-color);
    border-radius: var(--radius);
    padding: 3rem;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
    position: relative;
    background: var(--background);
}

.upload-area:hover {
    border-color: var(--primary-color);
    background: #f0f9ff;
}

.upload-area.dragover {
    border-color: var(--primary-color);
    background: #dbeafe;
}

.upload-icon {
    width: 3rem;
    height: 3rem;
    color: var(--text-secondary);
    margin-bottom: 1rem;
}

.upload-text {
    color: var(--text-secondary);
}

.camera-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin: 1rem auto 0;
    padding: 0.75rem 1.5rem;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: var(--radius);
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
}

.camera-btn:hover {
    background: var(--primary-hover);
}

.camera-btn svg {
    width: 1.25rem;
    height: 1.25rem;
}

/* Results Section */
.results-section {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 2rem;
    box-shadow: var(--shadow-md);
    margin-bottom: 2rem;
}

.scanned-receipt {
    position: relative;
    max-width: 400px;
    margin: 0 auto 2rem;
}

.scanned-receipt img {
    width: 100%;
    height: auto;
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
}

.receipt-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.extracted-data {
    margin-top: 2rem;
}

.items-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
}

.items-table th,
.items-table td {
    padding: 0.75rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.items-table th {
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.items-table td {
    font-size: 0.9375rem;
}

.category-badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    font-size: 0.75rem;
    font-weight: 500;
    border-radius: 9999px;
    text-transform: uppercase;
}

.category-food { background: #fef3c7; color: #92400e; }
.category-daily { background: #dbeafe; color: #1e40af; }
.category-clothing { background: #fce7f3; color: #9f1239; }
.category-entertainment { background: #e9d5ff; color: #6b21a8; }
.category-transport { background: #d1fae5; color: #065f46; }
.category-medical { background: #fee2e2; color: #991b1b; }
.category-education { background: #ede9fe; color: #5b21b6; }
.category-other { background: #f3f4f6; color: #374151; }

.total-section {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 2px solid var(--border-color);
    font-size: 1.25rem;
    font-weight: 600;
}

.total-amount {
    color: var(--primary-color);
}

.actions {
    display: flex;
    gap: 1rem;
    margin-top: 2rem;
}

/* Buttons */
.btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: var(--radius);
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
}

.btn-primary {
    background: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-hover);
}

.btn-secondary {
    background: var(--surface);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

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

.btn-small {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
}

.btn-icon {
    width: 2rem;
    height: 2rem;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius);
}

/* Statistics Section */
.statistics-section {
    margin-bottom: 2rem;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
}

.stat-card {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 1.5rem;
    box-shadow: var(--shadow-md);
}

.stat-card h3 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 1rem;
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 1rem;
}

.budget-bars {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.budget-item {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.budget-label {
    min-width: 100px;
    font-size: 0.875rem;
}

.budget-bar {
    flex: 1;
    height: 8px;
    background: var(--background);
    border-radius: 4px;
    overflow: hidden;
}

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

.budget-fill.warning {
    background: var(--warning-color);
}

.budget-fill.danger {
    background: var(--danger-color);
}

/* History Section */
.history-section {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 2rem;
    box-shadow: var(--shadow-md);
    margin-bottom: 2rem;
}

.history-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.month-filter {
    padding: 0.5rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    font-size: 1rem;
    background: var(--surface);
}

.history-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.history-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    background: var(--background);
    border-radius: var(--radius);
    transition: var(--transition);
}

.history-item:hover {
    box-shadow: var(--shadow-sm);
}

.history-date {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.history-amount {
    font-weight: 600;
    color: var(--primary-color);
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-content {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 2rem;
    width: 90%;
    max-width: 500px;
    position: relative;
}

.modal-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-secondary);
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    font-size: 1rem;
}

/* Footer */
footer {
    text-align: center;
    padding: 2rem 0;
    border-top: 1px solid var(--border-color);
}

.language-selector {
    margin-bottom: 1rem;
}

.language-selector select {
    padding: 0.5rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    background: var(--surface);
    cursor: pointer;
}

.copyright {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

/* Responsive */
@media (max-width: 768px) {
    h1 {
        font-size: 2rem;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    .actions {
        flex-direction: column;
    }

    .history-controls {
        flex-direction: column;
        gap: 1rem;
    }
}