/**
 * SIMOKU - Sistem Monitoring Keuangan Kecamatan
 * Premium Design System
 */

/* ============================================================
   CSS VARIABLES
   ============================================================ */
:root {
    /* Primary Palette */
    --primary: #2563eb;
    --primary-light: #3b82f6;
    --primary-dark: #1d4ed8;
    --primary-rgb: 37, 99, 235;
    
    /* Accent */
    --accent: #0891b2;
    --accent-light: #06b6d4;
    --accent-dark: #0e7490;
    
    /* Semantic */
    --success: #16a34a;
    --warning: #d97706;
    --danger: #dc2626;
    --info: #0284c7;
    
    /* Neutrals — White dominant */
    --bg-body: #f8fafc;
    --bg-card: #ffffff;
    --bg-sidebar: #ffffff;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;
    --border-color: #e2e8f0;
    
    /* Layout */
    --sidebar-width: 260px;
    --sidebar-collapsed: 0px;
    --navbar-height: 60px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.04), 0 1px 2px rgba(0,0,0,0.03);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.06);
    --shadow-lg: 0 8px 30px rgba(0,0,0,0.08);
    --shadow-xl: 0 20px 60px rgba(0,0,0,0.1);
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;
}

/* ============================================================
   BASE & TYPOGRAPHY
   ============================================================ */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-body);
    color: var(--text-primary);
    font-size: 14px;
    line-height: 1.6;
    overflow-x: hidden;
}

h1, h2, h3, h4, h5, h6 {
    font-weight: 700;
    color: var(--text-primary);
}

a {
    color: var(--primary-light);
    text-decoration: none;
    transition: var(--transition);
}

a:hover {
    color: var(--primary);
}

/* ============================================================
   TOP NAVBAR
   ============================================================ */
.navbar-top {
    height: var(--navbar-height);
    background: var(--bg-card);
    border-bottom: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    z-index: 1030;
    padding: 0 1rem;
}

.sidebar-toggle {
    color: var(--text-primary);
    font-size: 1.2rem;
    padding: 0.4rem 0.6rem;
    border-radius: var(--radius-sm);
    transition: var(--transition);
}

.sidebar-toggle:hover {
    background: rgba(var(--primary-rgb), 0.08);
    color: var(--primary);
}

.navbar-brand {
    display: flex;
    align-items: center;
    text-decoration: none !important;
}

.brand-icon {
    width: 38px;
    height: 38px;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 1rem;
    box-shadow: 0 2px 8px rgba(var(--primary-rgb), 0.3);
}

.brand-name {
    font-weight: 800;
    font-size: 1.15rem;
    color: var(--primary);
    letter-spacing: -0.5px;
}

.brand-tagline {
    font-size: 0.65rem;
    color: var(--text-muted);
    font-weight: 400;
    line-height: 1;
    margin-top: -2px;
}

.nav-kecamatan {
    background: rgba(var(--primary-rgb), 0.06);
    padding: 0.35rem 0.75rem;
    border-radius: 50px;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--primary);
}

.nav-user-btn {
    color: var(--text-primary) !important;
    text-decoration: none !important;
    display: flex;
    align-items: center;
    font-size: 0.85rem;
    font-weight: 500;
}

.user-avatar {
    width: 34px;
    height: 34px;
    background: linear-gradient(135deg, var(--primary-light), var(--accent));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 0.8rem;
}

/* ============================================================
   SIDEBAR — White Professional
   ============================================================ */
.sidebar {
    position: fixed;
    top: var(--navbar-height);
    left: 0;
    width: var(--sidebar-width);
    height: calc(100vh - var(--navbar-height));
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border-color);
    z-index: 1020;
    overflow-y: auto;
    overflow-x: hidden;
    transition: var(--transition);
    display: flex;
    flex-direction: column;
}

.sidebar::-webkit-scrollbar {
    width: 4px;
}

.sidebar::-webkit-scrollbar-track {
    background: transparent;
}

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

