/* assets/css/style.css */
:root {
    --primary: #3595b2;
    --primary-dark: #2a7a94;
    --primary-light: #ebf9ea;
    --secondary: #cac2b9;
    --success: #4CAF50;
    --danger: #FF6B6B;
    --warning: #FFB74D;
    --info: #3595b2;
    --dark: #1a1a2e;
    --gray: #8a8fa3;
    --light-gray: #f4f4f9;
    --white: #ffffff;
    --shadow: 0 2px 10px rgba(53, 149, 178, 0.15);
    --radius: 12px;
    --transition: all 0.3s ease;
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--primary-light);
    color: var(--dark);
    line-height: 1.6;
    padding-bottom: 80px;
}

/* Navbar */
.navbar {
    background: var(--white);
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 1000;
    padding: 12px 0;
    border-bottom: 3px solid var(--primary);
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--primary);
}

.logo {
    font-size: 1.8rem;
    background: var(--primary-light);
    padding: 4px 8px;
    border-radius: 8px;
}

.nav-toggle {
    display: none;
    flex-direction: column;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 5px;
}

.nav-toggle span {
    display: block;
    width: 25px;
    height: 3px;
    background: var(--primary);
    border-radius: 3px;
    transition: var(--transition);
}

.nav-menu {
    display: flex;
    gap: 20px;
    list-style: none;
    align-items: center;
    flex-wrap: wrap;
}

.nav-link {
    text-decoration: none;
    color: var(--gray);
    font-weight: 500;
    padding: 8px 16px;
    border-radius: 8px;
    transition: var(--transition);
    font-size: 0.95rem;
}

.nav-link:hover {
    color: var(--primary);
    background: var(--primary-light);
}

.nav-link.active {
    color: var(--primary);
    background: var(--primary-light);
    font-weight: 600;
    border-bottom: 2px solid var(--primary);
}

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

.container {
    background: var(--white);
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: var(--shadow);
    margin-bottom: 20px;
    border: 1px solid var(--secondary);
}

/* Cards */
.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--white);
    padding: 20px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    border-left: 4px solid var(--primary);
    transition: var(--transition);
    border: 1px solid var(--secondary);
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 20px rgba(53, 149, 178, 0.2);
    border-color: var(--primary);
}

.stat-card .label {
    font-size: 0.85rem;
    color: var(--gray);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-card .value {
    font-size: 1.8rem;
    font-weight: 700;
    margin-top: 4px;
    color: var(--primary);
}

.stat-card.success { border-left-color: var(--success); }
.stat-card.danger { border-left-color: var(--danger); }
.stat-card.warning { border-left-color: var(--warning); }
.stat-card.info { border-left-color: var(--primary); }

.stat-card .value.success { color: var(--success); }
.stat-card .value.danger { color: var(--danger); }
.stat-card .value.warning { color: var(--warning); }
.stat-card .value.info { color: var(--primary); }

/* Forms */
.form-group {
    margin-bottom: 16px;
}

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

.form-control {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--secondary);
    border-radius: 8px;
    font-size: 1rem;
    transition: var(--transition);
    font-family: inherit;
    background: var(--white);
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(53, 149, 178, 0.15);
}

.form-control.is-invalid {
    border-color: var(--danger);
}

select.form-control {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%233595b2' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}

textarea.form-control {
    resize: vertical;
    min-height: 80px;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    font-family: inherit;
}

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

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(53, 149, 178, 0.3);
}

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

.btn-success:hover {
    background: #45a049;
}

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

.btn-danger:hover {
    background: #e55a5a;
}

.btn-outline {
    background: transparent;
    color: var(--primary);
    border: 2px solid var(--primary);
}

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

.btn-outline-secondary {
    background: transparent;
    color: var(--secondary);
    border: 2px solid var(--secondary);
}

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

.btn-sm {
    padding: 6px 12px;
    font-size: 0.85rem;
}

.btn-block {
    width: 100%;
    justify-content: center;
}

/* Table */
.table-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.95rem;
}

thead {
    background: var(--primary-light);
    border-bottom: 2px solid var(--primary);
}

th, td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid var(--secondary);
}

th {
    font-weight: 600;
    color: var(--primary);
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

tr:hover {
    background: rgba(53, 149, 178, 0.05);
}

/* Progress Bar */
.progress {
    width: 100%;
    height: 8px;
    background: var(--secondary);
    border-radius: 4px;
    overflow: hidden;
    margin-top: 8px;
}

.progress-bar {
    height: 100%;
    border-radius: 4px;
    transition: width 0.6s ease;
    background: var(--primary);
}

.progress-bar.success { background: var(--success); }
.progress-bar.warning { background: var(--warning); }
.progress-bar.danger { background: var(--danger); }

/* Alerts */
.alert {
    padding: 16px;
    border-radius: 8px;
    margin-bottom: 16px;
    border-left: 4px solid;
}

.alert-success {
    background: #d4edda;
    border-color: var(--success);
    color: #155724;
}

.alert-danger {
    background: #f8d7da;
    border-color: var(--danger);
    color: #721c24;
}

.alert-warning {
    background: #fff3cd;
    border-color: var(--warning);
    color: #856404;
}

.alert-info {
    background: var(--primary-light);
    border-color: var(--primary);
    color: var(--primary-dark);
}

/* File Upload */
.file-upload-wrapper {
    position: relative;
    overflow: hidden;
    display: inline-block;
}

.file-upload-wrapper input[type="file"] {
    position: absolute;
    left: 0;
    top: 0;
    opacity: 0;
    width: 100%;
    height: 100%;
    cursor: pointer;
}

.file-upload-label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    background: var(--primary-light);
    border: 2px dashed var(--primary);
    border-radius: 8px;
    cursor: pointer;
    transition: var(--transition);
    width: 100%;
    justify-content: center;
    color: var(--primary);
    font-weight: 500;
}

