:root {
    --bg-page: #f8fafc;
    --bg-card: #ffffff;
    --sidebar-bg: #ffffff;
    --primary: #059669;
    --primary-light: #10b981;
    --primary-soft: #ecfdf5;
    --text-main: #1e293b;
    --text-muted: #64748b;
    --border-color: #e2e8f0;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
}

body {
    font-family: 'Outfit', sans-serif;
    background-color: var(--bg-page);
    color: var(--text-main);
    margin: 0;
    overflow-x: hidden;
}

/* Layout */
.wrapper {
    display: flex;
    width: 100%;
    align-items: stretch;
}

#sidebar {
    min-width: 260px;
    max-width: 260px;
    background: var(--sidebar-bg);
    color: var(--text-main);
    transition: all 0.3s;
    min-height: 100vh;
    border-right: 1px solid var(--border-color);
    position: sticky;
    top: 0;
}

#sidebar.active {
    margin-left: -260px;
}

.sidebar-header {
    padding: 2.5rem 1.5rem;
    text-align: center;
    border-bottom: 1px solid var(--border-color);
}

.logo-img {
    max-height: 50px;
}

#sidebar ul.components {
    padding: 1.5rem 1rem;
}

#sidebar ul li a {
    padding: 0.8rem 1.2rem;
    font-size: 0.95rem;
    display: block;
    color: var(--text-muted);
    text-decoration: none;
    border-radius: 10px;
    margin-bottom: 4px;
    font-weight: 500;
    transition: all 0.2s ease;
}

#sidebar ul li a i {
    font-size: 1.2rem;
    margin-right: 12px;
}

#sidebar ul li a:hover, #sidebar ul li.active > a {
    color: var(--primary);
    background: var(--primary-soft);
}

/* Content */
#content {
    width: 100%;
    padding: 1.5rem;
    transition: all 0.3s;
}

.navbar-custom {
    background: var(--bg-card);
    border-bottom: 1px solid var(--border-color);
    padding: 0.75rem 1.5rem;
    margin-bottom: 2rem;
    border-radius: 15px;
    box-shadow: var(--shadow-sm);
}

/* Cards & Components */
.card-modern {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
    transition: box-shadow 0.3s ease;
}

.card-modern:hover {
    box-shadow: var(--shadow);
}

.stat-card-modern {
    display: flex;
    align-items: center;
    padding: 1.5rem;
}

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