/* Sidebar Profile */
.sidebar-profile {
    padding: 1.25rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    border-bottom: 1px solid var(--border-color);
}

.profile-avatar {
    width: 44px;
    height: 44px;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 1.3rem;
}

.profile-name {
    color: var(--text-primary);
    font-size: 0.85rem;
    font-weight: 600;
    margin: 0;
    line-height: 1.3;
}

.profile-role {
    font-size: 0.7rem;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
}

/* Sidebar Navigation */
.sidebar-nav {
    flex: 1;
    padding: 0.5rem 0;
}

.nav-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.nav-header {
    padding: 1rem 1.25rem 0.4rem;
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--text-muted);
}

.nav-item .nav-link {
    display: flex;
    align-items: center;
    padding: 0.6rem 1.25rem;
    color: var(--text-secondary);
    font-size: 0.82rem;
    font-weight: 500;
    transition: var(--transition);
    border-left: 3px solid transparent;
    gap: 0.75rem;
}

.nav-item .nav-link i {
    width: 20px;
    text-align: center;
    font-size: 0.9rem;
}

.nav-item .nav-link:hover {
    color: var(--primary);
    background: rgba(var(--primary-rgb), 0.04);
    border-left-color: rgba(var(--primary-rgb), 0.2);
}

.nav-item.active .nav-link {
    color: var(--primary);
    background: rgba(var(--primary-rgb), 0.06);
    border-left-color: var(--primary);
    font-weight: 600;
}

.nav-item.active .nav-link i {
    color: var(--primary);
}

/* Sidebar Footer */
.sidebar-footer {
    padding: 1rem 1.25rem;
    border-top: 1px solid var(--border-color);
}

.sidebar-footer .btn-outline-light {
    font-size: 0.75rem;
    border-color: var(--border-color);
    color: var(--text-secondary);
}

.sidebar-footer .btn-outline-light:hover {
    background: rgba(var(--primary-rgb), 0.06);
    border-color: var(--primary-light);
    color: var(--primary);
}

/* ============================================================
   MAIN CONTENT AREA
   ============================================================ */
.main-wrapper {
    display: flex;
    min-height: 100vh;
    padding-top: var(--navbar-height);
}

.content-area {
    flex: 1;
    margin-left: var(--sidebar-width);
    padding: 1.5rem;
    transition: var(--transition);
    min-height: calc(100vh - var(--navbar-height));
    min-width: 0;
}

/* Page Header */
.page-header {
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1rem;
}

.page-header h1 {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--text-primary);
    margin: 0;
}

.page-header .breadcrumb {
    margin: 0;
    font-size: 0.78rem;
}

.page-header .breadcrumb-item a {
    color: var(--text-secondary);
}

.page-header .breadcrumb-item.active {
    color: var(--primary);
    font-weight: 600;
}

/* ============================================================
   CARDS
   ============================================================ */
.card {
    background: var(--bg-card);
    border: none;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
}

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

.card-header {
    background: transparent;
    border-bottom: 1px solid var(--border-color);
    padding: 1rem 1.25rem;
    font-weight: 700;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.card-body {
    padding: 1.25rem;
}

/* Stat Cards — White Professional */
.stat-card {
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    position: relative;
    overflow: hidden;
    min-height: 140px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    background: #fff;
    border: 1px solid var(--border-color);
}

.stat-card::before {
    content: '';
    position: absolute;
    top: -30%;
    right: -20%;
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background: rgba(var(--primary-rgb), 0.04);
}

.stat-card::after {
    content: '';
    position: absolute;
    bottom: -40%;
    right: -10%;
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: rgba(var(--primary-rgb), 0.03);
}

.stat-card .stat-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    margin-bottom: 0.75rem;
}

.stat-card .stat-value {
    font-size: 1.6rem;
    font-weight: 800;
    line-height: 1.1;
}

.stat-card .stat-label {
    font-size: 0.78rem;
    font-weight: 500;
    margin-top: 0.25rem;
}

