/* ========================================
   BPS BANGKA SELATAN - PREMIUM DASHBOARD
   Developed by Sixth Floor Technology
   ======================================== */

:root {
    --primary: #1e3a8a;
    --primary-light: #3b82f6;
    --primary-dark: #1e40af;
    --secondary: #0f766e;
    --accent: #d97706;
    --gold: #fbbf24;
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    
    --bg-primary: #f8fafc;
    --bg-secondary: #ffffff;
    --bg-sidebar: #0f172a;
    --bg-card: #ffffff;
    
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #94a3b8;
    --text-sidebar: #cbd5e1;
    
    --border: #e2e8f0;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.1);
    --shadow-lg: 0 10px 25px -5px rgba(0,0,0,0.1);
    --shadow-xl: 0 20px 40px -10px rgba(0,0,0,0.15);
    
    --sidebar-width: 280px;
    --navbar-height: 70px;
    --radius: 12px;
    --radius-lg: 16px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="dark"] {
    --bg-primary: #0f172a;
    --bg-secondary: #1e293b;
    --bg-sidebar: #020617;
    --bg-card: #1e293b;
    --text-primary: #f1f5f9;
    --text-secondary: #cbd5e1;
    --text-muted: #64748b;
    --border: #334155;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: 'Inter', sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    overflow-x: hidden;
    transition: var(--transition);
}

h1, h2, h3, h4 { font-family: 'Playfair Display', serif; font-weight: 700; }

/* ========================================
   TOP NAVBAR
   ======================================== */
.top-navbar {
    position: fixed;
    top: 0; left: 0; right: 0;
    height: var(--navbar-height);
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    z-index: 1000;
    backdrop-filter: blur(10px);
    box-shadow: var(--shadow-sm);
}

.navbar-left { display: flex; align-items: center; gap: 20px; }

.toggle-sidebar {
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-size: 20px;
    cursor: pointer;
    padding: 8px 12px;
    border-radius: 8px;
    transition: var(--transition);
}
.toggle-sidebar:hover { background: var(--bg-primary); }

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 700;
    font-size: 18px;
    color: var(--primary);
}
.brand i {
    font-size: 24px;
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    color: white;
    padding: 8px;
    border-radius: 10px;
}

.navbar-center { flex: 1; max-width: 500px; margin: 0 40px; }

.search-box { position: relative; width: 100%; }
.search-box i {
    position: absolute;
    left: 16px; top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
}
.search-box input {
    width: 100%;
    padding: 12px 16px 12px 44px;
    border: 1px solid var(--border);
    border-radius: 30px;
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 14px;
    transition: var(--transition);
}
.search-box input:focus {
    outline: none;
    border-color: var(--primary-light);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.navbar-right { display: flex; align-items: center; gap: 16px; }

.theme-toggle, .notif-btn {
    background: var(--bg-primary);
    border: 1px solid var(--border);
    width: 40px; height: 40px;
    border-radius: 10px;
    cursor: pointer;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    transition: var(--transition);
}
.theme-toggle:hover, .notif-btn:hover {
    background: var(--primary);
    color: white;
    transform: translateY(-2px);
}

.notif-badge {
    position: absolute;
    top: -4px; right: -4px;
    background: var(--danger);
    color: white;
    font-size: 10px;
    width: 18px; height: 18px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 12px;
    background: var(--bg-primary);
    border-radius: 30px;
    cursor: pointer;
    border: 1px solid var(--border);
    transition: var(--transition);
}
.user-profile:hover { border-color: var(--primary-light); }
.user-profile img { width: 36px; height: 36px; border-radius: 50%; }
.user-info { display: flex; flex-direction: column; line-height: 1.2; }
.user-name { font-weight: 600; font-size: 13px; }
.user-role { font-size: 11px; color: var(--text-muted); }

/* ========================================
   MAIN CONTAINER
   ======================================== */
.main-container {
    display: flex;
    margin-top: var(--navbar-height);
    min-height: calc(100vh - var(--navbar-height));
}

/* ========================================
   SIDEBAR
   ======================================== */
.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-sidebar);
    color: var(--text-sidebar);
    position: fixed;
    left: 0;
    top: var(--navbar-height);
    bottom: 0;
    overflow-y: auto;
    transition: var(--transition);
    z-index: 100;
    box-shadow: 2px 0 10px rgba(0,0,0,0.1);
}
.sidebar.collapsed { transform: translateX(-100%); }
.sidebar::-webkit-scrollbar { width: 6px; }
.sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 3px; }

