/* ============================================================
   SISTEM MANAJEMEN KEUANGAN KKN
   Custom Stylesheet
   ============================================================
   Warna Utama:
   - Biru   : #2563eb (primary)
   - Hijau  : #10b981 (success/saldo)
   - Putih  : #ffffff
   - Dark   : #0f172a, #1e293b
   ============================================================ */

/* --- CSS Variables (Light & Dark Mode) --- */
:root {
    /* Colors */
    --primary: #1a7a5a;
    --primary-dark: #135c43;
    --primary-light: #249e77;
    --primary-rgb: 26, 122, 90;
    --success: #10b981;
    --success-dark: #059669;
    --success-rgb: 16, 185, 129;
    --danger: #ef4444;
    --danger-rgb: 239, 68, 68;
    --warning: #f59e0b;
    --warning-rgb: 245, 158, 11;
    --info: #06b6d4;
    --info-rgb: 6, 182, 212;
    --purple: #8b5cf6;
    --purple-rgb: 139, 92, 246;
    
    /* Layout - Light Mode */
    --bg-body: #f6f8f7;
    --bg-card: #ffffff;
    --bg-sidebar: #142922;
    --bg-sidebar-hover: rgba(255, 255, 255, 0.07);
    --bg-sidebar-active: rgba(26, 122, 90, 0.3);
    --bg-navbar: #ffffff;
    --bg-input: #ffffff;
    --border-color: #e2e8f0;
    --text-primary: #1e2925;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;
    --text-sidebar: rgba(255, 255, 255, 0.7);
    --text-sidebar-active: #ffffff;
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.04);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.08);
    
    /* Dimensions */
    --sidebar-width: 260px;
    --sidebar-collapsed: 72px;
    --navbar-height: 64px;
    --border-radius: 12px;
    --transition-speed: 0.3s;
}

/* --- Dark Mode Variables --- */
[data-theme="dark"] {
    --bg-body: #0d1714;
    --bg-card: #15241f;
    --bg-navbar: #15241f;
    --bg-input: #1f332c;
    --border-color: #243831;
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.2);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.4);
}

/* --- Global Reset & Base --- */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background-color: var(--bg-body);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    transition: background-color var(--transition-speed) ease,
                color var(--transition-speed) ease;
}

a {
    text-decoration: none;
    color: var(--primary);
    transition: color 0.2s ease;
}

a:hover {
    color: var(--primary-dark);
}

/* --- Scrollbar Custom --- */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--text-muted);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}

/* ============================================================
   SIDEBAR
   ============================================================ */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--bg-sidebar);
    z-index: 1050;
    transition: width var(--transition-speed) ease;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.sidebar.collapsed {
    width: var(--sidebar-collapsed);
}

/* Sidebar Header / Brand */
.sidebar-brand {
    display: flex;
    align-items: center;
    padding: 20px;
    gap: 12px;
    min-height: var(--navbar-height);
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.sidebar-brand .brand-icon {
    width: 40px;
    height: 40px;
    min-width: 40px;
    max-width: 40px;
    max-height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    position: relative;
    flex-shrink: 0;
}

.sidebar-brand .brand-icon img {
    width: 40px;
    height: 40px;
    max-width: 40px;
    max-height: 40px;
    object-fit: cover;
    border-radius: 10px;
    display: block;
}

.sidebar-brand .brand-text {
    white-space: nowrap;
    overflow: hidden;
    transition: opacity var(--transition-speed) ease;
}

.sidebar-brand .brand-text h5 {
    font-size: 0.95rem;
    font-weight: 700;
    color: #fff;
    margin: 0;
    line-height: 1.2;
}

.sidebar-brand .brand-text small {
    font-size: 0.7rem;
    color: rgba(255, 255, 255, 0.4);
}

.sidebar.collapsed .brand-text {
    opacity: 0;
    width: 0;
}

/* Sidebar Navigation */
.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 12px 0;
}

.sidebar-nav::-webkit-scrollbar {
    width: 3px;
}

.sidebar-nav::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
}

.nav-section-title {
    font-size: 0.65rem;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.3);
    text-transform: uppercase;
    letter-spacing: 1px;
    padding: 16px 20px 8px;
    white-space: nowrap;
    overflow: hidden;
    transition: opacity var(--transition-speed) ease;
}

.sidebar.collapsed .nav-section-title {
    opacity: 0;
    height: 0;
    padding: 0;
}

.nav-item {
    padding: 0 12px;
    margin-bottom: 2px;
}