.stat-card.bg-gradient-primary {
    background: #fff !important;
    border-left: 4px solid var(--primary) !important;
}
.stat-card.bg-gradient-primary .stat-icon {
    background: rgba(var(--primary-rgb), 0.1);
    color: var(--primary);
}
.stat-card.bg-gradient-primary .stat-value {
    color: var(--text-primary);
}
.stat-card.bg-gradient-primary .stat-label {
    color: var(--text-secondary);
}

.stat-card.bg-gradient-success {
    background: #fff !important;
    border-left: 4px solid var(--success) !important;
}
.stat-card.bg-gradient-success .stat-icon {
    background: rgba(22, 163, 74, 0.1);
    color: var(--success);
}
.stat-card.bg-gradient-success .stat-value {
    color: var(--text-primary);
}
.stat-card.bg-gradient-success .stat-label {
    color: var(--text-secondary);
}

.stat-card.bg-gradient-warning {
    background: #fff !important;
    border-left: 4px solid var(--warning) !important;
}
.stat-card.bg-gradient-warning .stat-icon {
    background: rgba(217, 119, 6, 0.1);
    color: var(--warning);
}
.stat-card.bg-gradient-warning .stat-value {
    color: var(--text-primary);
}
.stat-card.bg-gradient-warning .stat-label {
    color: var(--text-secondary);
}

.stat-card.bg-gradient-info {
    background: #fff !important;
    border-left: 4px solid var(--info) !important;
}
.stat-card.bg-gradient-info .stat-icon {
    background: rgba(2, 132, 199, 0.1);
    color: var(--info);
}
.stat-card.bg-gradient-info .stat-value {
    color: var(--text-primary);
}
.stat-card.bg-gradient-info .stat-label {
    color: var(--text-secondary);
}

.stat-card.bg-gradient-danger {
    background: #fff !important;
    border-left: 4px solid var(--danger) !important;
}
.stat-card.bg-gradient-danger .stat-icon {
    background: rgba(220, 38, 38, 0.1);
    color: var(--danger);
}
.stat-card.bg-gradient-danger .stat-value {
    color: var(--text-primary);
}
.stat-card.bg-gradient-danger .stat-label {
    color: var(--text-secondary);
}

.stat-card.bg-gradient-accent {
    background: #fff !important;
    border-left: 4px solid var(--accent) !important;
}
.stat-card.bg-gradient-accent .stat-icon {
    background: rgba(8, 145, 178, 0.1);
    color: var(--accent);
}
.stat-card.bg-gradient-accent .stat-value {
    color: var(--text-primary);
}
.stat-card.bg-gradient-accent .stat-label {
    color: var(--text-secondary);
}

/* ============================================================
   TABLES
   ============================================================ */
.table {
    font-size: 0.82rem;
    margin-bottom: 0;
}

.table thead th {
    background: var(--bg-body);
    color: var(--text-secondary);
    font-weight: 700;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 2px solid var(--border-color);
    padding: 0.75rem 1rem;
    white-space: nowrap;
}

.table tbody td {
    padding: 0.7rem 1rem;
    vertical-align: middle;
    border-bottom: 1px solid var(--border-color);
}

.table tbody tr:hover {
    background: rgba(var(--primary-rgb), 0.02);
}

.table-responsive {
    border-radius: var(--radius-md);
}

/* DataTables Override */
.dataTables_wrapper .dataTables_filter input {
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
    padding: 0.4rem 0.75rem;
    font-size: 0.82rem;
}

.dataTables_wrapper .dataTables_length select {
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
    padding: 0.3rem 0.5rem;
    font-size: 0.82rem;
}

.dataTables_info, .dataTables_length label, .dataTables_filter label {
    font-size: 0.78rem;
    color: var(--text-secondary);
}

/* ============================================================
   FORMS
   ============================================================ */
.form-control, .form-select {
    border-radius: var(--radius-sm);
    border: 1.5px solid var(--border-color);
    padding: 0.55rem 0.85rem;
    font-size: 0.85rem;
    transition: var(--transition);
    color: var(--text-primary);
}

