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

:root {
    --primary: #2c3e50;
    --primary-dark: #1a252f;
    --secondary: #3498db;
    --success: #27ae60;
    --danger: #e74c3c;
    --warning: #f39c12;
    --light: #ecf0f1;
    --dark: #2c3e50;
    --gray: #95a5a6;
    --shadow: 0 2px 10px rgba(0,0,0,0.1);
    --border-radius: 12px;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    margin: 0;
    padding: 0;
}

/* Schermate */
.screen {
    display: none;
    min-height: 100vh;
}

.screen.active {
    display: block;
}

/* Login Screen */
.login-container {
    max-width: 400px;
    margin: 0 auto;
    padding: 2rem;
    background: white;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    text-align: center;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 90%;
}

.logo {
    margin-bottom: 1rem;
    color: var(--primary);
}

.login-container h1 {
    margin-bottom: 2rem;
    color: var(--dark);
    font-size: 1.5rem;
}

.login-container input {
    width: 100%;
    padding: 12px;
    margin: 8px 0;
    border: 1px solid var(--gray);
    border-radius: 8px;
    font-size: 16px;
}

.btn-primary {
    background: var(--secondary);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 16px;
    cursor: pointer;
    width: 100%;
    margin-top: 16px;
    transition: all 0.3s;
}

.btn-primary:hover {
    background: #2980b9;
    transform: translateY(-2px);
}

/* App Screen */
#appScreen {
    background: var(--light);
    min-height: 100vh;
    padding-bottom: 70px;
}

/* Header */
header {
    background: white;
    padding: 16px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 100;
}

header h1 {
    font-size: 1.2rem;
    color: var(--primary);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.icon-btn {
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    padding: 6px;
    border-radius: 50%;
    transition: all 0.3s;
}

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

/* Bottom Navigation */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: white;
    display: flex;
    justify-content: space-around;
    padding: 10px 0;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.1);
    z-index: 100;
}

.nav-item {
    background: none;
    border: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 8px;
    cursor: pointer;
    transition: all 0.3s;
    border-radius: 8px;
    color: var(--gray);
}

.nav-item.active {
    color: var(--secondary);
    background: rgba(52, 152, 219, 0.1);
}

.nav-icon {
    font-size: 24px;
}

.nav-label {
    font-size: 12px;
}

/* Main Content */
main {
    padding: 20px;
    max-width: 800px;
    margin: 0 auto;
}

.menu-panel {
    display: none;
    animation: fadeIn 0.3s;
}

.menu-panel.active {
    display: block;
}

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

/* Card */
.card {
    background: white;
    border-radius: var(--border-radius);
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: var(--shadow);
}

.card h2 {
    margin-bottom: 20px;
    color: var(--dark);
    font-size: 1.2rem;
}

/* Bottoni */
.btn-camera {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 50px;
    border-radius: var(--border-radius);
    font-size: 48px;
    cursor: pointer;
    width: 100%;
    transition: all 0.3s;
    margin-bottom: 20px;
}

.btn-camera:hover {
    transform: scale(0.98);
}

.btn-success {
    background: var(--success);
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 8px;
    cursor: pointer;
    width: 100%;
    margin-top: 10px;
}

.btn-secondary {
    background: var(--secondary);
    color: white;
    border: none;
    padding: 10px;
    border-radius: 8px;
    cursor: pointer;
    width: 100%;
    margin: 8px 0;
}

.btn-danger {
    background: var(--danger);
    color: white;
    border: none;
    padding: 10px;
    border-radius: 8px;
    cursor: pointer;
    width: 100%;
    margin: 8px 0;
}

.btn-warning {
    background: var(--warning);
    color: white;
    border: none;
    padding: 10px;
    border-radius: 8px;
    cursor: pointer;
    width: 100%;
    margin: 8px 0;
}

/* Form */
.form-group {
    margin: 12px 0;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    color: var(--dark);
    font-weight: 500;
}

.form-group input {
    width: 100%;
    padding: 10px;
    border: 1px solid var(--gray);
    border-radius: 8px;
    font-size: 14px;
}