.nav-link {
    display: flex;
    align-items: center;
    padding: 10px 12px;
    border-radius: 10px;
    color: var(--text-sidebar) !important;
    font-size: 0.875rem;
    font-weight: 500;
    gap: 12px;
    transition: all 0.2s ease;
    white-space: nowrap;
    overflow: hidden;
    position: relative;
}

.nav-link i {
    font-size: 1.05rem;
    width: 20px;
    min-width: 20px;
    text-align: center;
    transition: transform 0.2s ease;
}

.nav-link:hover {
    background: var(--bg-sidebar-hover);
    color: #fff !important;
}

.nav-link:hover i {
    transform: scale(1.1);
}

.nav-link.active {
    background: var(--bg-sidebar-active);
    color: var(--text-sidebar-active) !important;
    font-weight: 600;
}

.nav-link.active::before {
    content: '';
    position: absolute;
    left: -12px;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 24px;
    background: var(--primary);
    border-radius: 0 3px 3px 0;
}

.nav-link .link-text {
    transition: opacity var(--transition-speed) ease;
}

.sidebar.collapsed .nav-link .link-text {
    opacity: 0;
    width: 0;
}

/* Sidebar Footer */
.sidebar-footer {
    padding: 16px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.sidebar-footer .user-info {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px;
    border-radius: 10px;
    overflow: hidden;
}

.sidebar-footer .user-avatar {
    width: 36px;
    height: 36px;
    min-width: 36px;
    background: linear-gradient(135deg, var(--primary), var(--purple));
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 700;
    font-size: 0.85rem;
}

.sidebar-footer .user-details {
    overflow: hidden;
    transition: opacity var(--transition-speed) ease;
}

.sidebar.collapsed .sidebar-footer .user-details {
    opacity: 0;
    width: 0;
}

.sidebar-footer .user-details h6 {
    font-size: 0.8rem;
    color: #fff;
    margin: 0;
    white-space: nowrap;
}

.sidebar-footer .user-details span {
    font-size: 0.7rem;
    color: rgba(255, 255, 255, 0.4);
    text-transform: capitalize;
}

/* ============================================================
   NAVBAR (Top)
   ============================================================ */
.main-navbar {
    position: fixed;
    top: 0;
    left: var(--sidebar-width);
    right: 0;
    height: var(--navbar-height);
    background: var(--bg-navbar);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    z-index: 1040;
    transition: left var(--transition-speed) ease,
                background-color var(--transition-speed) ease,
                border-color var(--transition-speed) ease;
    box-shadow: var(--shadow-sm);
}

.sidebar.collapsed ~ .main-navbar {
    left: var(--sidebar-collapsed);
}

.navbar-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.sidebar-toggle {
    width: 36px;
    height: 36px;
    border: none;
    background: transparent;
    border-radius: 10px;
    color: var(--text-secondary);
    font-size: 1.1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.sidebar-toggle:hover {
    background: rgba(var(--primary-rgb), 0.1);
    color: var(--primary);
}

/* Breadcrumb */
.page-breadcrumb {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.page-breadcrumb a {
    color: var(--text-muted);
}

.page-breadcrumb a:hover {
    color: var(--primary);
}

.page-breadcrumb .separator {
    color: var(--text-muted);
    font-size: 0.7rem;
}

.page-breadcrumb .current {
    color: var(--text-primary);
    font-weight: 600;
}

/* Navbar Right */
.navbar-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.nav-icon-btn {
    width: 38px;
    height: 38px;
    border: none;
    background: transparent;
    border-radius: 10px;
    color: var(--text-secondary);
    font-size: 1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    position: relative;
}

.nav-icon-btn:hover {
    background: rgba(var(--primary-rgb), 0.1);
    color: var(--primary);
}

.nav-icon-btn .badge-dot {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 8px;
    height: 8px;
    background: var(--danger);
    border-radius: 50%;
    border: 2px solid var(--bg-navbar);
}

.dark-mode-switch {
    position: relative;
    width: 38px;
    height: 38px;
}

.dark-mode-switch i {
    transition: transform 0.5s ease, opacity 0.3s ease;
}

/* ============================================================
   MAIN CONTENT
   ============================================================ */
.main-content {
    margin-left: var(--sidebar-width);
    margin-top: var(--navbar-height);
    padding: 24px;
    min-height: calc(100vh - var(--navbar-height));
    transition: margin-left var(--transition-speed) ease;
}

.sidebar.collapsed ~ .main-content {
    margin-left: var(--sidebar-collapsed);
}

/* Page Header */
.page-header {
    margin-bottom: 24px;
}

.page-header h1 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
}

.page-header p {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin: 4px 0 0;
}

/* ============================================================
   CARDS
   ============================================================ */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-sm);
    transition: all var(--transition-speed) ease;
}