.form-control:focus, .form-select:focus {
    border-color: var(--primary-light);
    box-shadow: 0 0 0 3px rgba(var(--primary-rgb), 0.1);
}

.form-label {
    font-weight: 600;
    font-size: 0.82rem;
    color: var(--text-primary);
    margin-bottom: 0.4rem;
}

.input-group-text {
    border-radius: var(--radius-sm);
    border: 1.5px solid var(--border-color);
    background: var(--bg-body);
    font-size: 0.85rem;
    color: var(--text-secondary);
}

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
    font-weight: 600;
    font-size: 0.82rem;
    border-radius: var(--radius-sm);
    padding: 0.5rem 1rem;
    transition: var(--transition);
    letter-spacing: 0.2px;
}

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

.btn-primary:hover {
    background: var(--primary-light);
    border-color: var(--primary-light);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(var(--primary-rgb), 0.3);
}

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

.btn-accent {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
}

.btn-accent:hover {
    background: var(--accent-dark);
    border-color: var(--accent-dark);
    color: #fff;
    transform: translateY(-1px);
}

.btn-outline-primary {
    color: var(--primary);
    border-color: var(--primary);
}

.btn-outline-primary:hover {
    background: var(--primary);
    transform: translateY(-1px);
}

.btn-sm {
    padding: 0.35rem 0.7rem;
    font-size: 0.75rem;
}

.btn-icon {
    width: 32px;
    height: 32px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
}

/* ============================================================
   BADGES
   ============================================================ */
.badge {
    font-weight: 600;
    font-size: 0.7rem;
    padding: 0.35rem 0.65rem;
    border-radius: 50px;
    letter-spacing: 0.3px;
}

/* ============================================================
   MODAL
   ============================================================ */
.modal-content {
    border: none;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
}

.modal-header {
    border-bottom: 1px solid var(--border-color);
    padding: 1.25rem 1.5rem;
}

.modal-header .modal-title {
    font-weight: 700;
    font-size: 1rem;
}

.modal-body {
    padding: 1.5rem;
}

.modal-footer {
    border-top: 1px solid var(--border-color);
    padding: 1rem 1.5rem;
}

/* ============================================================
   LOGIN PAGE
   ============================================================ */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 50%, #cbd5e1 100%);
    position: relative;
    overflow: hidden;
}

.login-page::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(ellipse at 30% 50%, rgba(37,99,235,0.06) 0%, transparent 50%),
                radial-gradient(ellipse at 70% 80%, rgba(8,145,178,0.05) 0%, transparent 50%);
    animation: loginBgFloat 15s ease-in-out infinite;
}

@keyframes loginBgFloat {
    0%, 100% { transform: translate(0, 0) rotate(0deg); }
    33% { transform: translate(2%, -2%) rotate(1deg); }
    66% { transform: translate(-1%, 1%) rotate(-0.5deg); }
}

.login-card {
    width: 100%;
    max-width: 420px;
    background: rgba(255,255,255,0.95);
    backdrop-filter: blur(20px);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xl);
    padding: 2.5rem;
    position: relative;
    z-index: 1;
    border: 1px solid rgba(255,255,255,0.3);
}

.login-logo {
    text-align: center;
    margin-bottom: 1.5rem;
}

.login-logo .logo-icon {
    width: 70px;
    height: 70px;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    border-radius: 18px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 1.8rem;
    box-shadow: 0 8px 25px rgba(var(--primary-rgb), 0.3);
    margin-bottom: 1rem;
}

.login-logo h2 {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--primary);
    margin-bottom: 0.15rem;
}