.sidebar-header {
    padding: 30px 24px;
    border-bottom: 1px solid rgba(255,255,255,0.05);
    display: flex;
    align-items: center;
    gap: 14px;
}
.logo-circle {
    width: 50px; height: 50px;
    background: linear-gradient(135deg, var(--primary-light), var(--primary));
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    color: white;
    box-shadow: 0 8px 20px rgba(59, 130, 246, 0.3);
}
.logo-text h2 { font-size: 16px; color: white; letter-spacing: 1px; }
.logo-text p { font-size: 11px; color: var(--text-muted); margin-top: 2px; }

.sidebar-menu { padding: 20px 16px; }
.menu-category { margin-bottom: 24px; }
.category-title {
    display: block;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 1.5px;
    color: var(--text-muted);
    padding: 0 12px;
    margin-bottom: 10px;
    text-transform: uppercase;
}
.menu-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 14px;
    color: var(--text-sidebar);
    text-decoration: none;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 500;
    transition: var(--transition);
    margin-bottom: 2px;
    position: relative;
}
.menu-item i { width: 20px; font-size: 16px; text-align: center; }
.menu-item:hover {
    background: rgba(255,255,255,0.05);
    color: white;
    transform: translateX(4px);
}
.menu-item.active {
    background: linear-gradient(135deg, var(--primary-light), var(--primary));
    color: white;
    box-shadow: 0 4px 15px rgba(59, 130, 246, 0.3);
}
.menu-item.active::before {
    content: '';
    position: absolute;
    left: -16px;
    top: 50%;
    transform: translateY(-50%);
    width: 4px; height: 24px;
    background: var(--gold);
    border-radius: 0 4px 4px 0;
}

.sidebar-footer { padding: 20px 24px; border-top: 1px solid rgba(255,255,255,0.05); }
.data-source { display: flex; align-items: center; gap: 10px; font-size: 12px; color: var(--text-muted); }

/* ========================================
   MAIN CONTENT
   ======================================== */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    padding: 30px;
    transition: var(--transition);
    min-width: 0;
}
.sidebar.collapsed ~ .main-content { margin-left: 0; }

/* ========================================
   HERO SECTION
   ======================================== */
.hero-section {
    background: linear-gradient(135deg, #1e3a8a 0%, #3b82f6 50%, #0f766e 100%);
    border-radius: var(--radius-lg);
    padding: 40px;
    color: white;
    margin-bottom: 30px;
    position: relative;
    overflow: hidden;
    box-shadow: var(--shadow-xl);
}
.hero-section::before {
    content: '';
    position: absolute;
    top: -50%; right: -20%;
    width: 500px; height: 500px;
    background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 70%);
    border-radius: 50%;
}
.hero-section::after {
    content: '';
    position: absolute;
    bottom: -30%; left: -10%;
    width: 400px; height: 400px;
    background: radial-gradient(circle, rgba(251,191,36,0.15) 0%, transparent 70%);
    border-radius: 50%;
}
.hero-content { position: relative; z-index: 2; margin-bottom: 30px; }
.hero-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: rgba(255,255,255,0.15);
    backdrop-filter: blur(10px);
    padding: 8px 16px;
    border-radius: 30px;
    font-size: 12px;
    font-weight: 600;
    margin-bottom: 16px;
    border: 1px solid rgba(255,255,255,0.2);
}
.hero-badge i { color: var(--gold); }
.hero-content h1 { font-size: 42px; line-height: 1.2; margin-bottom: 12px; }
.hero-content h1 span { display: block; font-style: italic; color: var(--gold); font-weight: 400; }
.hero-content p { font-size: 16px; opacity: 0.9; max-width: 600px; }

.hero-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    position: relative;
    z-index: 2;
}
.stat-card {
    background: rgba(255,255,255,0.1);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: var(--radius);
    padding: 20px;
    transition: var(--transition);
}
.stat-card:hover { transform: translateY(-4px); background: rgba(255,255,255,0.15); }
.stat-icon {
    width: 44px; height: 44px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    margin-bottom: 12px;
}
.stat-icon.blue { background: rgba(59,130,246,0.3); }
.stat-icon.green { background: rgba(16,185,129,0.3); }
.stat-icon.purple { background: rgba(168,85,247,0.3); }
.stat-icon.orange { background: rgba(251,191,36,0.3); }
.stat-icon.red { background: rgba(239,68,68,0.3); }
.stat-icon.cyan { background: rgba(6,182,212,0.3); }
.stat-icon.pink { background: rgba(236,72,153,0.3); }