.card:hover {
    box-shadow: var(--shadow-md);
}

.card-header {
    background: transparent;
    border-bottom: 1px solid var(--border-color);
    padding: 16px 20px;
    font-weight: 600;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.card-body {
    padding: 20px;
}

/* Dashboard: Greeting */
.dash-greeting {
    margin-bottom: 24px;
}

.dash-greeting h2 {
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 4px;
}

.dash-greeting p {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin: 0;
}

/* Dashboard: Saldo Hero */
.saldo-hero {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 14px;
    padding: 28px 32px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    flex-wrap: wrap;
    box-shadow: var(--shadow-sm);
    border-left: 4px solid #1a7a5a;
}

.saldo-hero-left {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.saldo-hero-left .saldo-label {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.saldo-hero-left .saldo-amount {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.5px;
}

.saldo-hero-right {
    display: flex;
    align-items: center;
    gap: 24px;
}

.saldo-divider {
    width: 1px;
    height: 40px;
    background: var(--border-color);
}

.saldo-mini {
    display: flex;
    align-items: center;
    gap: 10px;
}

.saldo-mini i {
    font-size: 0.8rem;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    background: #eef6f3;
    color: #1a7a5a;
}

.saldo-mini i.text-out {
    background: #fef3f2;
    color: #c53030;
}

.saldo-mini small {
    display: block;
    font-size: 0.7rem;
    color: var(--text-secondary);
    margin-bottom: 1px;
}

.saldo-mini strong {
    display: block;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
}

/* Dashboard: Mini Cards */
.mini-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 14px;
    box-shadow: var(--shadow-sm);
    transition: box-shadow 0.2s;
}

.mini-card:hover {
    box-shadow: var(--shadow-md);
}

.mini-icon {
    width: 42px;
    height: 42px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    flex-shrink: 0;
}

.mini-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.mini-label {
    font-size: 0.72rem;
    font-weight: 500;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.mini-value {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Responsive - Saldo Hero */
@media (max-width: 767.98px) {
    .saldo-hero {
        padding: 20px;
        flex-direction: column;
        align-items: flex-start;
    }
    .saldo-hero-left .saldo-amount {
        font-size: 1.4rem;
    }
    .saldo-hero-right {
        width: 100%;
        padding-top: 16px;
        border-top: 1px solid var(--border-color);
    }
    .dash-greeting h2 {
        font-size: 1.15rem;
    }
}

/* Legacy stat-card support (other pages) */
.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 14px;
    padding: 20px;
    position: relative;
    overflow: hidden;
    transition: box-shadow 0.2s;
}

.stat-card:hover {
    box-shadow: var(--shadow-md);
}

.stat-card .stat-icon {
    width: 42px;
    height: 42px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    margin-bottom: 14px;
}

.stat-card.saldo .stat-icon { background: rgba(var(--primary-rgb), 0.08); color: var(--primary); }
.stat-card.pemasukan .stat-icon { background: rgba(var(--success-rgb), 0.08); color: var(--success); }
.stat-card.pengeluaran .stat-icon { background: rgba(var(--danger-rgb), 0.08); color: var(--danger); }
.stat-card.transaksi .stat-icon { background: rgba(var(--info-rgb), 0.08); color: var(--info); }
.stat-card.bulan-masuk .stat-icon { background: rgba(var(--purple-rgb), 0.08); color: var(--purple); }
.stat-card.bulan-keluar .stat-icon { background: rgba(var(--warning-rgb), 0.08); color: var(--warning); }

.stat-card .stat-label {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 4px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.stat-card .stat-value {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
}

/* ============================================================
   TABLES
   ============================================================ */
.table {
    color: var(--text-primary);
}

.table thead th {
    background: rgba(var(--primary-rgb), 0.04);
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    border-bottom: 2px solid var(--border-color);
    padding: 12px 16px;
    white-space: nowrap;
}

.table tbody td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
    vertical-align: middle;
    font-size: 0.875rem;
}

.table tbody tr {
    transition: background-color 0.15s ease;
}

.table tbody tr:hover {
    background: rgba(var(--primary-rgb), 0.03);
}

/* DataTables Override */
.dataTables_wrapper .dataTables_length select,
.dataTables_wrapper .dataTables_filter input {
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    border-radius: 8px;
    padding: 6px 12px;
    font-size: 0.85rem;
}

.dataTables_wrapper .dataTables_info,
.dataTables_wrapper .dataTables_length label,
.dataTables_wrapper .dataTables_filter label {
    color: var(--text-secondary);
    font-size: 0.85rem;
}

.dataTables_wrapper .dataTables_paginate .paginate_button {
    border-radius: 8px !important;
    border: 1px solid var(--border-color) !important;
    color: var(--text-secondary) !important;
    background: var(--bg-card) !important;
    margin: 0 2px;
    font-size: 0.85rem;
}

.dataTables_wrapper .dataTables_paginate .paginate_button.current {
    background: var(--primary) !important;
    border-color: var(--primary) !important;
    color: #fff !important;
}

.dataTables_wrapper .dataTables_paginate .paginate_button:hover:not(.current) {
    background: rgba(var(--primary-rgb), 0.1) !important;
    border-color: var(--primary) !important;
    color: var(--primary) !important;
}

/* ============================================================
   FORMS
   ============================================================ */
.form-control,
.form-select {
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    border-radius: 10px;
    padding: 10px 16px;
    font-size: 0.9rem;
    font-family: 'Inter', sans-serif;
    transition: all 0.2s ease;
}

.form-control:focus,
.form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(var(--primary-rgb), 0.15);
    background: var(--bg-input);
    color: var(--text-primary);
}

.form-control::placeholder {
    color: var(--text-muted);
}

.form-label {
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--text-primary);
    margin-bottom: 6px;
}

.form-text {
    font-size: 0.78rem;
    color: var(--text-muted);
}

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
    border-radius: 10px;
    font-weight: 600;
    font-size: 0.875rem;
    font-family: 'Inter', sans-serif;
    padding: 10px 20px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s ease;
    border: none;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: #fff;
    box-shadow: 0 2px 8px rgba(var(--primary-rgb), 0.25);
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(var(--primary-rgb), 0.35);
    background: linear-gradient(135deg, var(--primary-light), var(--primary));
}