/* Anteprima foto */
#photoPreview {
    margin-top: 20px;
}

#previewImage {
    max-width: 100%;
    border-radius: var(--border-radius);
    margin-bottom: 10px;
}

/* Progress bar */
.progress-bar {
    width: 100%;
    height: 4px;
    background: var(--light);
    border-radius: 2px;
    overflow: hidden;
    margin: 10px 0;
}

.progress-fill {
    width: 0%;
    height: 100%;
    background: var(--secondary);
    transition: width 0.3s;
}

/* Ricerca */
.search-bar {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.search-bar input {
    flex: 1;
    padding: 10px;
    border: 1px solid var(--gray);
    border-radius: 8px;
}

.search-bar select {
    padding: 10px;
    border: 1px solid var(--gray);
    border-radius: 8px;
    background: white;
}

/* Lista scontrini */
.receipt-list {
    max-height: 500px;
    overflow-y: auto;
}

.receipt-item {
    background: var(--light);
    margin: 10px 0;
    padding: 15px;
    border-radius: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.3s;
}

.receipt-item:hover {
    transform: translateX(5px);
    background: #e0e0e0;
}

.receipt-info {
    flex: 1;
}

.receipt-date {
    font-size: 12px;
    color: var(--gray);
}

.receipt-total {
    font-weight: bold;
    color: var(--success);
    font-size: 18px;
}

.receipt-actions {
    display: flex;
    gap: 8px;
}

.delete-btn {
    background: var(--danger);
    color: white;
    border: none;
    padding: 5px 10px;
    border-radius: 4px;
    cursor: pointer;
}

.view-btn {
    background: var(--secondary);
    color: white;
    border: none;
    padding: 5px 10px;
    border-radius: 4px;
    cursor: pointer;
}

/* Statistiche */
.stats-summary {
    margin-top: 20px;
    padding: 15px;
    background: var(--light);
    border-radius: 8px;
}

.stat-item {
    display: flex;
    justify-content: space-between;
    margin: 8px 0;
}
/* Store name styling */
.receipt-store {
    font-size: 16px;
    margin-bottom: 5px;
    color: var(--primary);
}

.ocr-text {
    background: #f8f9fa;
    padding: 10px;
    border-radius: 8px;
    margin: 10px 0;
    font-size: 13px;
}

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

.sync-badge {
    display: inline-block;
    background: var(--warning);
    color: white;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 11px;
    margin-top: 5px;
}

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

.modal-content {
    background: white;
    max-width: 90%;
    max-height: 90%;
    overflow-y: auto;
    padding: 20px;
    border-radius: 12px;
    position: relative;
}

.close {
    position: absolute;
    top: 10px;
    right: 15px;
    font-size: 28px;
    cursor: pointer;
    color: var(--gray);
}

.close:hover {
    color: var(--danger);
}

/* Profilo */
.profile-info {
    margin: 20px 0;
}

.profile-info p {
    margin: 10px 0;
    padding: 8px;
    background: var(--light);
    border-radius: 6px;
}

/* Toast */
.toast {
    position: fixed;
    bottom: 80px;
    left: 20px;
    right: 20px;
    background: var(--dark);
    color: white;
    padding: 12px;
    border-radius: 8px;
    text-align: center;
    z-index: 1000;
    transition: all 0.3s;
    opacity: 0;
    pointer-events: none;
}

.toast.show {
    opacity: 1;
}

/* Error message */
.error-message {
    color: var(--danger);
    margin-top: 10px;
    font-size: 14px;
}

.update-toast-btn {
    background: var(--success);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    margin-left: 10px;
    cursor: pointer;
}

.update-toast-btn:hover {
    background: #219a52;
}
/* Responsive */
@media (max-width: 600px) {
    .card {
        padding: 15px;
    }
    
    .btn-camera {
        padding: 40px;
        font-size: 40px;
    }
    
    .receipt-item {
        flex-direction: column;
        text-align: center;
        gap: 10px;
    }
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--light);
}

::-webkit-scrollbar-thumb {
    background: var(--gray);
    border-radius: 4px;
}