.login-logo p {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.login-card .form-control {
    background: var(--bg-body);
    border: 1.5px solid transparent;
    padding: 0.7rem 1rem 0.7rem 2.8rem;
}

.login-card .form-control:focus {
    background: #fff;
    border-color: var(--primary-light);
}

.login-card .input-icon {
    position: relative;
}

.login-card .input-icon i {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    z-index: 2;
}

.login-card .btn-login {
    width: 100%;
    padding: 0.75rem;
    font-size: 0.95rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    border: none;
    border-radius: var(--radius-sm);
    color: #fff;
    letter-spacing: 0.5px;
    transition: var(--transition);
}

.login-card .btn-login:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(var(--primary-rgb), 0.35);
}

/* ============================================================
   PUBLIC DASHBOARD
   ============================================================ */
.public-page {
    min-height: 100vh;
    background: var(--bg-body);
}

.public-header {
    background: linear-gradient(135deg, #1e293b, #334155, #475569);
    color: #fff;
    padding: 2rem 0;
    position: relative;
    overflow: hidden;
}

.public-header::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -20%;
    width: 400px;
    height: 400px;
    border-radius: 50%;
    background: rgba(0,137,123,0.1);
}

.public-header h1 {
    color: #fff;
    font-size: 1.8rem;
    font-weight: 800;
}

.public-header p {
    color: rgba(255,255,255,0.7);
    font-size: 0.9rem;
}

/* Progress Bar Custom */
.progress {
    height: 10px;
    border-radius: 50px;
    background: rgba(var(--primary-rgb), 0.08);
    overflow: hidden;
}

.progress-bar {
    border-radius: 50px;
    transition: width 1s ease-in-out;
}

/* ============================================================
   UTILITIES
   ============================================================ */
.text-rupiah {
    font-family: 'Inter', monospace;
    font-weight: 600;
}

.animate-value {
    animation: fadeInUp 0.6s ease-out both;
}

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

.hover-lift {
    transition: var(--transition);
}

.hover-lift:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
}

/* ============================================================
   TAB STYLING
   ============================================================ */
.nav-tabs {
    border-bottom: 2px solid var(--border-color);
}

.nav-tabs .nav-link {
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 0.82rem;
    border: none;
    padding: 0.7rem 1rem;
    position: relative;
    transition: var(--transition);
}

.nav-tabs .nav-link:hover {
    color: var(--primary);
    border: none;
}

.nav-tabs .nav-link.active {
    color: var(--primary);
    border: none;
    background: transparent;
}

.nav-tabs .nav-link.active::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--primary);
    border-radius: 3px 3px 0 0;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 991.98px) {
    .sidebar {
        transform: translateX(-100%);
    }
    
    .sidebar.show {
        transform: translateX(0);
    }
    
    .sidebar-overlay {
        display: none;
        position: fixed;
        top: var(--navbar-height);
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0,0,0,0.5);
        z-index: 1015;
        backdrop-filter: blur(2px);
    }
    
    .sidebar-overlay.show {
        display: block;
    }
    
    .content-area {
        margin-left: 0 !important;
        padding: 1rem;
    }
    
    .page-header h1 {
        font-size: 1.2rem;
    }
    
    .stat-card .stat-value {
        font-size: 1.2rem;
    }
    
    .login-card {
        margin: 1rem;
        padding: 2rem 1.5rem;
    }
}

@media (max-width: 575.98px) {
    .public-header h1 {
        font-size: 1.3rem;
    }
    
    .table {
        font-size: 0.75rem;
    }
    
    .table thead th,
    .table tbody td {
        padding: 0.5rem 0.6rem;
    }
}

/* ============================================================
   403 / ERROR PAGE
   ============================================================ */
.error-page {
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    min-height: 60vh;
}

.error-page .error-code {
    font-size: 5rem;
    font-weight: 900;
    color: var(--text-muted);
    line-height: 1;
    opacity: 0.3;
}

.error-page h3 {
    font-size: 1.2rem;
    margin-top: 0.5rem;
}

/* Print */
@media print {
    .sidebar, .navbar-top, .sidebar-toggle, .btn, .sidebar-overlay {
        display: none !important;
    }
    .content-area {
        margin-left: 0 !important;
        padding: 0 !important;
    }
}