.btn-success {
    background: linear-gradient(135deg, var(--success), var(--success-dark));
    color: #fff;
    box-shadow: 0 2px 8px rgba(var(--success-rgb), 0.25);
}

.btn-success:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(var(--success-rgb), 0.35);
}

.btn-danger {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    color: #fff;
    box-shadow: 0 2px 8px rgba(var(--danger-rgb), 0.25);
}

.btn-danger:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(var(--danger-rgb), 0.35);
}

.btn-warning {
    background: linear-gradient(135deg, var(--warning), #d97706);
    color: #fff;
    box-shadow: 0 2px 8px rgba(var(--warning-rgb), 0.25);
}

.btn-outline-primary {
    border: 1.5px solid var(--primary);
    color: var(--primary);
    background: transparent;
}

.btn-outline-primary:hover {
    background: var(--primary);
    color: #fff;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 0.8rem;
    border-radius: 8px;
}

.btn-icon {
    width: 34px;
    height: 34px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
}

/* ============================================================
   BADGES
   ============================================================ */
.badge {
    font-weight: 600;
    font-size: 0.75rem;
    padding: 4px 10px;
    border-radius: 6px;
}

.badge-pemasukan {
    background: rgba(var(--success-rgb), 0.1);
    color: var(--success);
}

.badge-pengeluaran {
    background: rgba(var(--danger-rgb), 0.1);
    color: var(--danger);
}

.badge-admin {
    background: rgba(var(--primary-rgb), 0.1);
    color: var(--primary);
}

.badge-bendahara {
    background: rgba(var(--purple-rgb), 0.1);
    color: var(--purple);
}

/* ============================================================
   LOADING SPINNER
   ============================================================ */
.loading-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(4px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.loading-overlay.show {
    display: flex;
}

.loading-spinner {
    width: 48px;
    height: 48px;
    border: 4px solid rgba(255, 255, 255, 0.2);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ============================================================
   UPLOAD PREVIEW
   ============================================================ */
.upload-preview {
    width: 100%;
    max-width: 200px;
    height: 140px;
    border: 2px dashed var(--border-color);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    margin-top: 8px;
    transition: border-color 0.3s ease;
    background: rgba(var(--primary-rgb), 0.02);
}

.upload-preview:hover {
    border-color: var(--primary);
}

.upload-preview img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.upload-preview .placeholder-text {
    color: var(--text-muted);
    font-size: 0.8rem;
    text-align: center;
}

.upload-preview .placeholder-text i {
    font-size: 2rem;
    display: block;
    margin-bottom: 8px;
    opacity: 0.3;
}

/* ============================================================
   CHART CONTAINER
   ============================================================ */
.chart-container {
    position: relative;
    width: 100%;
    height: 300px;
    padding: 10px;
}

/* ============================================================
   UTILITIES
   ============================================================ */
.text-primary-custom { color: var(--primary) !important; }
.text-success-custom { color: var(--success) !important; }
.text-danger-custom { color: var(--danger) !important; }

.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }

/* Animate on scroll entry */
.fade-in {
    animation: fadeIn 0.4s ease forwards;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ============================================================
   PRINT STYLES
   ============================================================ */
@media print {
    .sidebar, .main-navbar, .btn, .dataTables_length,
    .dataTables_filter, .dataTables_paginate, .dataTables_info,
    .no-print {
        display: none !important;
    }
    
    .main-content {
        margin: 0 !important;
        padding: 20px !important;
    }
    
    .card {
        border: none !important;
        box-shadow: none !important;
    }
    
    body {
        background: #fff !important;
        color: #000 !important;
    }
    
    .table thead th {
        background: #f3f4f6 !important;
        color: #000 !important;
    }
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 991.98px) {
    .sidebar {
        transform: translateX(-100%);
        width: var(--sidebar-width) !important;
    }
    
    .sidebar.mobile-show {
        transform: translateX(0);
    }
    
    .main-navbar {
        left: 0 !important;
    }
    
    .main-content {
        margin-left: 0 !important;
    }
    
    .sidebar-overlay {
        display: none;
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 1045;
    }
    
    .sidebar-overlay.show {
        display: block;
    }
}

@media (max-width: 767.98px) {
    .main-content {
        padding: 16px;
    }
    
    .page-header h1 {
        font-size: 1.25rem;
    }
    
    .stat-card {
        padding: 16px;
    }
    
    .stat-card .stat-value {
        font-size: 1.1rem;
    }
    
    .page-breadcrumb {
        display: none;
    }
    
    .chart-container {
        height: 220px;
    }
}

@media (max-width: 575.98px) {
    .btn {
        padding: 8px 14px;
        font-size: 0.8rem;
    }
    
    .card-body {
        padding: 16px;
    }
    
    .table-responsive {
        font-size: 0.8rem;
    }
}

/* ============================================================
   PUBLIC PORTAL STYLES
   ============================================================ */
.public-navbar {
    background: var(--bg-navbar);
    border-bottom: 1px solid var(--border-color);
    padding: 14px 24px;
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 0;
    z-index: 1030;
}

.public-navbar .brand-logo {
    display: flex;
    align-items: center;
    gap: 12px;
}

.public-navbar .brand-logo img {
    width: 42px;
    height: 42px;
    border-radius: 10px;
    object-fit: cover;
}

.public-navbar .brand-title h5 {
    font-size: 1.05rem;
    font-weight: 700;
    margin: 0;
    color: var(--text-primary);
}

.public-navbar .brand-title small {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.chart-pie-container {
    position: relative;
    width: 100%;
    height: 280px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px;
}

/* ============================================================
   RESPONSIVE PUBLIC PORTAL
   ============================================================ */
@media (max-width: 991.98px) {
    .public-navbar {
        padding: 12px 16px;
    }
    .hero-public {
        padding: 24px 20px;
    }
    .chart-pie-container {
        height: 260px;
    }
}

@media (max-width: 767.98px) {
    .public-container {
        padding: 16px 12px 32px;
    }
    .public-navbar {
        padding: 10px 12px;
    }
    .public-navbar .brand-logo img {
        width: 34px;
        height: 34px;
    }
    .public-navbar .brand-title h5 {
        font-size: 0.85rem;
    }
    .public-navbar .brand-title small {
        font-size: 0.65rem;
    }
    .hero-public {
        padding: 18px 16px;
        border-radius: 12px;
    }
    .hero-public h2 {
        font-size: 1.2rem;
    }
    .hero-public p {
        font-size: 0.8rem;
    }
    .chart-pie-container {
        height: 240px;
    }
    .filter-card {
        padding: 14px 14px;
    }
    .mini-card {
        padding: 14px 16px;
    }
    .mini-value {
        font-size: 0.95rem;
    }
}

@media (max-width: 575.98px) {
    .public-navbar .btn-sm {
        padding: 5px 8px;
        font-size: 0.75rem;
    }
    .chart-pie-container {
        height: 220px;
        padding: 4px;
    }
    .hero-public .fs-3 {
        font-size: 1.35rem !important;
    }
    .table-responsive table {
        font-size: 0.78rem;
    }
}


