@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

:root {
    /* Color Palette */
    --primary: #4F46E5;
    --primary-hover: #4338CA;
    --secondary: #10B981;
    --danger: #EF4444;
    --warning: #F59E0B;
    --background: #F3F4F6;
    --surface: #FFFFFF;
    --text-main: #111827;
    --text-muted: #6B7280;
    --border: #E5E7EB;
    
    /* Layout */
    --sidebar-width: 260px;
    --header-height: 70px;
    
    /* Effects */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --radius: 0.5rem;
    --transition: all 0.3s ease;
}

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

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--background);
    color: var(--text-main);
    line-height: 1.5;
}

/* Layout */
.app-container {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: var(--sidebar-width);
    background-color: #111827; /* Dark background */
    border-right: 1px solid #1F2937;
    position: fixed;
    height: 100vh;
    display: flex;
    flex-direction: column;
}

.sidebar-brand {
    height: var(--header-height);
    display: flex;
    align-items: center;
    padding: 0 2rem;
    font-size: 1.25rem;
    font-weight: 700;
    color: #FFFFFF;
    border-bottom: 1px solid #1F2937;
}

.sidebar-nav {
    flex: 1;
    padding: 1.5rem 0;
    overflow-y: auto;
}

.nav-item {
    display: flex;
    align-items: center;
    padding: 0.75rem 2rem;
    color: #9CA3AF; /* Light gray text */
    text-decoration: none;
    font-weight: 500;
    transition: var(--transition);
}

.nav-item:hover, .nav-item.active {
    background-color: #1F2937; /* Darker highlight */
    color: #FFFFFF;
    border-right: 4px solid var(--primary);
}

.nav-item i {
    margin-right: 0.75rem;
    font-size: 1.2rem;
}

.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    display: flex;
    flex-direction: column;
}

.header {
    height: var(--header-height);
    background-color: var(--surface);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 2rem;
    position: sticky;
    top: 0;
    z-index: 10;
}

.content-area {
    padding: 2rem;
    flex: 1;
}

/* Typography */
h1 { font-size: 1.875rem; font-weight: 700; margin-bottom: 1.5rem; }
h2 { font-size: 1.5rem; font-weight: 600; margin-bottom: 1rem; }
h3 { font-size: 1.25rem; font-weight: 600; margin-bottom: 0.75rem; }

/* Cards & Widgets */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--surface);
    padding: 1.5rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    display: flex;
    align-items: center;
    transition: var(--transition);
}

.stat-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    margin-right: 1rem;
}

.icon-blue { background: #EEF2FF; color: var(--primary); }
.icon-green { background: #D1FAE5; color: var(--secondary); }
.icon-yellow { background: #FEF3C7; color: var(--warning); }
.icon-red { background: #FEE2E2; color: var(--danger); }

.stat-details h4 {
    color: var(--text-muted);
    font-size: 0.875rem;
    font-weight: 500;
    margin-bottom: 0.25rem;
}

.stat-details p {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-main);
}

/* Tables */
.card {
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.table-responsive {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

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

th {
    background-color: #F9FAFB;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.05em;
}

tr:hover {
    background-color: #F9FAFB;
}

/* Forms */
.form-group {
    margin-bottom: 1.25rem;
}

.form-label {
    display: block;
    font-weight: 500;
    margin-bottom: 0.5rem;
    color: var(--text-main);
}

.form-control {
    width: 100%;
    padding: 0.75rem 1rem;
    font-family: inherit;
    font-size: 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    transition: var(--transition);
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1.5rem;
    font-family: inherit;
    font-weight: 500;
    border-radius: var(--radius);
    border: none;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
}

.btn i {
    margin-right: 0.5rem;
}

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

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

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

.btn-success:hover {
    background-color: #059669;
}

.btn-wa {
    background-color: #25D366;
    color: white;
}
.btn-wa:hover {
    background-color: #128C7E;
}

/* Badges */
.badge {
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
}
.badge-income { background: #D1FAE5; color: #065F46; }
.badge-expense { background: #FEE2E2; color: #991B1B; }

/* Login Page */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100vh;
    background-color: var(--background);
}

.login-card {
    background: var(--surface);
    padding: 2.5rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 400px;
    text-align: center;
}

.login-card h2 {
    margin-bottom: 1.5rem;
    color: var(--primary);
}

.alert {
    padding: 1rem;
    border-radius: var(--radius);
    margin-bottom: 1rem;
}
.alert-error {
    background-color: #FEE2E2;
    color: #991B1B;
    border: 1px solid #F87171;
}
.alert-success {
    background-color: #D1FAE5;
    color: #065F46;
    border: 1px solid #34D399;
}

/* Enterprise Layout Utilities */
.two-column-layout {
    display: grid;
    grid-template-columns: 380px 1fr;
    gap: 2rem;
    align-items: start;
}
@media (max-width: 992px) {
    .two-column-layout {
        grid-template-columns: 1fr;
    }
}
.card-header {
    border-bottom: 1px solid var(--border);
    padding-bottom: 1rem;
    margin-bottom: 1.5rem;
}
.card-header h3 {
    margin: 0;
    font-size: 1.25rem;
    color: var(--primary);
}

/* Print Styles */
@media print {
    body {
        background-color: white !important;
        color: black !important;
    }
    .sidebar {
        display: none !important;
    }
    .main-content {
        margin-left: 0 !important;
        padding: 0 !important;
    }
    .btn, button, a.btn, .btn-print, form {
        display: none !important;
    }
    .card {
        box-shadow: none !important;
        border: none !important;
        padding: 0 !important;
        margin-bottom: 2rem !important;
    }
    table {
        border: 1px solid #ddd;
    }
    th, td {
        padding: 0.5rem !important;
        border-bottom: 1px solid #ddd !important;
    }
    h1, h2, h3, h4 {
        color: black !important;
    }
}

/* Modal Styles */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(17, 24, 39, 0.7);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(4px);
    opacity: 0;
    transition: opacity 0.3s ease;
}

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

.modal-content {
    background: var(--surface);
    width: 100%;
    max-width: 500px;
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    transform: scale(0.95);
    transition: transform 0.3s ease;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
}

.modal-overlay.active .modal-content {
    transform: scale(1);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    border-bottom: 1px solid var(--border);
}

.modal-header h3 {
    margin: 0;
    color: var(--primary);
}

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

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

.modal-content form {
    display: flex;
    flex-direction: column;
    flex: 1;
    overflow: hidden;
}

.modal-body {
    padding: 1.5rem;
    overflow-y: auto;
    flex: 1;
}

.modal-footer {
    padding: 1.5rem;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
    flex-shrink: 0;
}

/* Login Page Enhancements */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #111827 0%, #374151 100%);
}

.login-card {
    background: var(--surface);
    padding: 3rem;
    border-radius: var(--radius);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.5), 0 10px 10px -5px rgba(0, 0, 0, 0.2);
    width: 100%;
    max-width: 400px;
    text-align: center;
    border-top: 4px solid var(--primary);
}

.login-card h2 {
    color: var(--primary);
    margin-bottom: 2rem;
    font-weight: 700;
}

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

.login-card .form-control {
    padding: 0.75rem 1rem;
    font-size: 1rem;
}

.login-card .btn-primary {
    padding: 0.75rem 1rem;
    font-size: 1rem;
    font-weight: 600;
    margin-top: 1rem;
    transition: transform 0.2s, background-color 0.2s;
}

.login-card .btn-primary:hover {
    transform: translateY(-2px);
}