.stat-value { font-family: 'Playfair Display', serif; font-size: 28px; font-weight: 700; margin-bottom: 4px; }
.stat-label { font-size: 12px; opacity: 0.8; margin-bottom: 8px; }
.stat-trend {
    font-size: 11px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: 20px;
    background: rgba(16,185,129,0.2);
}
.stat-trend.down { background: rgba(239,68,68,0.2); }

/* ========================================
   STAT CARDS PREMIUM (untuk halaman sektor)
   ======================================== */
.stats-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}
.stat-card-premium {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 16px;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}
.stat-card-premium::before {
    content: '';
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 4px;
    background: linear-gradient(90deg, var(--primary), var(--primary-light));
}
.stat-card-premium:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); }
.stat-card-premium .stat-icon {
    width: 56px; height: 56px;
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    color: white;
    font-size: 24px;
    flex-shrink: 0;
}
.stat-card-premium .stat-info { flex: 1; }
.stat-card-premium .stat-label { font-size: 12px; color: var(--text-muted); margin-bottom: 4px; }
.stat-card-premium .stat-info h3 {
    font-family: 'Playfair Display', serif;
    font-size: 26px;
    color: var(--text-primary);
    margin-bottom: 2px;
}
.stat-card-premium .stat-sub { font-size: 11px; color: var(--text-muted); }

/* ========================================
   CHARTS GRID
   ======================================== */
.charts-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 20px;
    margin-bottom: 30px;
}
.chart-card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border);
    transition: var(--transition);
}
.chart-card:hover { box-shadow: var(--shadow-lg); }
.chart-card.wide { grid-column: 1 / 2; }
.card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 20px;
}
.card-header h3 { font-size: 18px; color: var(--text-primary); margin-bottom: 4px; }
.card-header p { font-size: 13px; color: var(--text-muted); }
.filter-select {
    padding: 8px 14px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 13px;
    cursor: pointer;
}

/* ========================================
   DATA SECTION & TABLES
   ======================================== */
.data-section { margin-bottom: 30px; }
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}
.section-header h2 { font-size: 24px; display: flex; align-items: center; gap: 12px; }
.section-header h2 i { color: var(--primary); }
.section-actions { display: flex; gap: 10px; }

.btn {
    padding: 10px 18px;
    border: none;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: var(--transition);
    text-decoration: none;
}
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-dark); transform: translateY(-2px); box-shadow: 0 6px 15px rgba(30,58,138,0.3); }
.btn-outline { background: transparent; color: var(--text-primary); border: 1px solid var(--border); }
.btn-outline:hover { background: var(--bg-primary); }
.btn-danger { background: var(--danger); color: white; }
.btn-danger:hover { background: #dc2626; transform: translateY(-2px); }
.btn-success { background: var(--success); color: white; }
.btn-success:hover { background: #059669; transform: translateY(-2px); }
.btn-icon {
    padding: 6px 12px;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--primary);
    font-size: 12px;
    font-weight: 600;
    text-decoration: none;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.btn-icon:hover { background: var(--primary); color: white; }

.table-card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border);
}
.table-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.table-header h3 { font-size: 18px; }
.table-badge {
    background: var(--primary);
    color: white;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}
.table-wrapper { overflow-x: auto; }

.data-table { width: 100%; border-collapse: collapse; }
.data-table th {
    background: var(--bg-primary);
    padding: 14px 20px;
    text-align: left;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
    border-bottom: 2px solid var(--border);
}
.data-table td {
    padding: 14px 20px;
    font-size: 14px;
    border-bottom: 1px solid var(--border);
}
.data-table tbody tr { transition: var(--transition); }
.data-table tbody tr:hover { background: var(--bg-primary); }
.data-table tfoot th {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    padding: 16px 20px;
    font-size: 13px;
}