.file-upload-label:hover {
    border-color: var(--primary-dark);
    background: rgba(53, 149, 178, 0.1);
}

/* Receipt Scanner */
.scanner-container {
    border: 2px dashed var(--secondary);
    border-radius: var(--radius);
    padding: 40px 20px;
    text-align: center;
    transition: var(--transition);
    cursor: pointer;
    background: var(--primary-light);
}

.scanner-container:hover {
    border-color: var(--primary);
    background: rgba(53, 149, 178, 0.08);
}

.scanner-icon {
    font-size: 4rem;
    margin-bottom: 12px;
    color: var(--primary);
}

.scanner-container p {
    color: var(--gray);
    font-weight: 500;
}

.scanner-container .hint {
    font-size: 0.85rem;
    color: var(--secondary);
    margin-top: 8px;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .nav-toggle {
        display: flex;
    }
    
    .nav-menu {
        display: none;
        width: 100%;
        flex-direction: column;
        padding: 16px 0;
        gap: 8px;
    }
    
    .nav-menu.active {
        display: flex;
    }
    
    .nav-link {
        width: 100%;
        padding: 12px 16px;
    }
    
    .nav-link.active {
        border-bottom: none;
        border-left: 3px solid var(--primary);
    }
    
    .card-grid {
        grid-template-columns: 1fr 1fr;
    }
    
    .stat-card .value {
        font-size: 1.4rem;
    }
    
    .container {
        padding: 16px;
    }
    
    th, td {
        padding: 8px 12px;
        font-size: 0.85rem;
    }
    
    .btn {
        width: 100%;
        justify-content: center;
    }
    
    .form-group {
        margin-bottom: 12px;
    }
}

@media (max-width: 480px) {
    .card-grid {
        grid-template-columns: 1fr;
    }
    
    .stat-card {
        padding: 16px;
    }
    
    .stat-card .value {
        font-size: 1.2rem;
    }
}

/* Animations */
@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.animate-in {
    animation: slideIn 0.3s ease forwards;
}

/* Badge */
.badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-success { 
    background: #d4edda; 
    color: #155724; 
}
.badge-danger { 
    background: #f8d7da; 
    color: #721c24; 
}
.badge-warning { 
    background: #fff3cd; 
    color: #856404; 
}
.badge-info { 
    background: var(--primary-light); 
    color: var(--primary-dark); 
}
.badge-primary {
    background: var(--primary);
    color: var(--white);
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--gray);
}

.empty-state .icon {
    font-size: 4rem;
    margin-bottom: 12px;
    color: var(--secondary);
}

.empty-state h3 {
    color: var(--dark);
    margin-bottom: 8px;
}

.empty-state p {
    color: var(--gray);
}

/* Utility Classes */
.text-center { text-align: center; }
.text-right { text-align: right; }
.mt-16 { margin-top: 16px; }
.mb-16 { margin-bottom: 16px; }
.mt-24 { margin-top: 24px; }
.mb-24 { margin-bottom: 24px; }

.flex { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.flex-center { display: flex; justify-content: center; align-items: center; }
.gap-8 { gap: 8px; }
.gap-16 { gap: 16px; }

.hidden { display: none; }

/* Toast Notification */
.toast {
    position: fixed;
    bottom: 20px;
    right: 20px;
    padding: 16px 24px;
    background: var(--dark);
    color: var(--white);
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.2);
    z-index: 9999;
    animation: slideUp 0.3s ease;
    max-width: 90%;
    border-left: 4px solid var(--primary);
}

.toast.success { 
    background: var(--success); 
    border-left-color: #2d7a2d;
}
.toast.error { 
    background: var(--danger); 
    border-left-color: #cc4444;
}
.toast.info { 
    background: var(--primary); 
    border-left-color: var(--primary-dark);
}

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

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 9998;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal-overlay.active {
    display: flex;
}

.modal {
    background: var(--white);
    border-radius: var(--radius);
    padding: 24px;
    max-width: 500px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    animation: slideIn 0.3s ease;
    border: 1px solid var(--secondary);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 2px solid var(--primary-light);
}

.modal-title {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--primary);
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--gray);
    transition: var(--transition);
}

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

/* Tag/Filter */
.tag {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    background: var(--primary-light);
    color: var(--primary);
    font-size: 0.85rem;
    font-weight: 500;
}

/* Responsive Tables */
@media (max-width: 600px) {
    table {
        font-size: 0.8rem;
    }
    
    th, td {
        padding: 6px 8px;
    }
    
    .hide-mobile {
        display: none;
    }
}

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

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

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

::-webkit-scrollbar-thumb:hover {
    background: var(--primary-dark);
}