.bg-soft-emerald { background-color: #ecfdf5; color: #059669; }
.bg-soft-blue { background-color: #eff6ff; color: #2563eb; }
.bg-soft-red { background-color: #fef2f2; color: #dc2626; }
.bg-soft-amber { background-color: #fffbeb; color: #d97706; }

/* Buttons */
.btn-emerald {
    background-color: var(--primary);
    border-color: var(--primary);
    color: #fff;
    border-radius: 10px;
    padding: 0.6rem 1.5rem;
    font-weight: 500;
}

.btn-emerald:hover {
    background-color: var(--primary-light);
    border-color: var(--primary-light);
    color: #fff;
}

/* Tables */
.table-modern {
    background: var(--bg-card);
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

.table-modern thead th {
    background: #f8fafc;
    color: var(--text-muted);
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.table-modern tbody td {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.9rem;
}

/* Badge Styles */
.badge-soft-success {
    background-color: #dcfce7;
    color: #166534;
    padding: 0.4em 0.8em;
    border-radius: 6px;
    font-weight: 500;
}

.badge-soft-danger {
    background-color: #fee2e2;
    color: #991b1b;
    padding: 0.4em 0.8em;
    border-radius: 6px;
    font-weight: 500;
}

/* Footer Styling */
.footer {
    background: transparent;
}

.hover-effect {
    transition: all 0.3s ease;
}

.hover-effect:hover {
    color: var(--primary-light) !important;
    border-color: var(--primary-light) !important;
    padding-bottom: 3px !important;
}

/* Print Utilities */
.print-only { display: none !important; }

@media print {
    .no-print, .navbar, #sidebar, .btn, .dataTables_filter, .dataTables_length, .dataTables_info, .dataTables_paginate { 
        display: none !important; 
    }
    .print-only { display: block !important; }
    #content { padding: 0 !important; margin: 0 !important; width: 100% !important; }
    .card-modern { border: none !important; box-shadow: none !important; padding: 20px 0 !important; margin-bottom: 20px !important; }
    body { background: #fff !important; }
    
    /* Ensure charts and cards don't split across pages */
    .card-modern, canvas { page-break-inside: avoid; break-inside: avoid; }
    
    /* Optimize Grid for A4 */
    .col-md-3 { width: 50% !important; float: left; }
    .col-md-7, .col-lg-7 { width: 60% !important; float: left; }
    .col-md-5, .col-lg-5 { width: 40% !important; float: left; }
    .row { display: block; }
    .row::after { content: ""; display: table; clear: both; }
}

/* Premium UI Utilities */
.stat-card-premium {
    padding: 24px;
    border-radius: 20px;
    background: #fff;
    border: 1px solid rgba(241, 245, 249, 0.5);
    position: relative;
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.stat-card-premium:hover {
    transform: translateY(-5px);
    box-shadow: 0 20px 40px -15px rgba(0, 0, 0, 0.08);
}
.glass-icon {
    width: 60px; height: 60px;
    border-radius: 16px;
    display: flex; align-items: center; justify-content: center;
    font-size: 24px;
    backdrop-filter: blur(8px);
}
.bg-soft-gradient-emerald { background: linear-gradient(135deg, rgba(5, 150, 105, 0.1), rgba(5, 150, 105, 0)); color: #059669; }
.bg-soft-gradient-blue { background: linear-gradient(135deg, rgba(37, 99, 235, 0.1), rgba(37, 99, 235, 0)); color: #2563eb; }
.bg-soft-gradient-amber { background: linear-gradient(135deg, rgba(245, 158, 11, 0.1), rgba(245, 158, 11, 0)); color: #d97706; }
.bg-soft-gradient-red { background: linear-gradient(135deg, rgba(220, 38, 38, 0.1), rgba(220, 38, 38, 0)); color: #dc2626; }

.text-display { 
    font-weight: 800; 
    letter-spacing: -0.02em; 
}

@media (min-width: 992px) {
    #sidebar.active { margin-left: -260px; }
    #content.active { width: 100%; }
}

/* Mobile & Tablet Styles (< 992px) */
@media (max-width: 991.98px) {
    #sidebar {
        margin-left: -260px;
        position: fixed;
        z-index: 1050;
        height: 100vh;
        box-shadow: 10px 0 30px rgba(0,0,0,0.1);
    }
    
    #sidebar.active {
        margin-left: 0;
    }
    
    #sidebar-overlay {
        display: none;
        position: fixed;
        width: 100vw;
        height: 100vh;
        background: rgba(0, 0, 0, 0.5);
        z-index: 1040;
        top: 0;
        left: 0;
        backdrop-filter: blur(2px);
    }
    
    #sidebar-overlay.active {
        display: block;
    }
    
    #content {
        padding: 1rem;
    }
    
    .navbar-custom {
        margin-bottom: 1.5rem;
        padding: 0.5rem 1rem;
    }
    
    .stat-card-premium {
        padding: 1.2rem;
    }
}

/* Small Phones (< 576px) */
@media (max-width: 575.98px) {
    body {
        font-size: 14px;
    }
    
    #content {
        padding: 0.75rem;
    }
    
    .navbar-custom h5 {
        font-size: 1rem;
    }
    
    .card-modern {
        padding: 1rem;
        border-radius: 12px;
    }
    
    .btn-emerald {
        padding: 0.5rem 1rem;
        font-size: 0.9rem;
    }

    .table-modern thead th, 
    .table-modern tbody td {
        padding: 0.75rem 1rem;
    }
    
    .photo-preview img {
        width: 120px;
        height: 120px;
    }
}

/* DataTables Responsive Fix */
.table-responsive {
    border: none !important;
}

div.dataTables_wrapper div.dataTables_length select,
div.dataTables_wrapper div.dataTables_filter input {
    border-radius: 10px;
    border: 1px solid var(--border-color);
}