/* Badges */
.badge-success {
    background: rgba(16,185,129,0.1);
    color: var(--success);
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}
.badge-warning {
    background: rgba(245,158,11,0.1);
    color: var(--warning);
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}
.badge-info {
    background: rgba(59,130,246,0.1);
    color: var(--primary-light);
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    display: inline-block;
}
.badge-danger {
    background: rgba(239,68,68,0.1);
    color: var(--danger);
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

/* ========================================
   INFO GRID (untuk dashboard cards)
   ======================================== */
.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}
.info-card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border);
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}
.info-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 4px;
    background: linear-gradient(90deg, var(--primary), var(--primary-light));
}
.info-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); }
.info-icon {
    width: 50px; height: 50px;
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 22px;
    margin-bottom: 16px;
}
.info-card h4 {
    font-family: 'Inter', sans-serif;
    font-size: 14px;
    color: var(--text-muted);
    font-weight: 500;
    margin-bottom: 8px;
}
.info-value {
    font-family: 'Playfair Display', serif;
    font-size: 32px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 4px;
}
.info-desc { font-size: 12px; color: var(--text-muted); margin-bottom: 16px; }
.progress-bar { height: 6px; background: var(--bg-primary); border-radius: 3px; overflow: hidden; }
.progress {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--primary-light));
    border-radius: 3px;
    transition: width 1s ease;
}

/* ========================================
   PAGE HEADER (untuk halaman sektor)
   ======================================== */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 2px solid var(--border);
}
.header-content { flex: 1; }
.breadcrumb {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 10px;
}
.breadcrumb a { color: var(--primary); text-decoration: none; }
.breadcrumb a:hover { text-decoration: underline; }
.header-content h1 {
    font-size: 32px;
    color: var(--text-primary);
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 12px;
}
.header-content h1 i { color: var(--primary); }
.header-content p { color: var(--text-secondary); font-size: 14px; }
.header-actions { display: flex; gap: 10px; }

/* ========================================
   INFO GRID KECAMATAN (untuk detail)
   ======================================== */
.info-grid-kecamatan {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 30px;
}
.info-grid-kecamatan .info-card {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 20px;
}
.info-grid-kecamatan .info-card > i {
    width: 50px; height: 50px;
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    color: white;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    flex-shrink: 0;
}
.info-grid-kecamatan .info-card > div span {
    font-size: 12px;
    color: var(--text-muted);
    display: block;
    margin-bottom: 4px;
}
.info-grid-kecamatan .info-card > div h4 {
    font-family: 'Playfair Display', serif;
    font-size: 20px;
    color: var(--text-primary);
    margin: 0;
}

/* ========================================
   FOOTER
   ======================================== */
.main-footer {
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
    color: white;
    margin-left: var(--sidebar-width);
    padding: 40px 30px 20px;
    transition: var(--transition);
}
.sidebar.collapsed ~ .main-content ~ .main-footer { margin-left: 0; }
.footer-content {
    display: grid;
    grid-template-columns: 1fr 2fr 1fr;
    gap: 40px;
    margin-bottom: 30px;
    padding-bottom: 30px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}
.footer-brand { display: flex; align-items: center; gap: 14px; }
.footer-brand i { font-size: 32px; color: var(--gold); }
.footer-brand h4 { font-size: 16px; margin-bottom: 4px; }
.footer-brand p { font-size: 12px; opacity: 0.7; }
.footer-center { text-align: center; }
.footer-center p { font-size: 13px; opacity: 0.8; margin-bottom: 4px; }
.footer-right { text-align: right; }
.developed-by { font-size: 11px; opacity: 0.6; text-transform: uppercase; letter-spacing: 2px; margin-bottom: 6px; }
.company-name {
    font-family: 'Playfair Display', serif;
    font-size: 20px;
    font-weight: 700;
    color: var(--gold);
    margin-bottom: 16px;
}
.company-name i { margin-right: 8px; }
.social-links { display: flex; gap: 10px; justify-content: flex-end; }
.social-links a {
    width: 36px; height: 36px;
    background: rgba(255,255,255,0.1);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    text-decoration: none;
    transition: var(--transition);
}
.social-links a:hover { background: var(--primary-light); transform: translateY(-3px); }
.footer-bottom { text-align: center; font-size: 12px; opacity: 0.6; }

/* ========================================
   RESPONSIVE
   ======================================== */
@media (max-width: 1024px) {
    .charts-grid { grid-template-columns: 1fr; }
    .footer-content { grid-template-columns: 1fr; text-align: center; }
    .footer-right { text-align: center; }
    .social-links { justify-content: center; }
}
@media (max-width: 768px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.active { transform: translateX(0); }
    .main-content, .main-footer { margin-left: 0; }
    .navbar-center { display: none; }
    .hero-content h1 { font-size: 28px; }
    .user-info { display: none; }
    .page-header { flex-direction: column; gap: 16px; }
}
/* ========================================
   MOBILE RESPONSIVE FIX
   ======================================== */

/* ---------- TABLET (max 1024px) ---------- */
@media (max-width: 1024px) {
    .charts-grid {
        grid-template-columns: 1fr;
    }
    
    .charts-grid .chart-card.wide {
        grid-column: 1;
    }
    
    .hero-stats {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .footer-content {
        grid-template-columns: 1fr;
        text-align: center;
        gap: 24px;
    }
    
    .footer-right { text-align: center; }
    .social-links { justify-content: center; }
    
    .stats-row {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .info-grid-kecamatan {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .highlight-stats {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .ranking-grid {
        grid-template-columns: 1fr;
    }
    
    .page-header {
        flex-direction: column;
        gap: 16px;
    }
    
    .header-actions {
        width: 100%;
    }
    
    .header-actions .btn {
        flex: 1;
        justify-content: center;
    }
}

/* ---------- MOBILE (max 768px) ---------- */
@media (max-width: 768px) {
    
    /* === SIDEBAR: Hidden by default, overlay mode === */
    .sidebar {
        transform: translateX(-100%);
        width: 280px;
        z-index: 2000;
        box-shadow: 4px 0 20px rgba(0,0,0,0.3);
    }
    
    .sidebar.active {
        transform: translateX(0);
    }
    
    .sidebar.collapsed {
        transform: translateX(-100%);
    }
    
    /* === SIDEBAR OVERLAY === */
    .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: 1999;
        backdrop-filter: blur(4px);
    }
    
    .sidebar-overlay.active {
        display: block;
    }
    
    /* === MAIN CONTENT: Full width === */
    .main-content {
        margin-left: 0 !important;
        padding: 16px;
    }
    
    .main-footer {
        margin-left: 0 !important;
        padding: 24px 16px 16px;
    }
    
    /* === NAVBAR === */
    .top-navbar {
        padding: 0 12px;
        height: 60px;
    }
    
    .navbar-center {
        display: none;
    }
    
    .brand span {
        font-size: 15px;
    }
    
    .brand i {
        font-size: 20px;
        padding: 6px;
    }
    
    .user-info {
        display: none;
    }
    
    .user-profile {
        padding: 4px;
        border-radius: 50%;
    }
    
    .user-profile img {
        width: 32px;
        height: 32px;
    }
    
    .user-profile .fa-chevron-down {
        display: none;
    }
    
    .theme-toggle, .notif-btn {
        width: 36px;
        height: 36px;
        font-size: 14px;
    }
    
    /* === HERO SECTION === */
    .hero-section {
        padding: 24px 16px;
        margin-bottom: 20px;
        border-radius: var(--radius);
    }
    
    .hero-content h1 {
        font-size: 26px;
    }
    
    .hero-content h1 span {
        font-size: 22px;
    }
    
    .hero-content p {
        font-size: 13px;
    }
    
    .hero-stats {
        grid-template-columns: 1fr 1fr;
        gap: 10px;
    }
    
    .stat-card {
        padding: 14px;
    }
    
    .stat-icon {
        width: 36px;
        height: 36px;
        font-size: 16px;
        margin-bottom: 8px;
    }
    
    .stat-value {
        font-size: 20px;
    }
    
    .stat-label {
        font-size: 10px;
    }
    
    .stat-trend {
        font-size: 9px;
        padding: 3px 8px;
    }
    
    /* === STAT CARDS PREMIUM === */
    .stats-row {
        grid-template-columns: 1fr 1fr;
        gap: 12px;
    }
    
    .stat-card-premium {
        padding: 16px;
        flex-direction: column;
        text-align: center;
        gap: 10px;
    }
    
    .stat-card-premium .stat-icon {
        width: 44px;
        height: 44px;
        font-size: 20px;
    }
    
    .stat-card-premium .stat-info h3 {
        font-size: 20px;
    }
    
    /* === CHART CARDS === */
    .chart-card {
        padding: 16px;
        border-radius: var(--radius);
    }
    
    .card-header {
        flex-direction: column;
        gap: 10px;
    }
    
    .card-header h3 {
        font-size: 16px;
    }
    
    .filter-select {
        width: 100%;
    }
    
    /* === TABLES: Horizontal scroll === */
    .table-wrapper {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .data-table {
        min-width: 700px;
    }
    
    .data-table th,
    .data-table td {
        padding: 10px 14px;
        font-size: 12px;
        white-space: nowrap;
    }
    
    .data-table th {
        font-size: 10px;
        position: sticky;
        top: 0;
        z-index: 10;
    }
    
    /* Scroll indicator untuk tabel */
    .table-wrapper::after {
        content: '← Geser →';
        display: block;
        text-align: center;
        font-size: 11px;
        color: var(--text-muted);
        padding: 8px;
        background: var(--bg-primary);
    }
    
    /* === INFO GRID === */
    .info-grid {
        grid-template-columns: 1fr 1fr;
        gap: 12px;
    }
    
    .info-card {
        padding: 16px;
    }
    
    .info-icon {
        width: 40px;
        height: 40px;
        font-size: 18px;
        margin-bottom: 12px;
    }
    
    .info-value {
        font-size: 24px;
    }
    
    .info-grid-kecamatan {
        grid-template-columns: 1fr;
    }
    
    /* === SECTION HEADER === */
    .section-header {
        flex-direction: column;
        gap: 12px;
        align-items: flex-start;
    }
    
    .section-header h2 {
        font-size: 20px;
    }
    
    .section-actions {
        width: 100%;
    }
    
    .section-actions .btn {
        flex: 1;
        justify-content: center;
        font-size: 12px;
        padding: 8px 12px;
    }
    
    /* === PAGE HEADER === */
    .page-header {
        flex-direction: column;
        gap: 16px;
        margin-bottom: 20px;
        padding-bottom: 16px;
    }
    
    .header-content h1 {
        font-size: 22px;
    }
    
    .header-actions {
        width: 100%;
        flex-direction: column;
    }
    
    .header-actions .btn {
        width: 100%;
        justify-content: center;
    }
    
    /* === HIGHLIGHT CARD === */
    .highlight-card {
        padding: 20px 16px;
        border-radius: var(--radius);
    }
    
    .highlight-header {
        flex-direction: column;
        text-align: center;
        gap: 12px;
    }
    
    .highlight-header h2 {
        font-size: 20px;
    }
    
    .highlight-stats {
        grid-template-columns: 1fr 1fr;
        gap: 10px;
    }
    
    .highlight-item {
        padding: 12px;
    }
    
    .highlight-item h3 {
        font-size: 18px;
    }
    
    /* === FOOTER === */
    .footer-content {
        grid-template-columns: 1fr;
        text-align: center;
        gap: 20px;
    }
    
    .footer-brand {
        justify-content: center;
    }
    
    .footer-right {
        text-align: center;
    }
    
    .company-name {
        font-size: 16px;
    }
    
    .social-links {
        justify-content: center;
    }
    
    /* === BREADCRUMB === */
    .breadcrumb {
        flex-wrap: wrap;
        font-size: 11px;
    }
    
    /* === PROGRESS WRAPPER === */
    .progress-wrapper {
        min-width: 120px;
    }
}

/* ---------- SMALL MOBILE (max 480px) ---------- */
@media (max-width: 480px) {
    
    .hero-stats {
        grid-template-columns: 1fr;
    }
    
    .stats-row {
        grid-template-columns: 1fr;
    }
    
    .info-grid {
        grid-template-columns: 1fr;
    }
    
    .highlight-stats {
        grid-template-columns: 1fr;
    }
    
    .hero-content h1 {
        font-size: 22px;
    }
    
    .stat-card-premium {
        flex-direction: row;
        text-align: left;
    }
    
    .navbar-right {
        gap: 8px;
    }
    
    .notif-btn {
        display: none;
    }
}

/* ---------- iOS FIX ---------- */
@supports (-webkit-touch-callout: none) {
    .main-content {
        padding-bottom: 100px;
    }
    
    .sidebar {
        height: -webkit-fill-available;
    }
}

/* ---------- DARK MODE CHART FIX ---------- */
[data-theme="dark"] canvas {
    filter: none;
}

/* ---------- PRINT ---------- */
@media print {
    .sidebar, .top-navbar, .main-footer,
    .section-actions, .header-actions,
    .toggle-sidebar, .theme-toggle {
        display: none !important;
    }
    
    .main-content {
        margin-left: 0 !important;
        padding: 0;
    }
    
    .chart-card, .table-card, .info-card {
        break-inside: avoid;
        box-shadow: none;
        border: 1px solid #ccc;
    }
}