:root {
    --primary-blue: #1e40af;
    --secondary-blue: #3b82f6;
    --light-blue: #dbeafe;
    --dark-blue: #1e3a8a;
    --accent-gold: #f59e0b;
    --success-green: #10b981;
    --warning-orange: #f97316;
    --danger-red: #ef4444;
    --neutral-gray: #6b7280;
    --light-gray: #f3f4f6;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
}

/* Header Styles */
.main-header {
    background: linear-gradient(135deg, var(--primary-blue) 0%, var(--dark-blue) 100%);
    box-shadow: 0 10px 30px rgba(30, 64, 175, 0.3);
    position: relative;
    overflow: hidden;
}

.main-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 20"><defs><pattern id="grid" width="10" height="10" patternUnits="userSpaceOnUse"><path d="M 10 0 L 0 0 0 10" fill="none" stroke="rgba(255,255,255,0.05)" stroke-width="1"/></pattern></defs><rect width="100" height="20" fill="url(%23grid)"/></svg>') repeat;
    pointer-events: none;
}

.header-content {
    position: relative;
    z-index: 2;
}

.logo-container {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    padding: 0.6rem; /* was 1rem */
    border-radius: 14px; /* smaller radius */
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.system-title {
    color: white;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

/* NEW: Compact main header overrides */
.main-header .container {
    padding-top: 0.75rem !important;   /* was py-8 via Tailwind */
    padding-bottom: 0.75rem !important;
    padding-left: 1rem !important;     /* reduce px */
    padding-right: 1rem !important;
}
.main-header .report-logo {           /* shrink only in top header */
    width: 60px;
    height: 70px;
}
.main-header .system-title {
    font-size: 1.1rem !important;     /* shrink H1/H2 */
    line-height: 1.2 !important;
    margin-bottom: 0.15rem !important;
}
.main-header .system-title + .system-title {
    font-size: 1rem !important;
}
.main-header p {
    font-size: 0.85rem !important;
    margin-top: 0.2rem !important;
}
.main-header .header-content .flex.items-center {
    gap: 0.75rem !important;          /* was gap-6 */
}
.main-header .header-content .flex.items-center.justify-between {
    gap: 0.75rem !important;
}
/* END compact header overrides */

/* Navigation Cards */
.nav-card {
    background: white;
    border-radius: 16px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    border: 1px solid rgba(59, 130, 246, 0.1);
}

.nav-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(59, 130, 246, 0.2);
    border-color: var(--secondary-blue);
}

.nav-icon {
    background: linear-gradient(135deg, var(--secondary-blue), var(--primary-blue));
    color: white;
    width: 60px;
    height: 60px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    margin-bottom: 1rem;
    box-shadow: 0 4px 15px rgba(59, 130, 246, 0.3);
}

/* Filter Form Base Styles */
.filter-form {
    background: white;
    border-radius: 20px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(59, 130, 246, 0.1);
}

/* Filter Form Desktop Font Size - match header paragraph size */
@media (min-width: 769px) {
    .filter-form h2 {
        font-size: 0.85rem !important; /* Match header paragraph */
    }
    .filter-form p {
        font-size: 0.85rem !important; /* Match header paragraph */
    }
    .filter-form .form-label {
        font-size: 0.85rem !important; /* Match header paragraph */
    }
    .filter-form .form-control {
        font-size: 0.85rem !important; /* Match header paragraph */
        padding: 0.6rem 0.9rem !important; /* Balanced padding */
    }
    .filter-form .btn-primary,
    .filter-form .btn-secondary {
        font-size: 0.85rem !important; /* Match header paragraph */
        padding: 0.6rem 1rem !important; /* Balanced padding */
    }
}

.form-group {
    position: relative;
}

.form-label {
    color: var(--neutral-gray);
    font-weight: 600;
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
    display: block;
}

.form-control {
    width: 100%;
    padding: 0.875rem 1rem;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    font-size: 0.95rem;
    transition: all 0.3s ease;
    background: #fafafa;
}

.form-control:focus {
    outline: none;
    border-color: var(--secondary-blue);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
    background: white;
}

.btn-primary {
    background: linear-gradient(135deg, var(--secondary-blue), var(--primary-blue));
    color: white;
    padding: 0.875rem 2rem;
    border-radius: 12px;
    font-weight: 600;
    font-size: 0.95rem;
    transition: all 0.3s ease;
    border: none;
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
    text-align: center;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(59, 130, 246, 0.4);
    color: white;
    text-decoration: none;
}

.btn-secondary {
    background: linear-gradient(135deg, var(--neutral-gray), #4b5563);
    color: white;
    padding: 0.875rem 2rem;
    border-radius: 12px;
    font-weight: 600;
    font-size: 0.95rem;
    transition: all 0.3s ease;
    border: none;
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
    text-align: center;
}

.btn-secondary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(107, 114, 128, 0.4);
    color: white;
    text-decoration: none;
}

/* Stats Cards */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
    margin: 2rem 0;
}

.stat-card {
    background: white;
    border-radius: 16px;
    padding: 2rem;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    border-left: 4px solid var(--secondary-blue);
    transition: all 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

.stat-icon {
    background: linear-gradient(135deg, var(--light-blue), #bfdbfe);
    color: var(--primary-blue);
    width: 50px;
    height: 50px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    margin-bottom: 1rem;
}

/* Compact Quick Stats overrides - Ultra compact version */
.stats-grid {
    gap: 0.4rem;              /* Ultra compact gap */
    margin: 0.5rem 0;         /* Ultra compact margin */
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
}
.stat-card {
    padding: 0.6rem;          /* Ultra compact padding */
    border-left-width: 2px;   /* Thinner border */
    border-radius: 8px;       /* Smaller radius */
}
.stat-card .stat-icon {
    width: 32px;              /* Ultra compact icon */
    height: 32px;
    font-size: 0.8rem;        /* Smaller icon */
    margin-bottom: 0.3rem;    /* Ultra compact margin */
    border-radius: 8px;
}
.stat-card h3 {
    margin-bottom: 0.15rem;   /* Ultra compact title margin */
}
/* Ultra compact text sizes */
.stat-card .text-3xl { font-size: 1.2rem !important; }  /* Smaller numbers */
.stat-card .text-lg  { font-size: 0.8rem !important; }  /* Smaller title */
.stat-card .text-sm  { font-size: 0.7rem !important; }  /* Smaller description */

/* Report Header */
.report-header {
    background: white;
    border-radius: 20px 20px 0 0;
    padding: 2rem;
    border-bottom: 3px solid var(--secondary-blue);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    position: relative;
    overflow: hidden;
}

.report-header::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 100px;
    height: 100px;
    background: linear-gradient(135deg, var(--light-blue), transparent);
    border-radius: 50%;
    transform: translate(30px, -30px);
}
/* bagian logo header gumas*/
.report-logo {
    width: 85px;
    height: 100px;
}

.report-title {
    color: var(--primary-blue);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.report-subtitle {
    color: var(--neutral-gray);
    font-style: italic;
    margin: 0.5rem 0;
}

/* Table Styles */
.table-container {
    background: white;
    border-radius: 0 0 20px 20px;
    overflow: hidden;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
    position: relative;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th {
    background: linear-gradient(135deg, var(--primary-blue), var(--dark-blue));
    color: white;
    padding: 1rem;
    text-align: center;
    font-weight: 600;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.data-table td {
    padding: 0.875rem;
    text-align: center;
    border: 1px solid #e5e7eb;
    font-size: 0.9rem;
}

.data-table tbody tr:nth-child(even) {
    background: #f8fafc;
}
/* RATA KIRI khusus kolom KODE dan WILAYAH pada body */
.data-table tbody td:nth-child(1),
.data-table tbody td:nth-child(2) {
    text-align: left;
    padding-left: 1rem;
    font-weight: 600;
}

.data-table tbody tr:hover {
    background: var(--light-blue);
    transform: scale(1.01);
    transition: all 0.3s ease;
}

/* Administrative Level Color Coding */
.data-table tbody tr.level-kabupaten {
    background: linear-gradient(135deg, #fef3c7, #fde68a) !important;
    border-left: 4px solid #f59e0b;
    font-weight: 700;
}

.data-table tbody tr.level-kecamatan {
    background: linear-gradient(135deg, #dbeafe, #bfdbfe) !important;
    border-left: 4px solid #3b82f6;
    font-weight: 600;
}

.data-table tbody tr.level-desa {
    background: #ffffff;
    border-left: 2px solid #e5e7eb;
    font-weight: 400;
}

.data-table tbody tr.level-kabupaten:hover {
    background: linear-gradient(135deg, #fde68a, #fcd34d) !important;
    transform: scale(1.01);
}

.data-table tbody tr.level-kecamatan:hover {
    background: linear-gradient(135deg, #bfdbfe, #93c5fd) !important;
    transform: scale(1.01);
}

.data-table tbody tr.level-desa:hover {
    background: #f8fafc !important;
    transform: scale(1.01);
}

/* Legend Styles */
.legend-container {
    background: white;
    border-radius: 16px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    margin: 1rem 0;
    padding: 1.5rem;
    border: 1px solid rgba(59, 130, 246, 0.1);
}

.legend-header {
    display: flex;
    align-items: center;
    font-weight: 600;
    color: var(--primary-blue);
    margin-bottom: 1rem;
    font-size: 0.95rem;
}

.legend-items {
    display: flex;
    gap: 1.5rem;
    flex-wrap: wrap;
    justify-content: center;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 500;
}

.legend-item.level-kabupaten {
    background: linear-gradient(135deg, #fef3c7, #fde68a);
    border-left: 4px solid #f59e0b;
}

.legend-item.level-kecamatan {
    background: linear-gradient(135deg, #dbeafe, #bfdbfe);
    border-left: 4px solid #3b82f6;
}

.legend-item.level-desa {
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-left: 2px solid #e5e7eb;
}

.legend-color {
    width: 20px;
    height: 20px;
    border-radius: 4px;
    border: 1px solid rgba(0, 0, 0, 0.1);
}

.legend-item.level-kabupaten .legend-color {
    background: linear-gradient(135deg, #f59e0b, #d97706);
}

.legend-item.level-kecamatan .legend-color {
    background: linear-gradient(135deg, #3b82f6, #2563eb);
}

.legend-item.level-desa .legend-color {
    background: linear-gradient(135deg, #f8fafc, #e2e8f0);
}

/* Table Container Base Styles */
#tableContainer {
    overflow-x: auto;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    scroll-behavior: smooth;
    position: relative;
    width: 100%;
}
.table-info {
    background: #e0f2fe;
    border: 1px solid #0284c7;
    border-radius: 8px;
    padding: 0.75rem;
    margin: 1rem 0;
    display: block; /* Show on all devices */
    font-size: 0.85rem;
    color: #0f172a;
}

.table-wrapper {
    position: relative;
    overflow: visible; /* Allow child elements to handle scrolling */
    -webkit-overflow-scrolling: touch;
    border-radius: 16px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

/* Mobile-specific table adjustments - Enhanced touch scrolling */

/* Mobile scroll indicators */
.scroll-indicator {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(30, 64, 175, 0.8);
    color: white;
    padding: 0.5rem;
    border-radius: 50%;
    font-size: 0.8rem;
    z-index: 10;
    animation: pulse 2s infinite;
    display: none;
}

.scroll-indicator.left {
    left: 10px;
}

.scroll-indicator.right {
    right: 10px;
}

@keyframes pulse {
    0%, 100% { opacity: 0.7; }
    50% { opacity: 1; }
}

/* Action Buttons */
.action-buttons {
    background: white;
    padding: 1.5rem;
    border-radius: 16px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    margin: 1.5rem 0;
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    justify-content: center;
}

.btn-download {
    background: linear-gradient(135deg, var(--success-green), #059669);
    color: white;
    padding: 0.875rem 1.5rem;
    border-radius: 12px;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.9rem;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-download.pdf {
    background: linear-gradient(135deg, var(--danger-red), #dc2626);
}

.btn-download:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(16, 185, 129, 0.4);
    color: white;
    text-decoration: none;
}

.btn-download.pdf:hover {
    box-shadow: 0 8px 25px rgba(239, 68, 68, 0.4);
}

/* Scroll Controls */
.scroll-controls {
    background: white;
    padding: 1rem;
    border-radius: 16px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    margin: 1rem 0;
    /* Hidden by default; JS will toggle to 'flex' on desktop when needed */
    display: none;
    flex-direction: column;
    gap: 1rem;
    justify-content: center;
    align-items: center;
}

.horizontal-scroll-controls,
.vertical-scroll-controls {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1rem;
}

.vertical-scroll-controls {
    flex-direction: column;
    gap: 0.5rem;
    display: none; /* Hide vertical controls on all devices - use natural touch scrolling */
}

/* Desktop and Mobile Scroll Controls Visibility */
@media (min-width: 769px) {
    /* Desktop: Let JS decide visibility based on overflow */
    .mobile-scroll-info {
        display: none !important;
    }
}

.scroll-btn {
    background: linear-gradient(135deg, var(--secondary-blue), var(--primary-blue));
    color: white;
    border: none;
    padding: 0.75rem;
    border-radius: 12px;
    cursor: pointer;
    font-size: 1.2rem;
    font-weight: bold;
    transition: all 0.3s ease;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.scroll-btn.vertical {
    background: linear-gradient(135deg, var(--success-green), #059669);
}

.scroll-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(59, 130, 246, 0.4);
}

.scroll-btn.vertical:hover:not(:disabled) {
    box-shadow: 0 8px 25px rgba(16, 185, 129, 0.4);
}

.scroll-btn:disabled {
    background: #d1d5db;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.scroll-info {
    color: var(--neutral-gray);
    font-size: 0.9rem;
    font-style: italic;
    text-align: center;
}

.scroll-info.vertical {
    font-size: 0.8rem;
    writing-mode: vertical-rl;
    text-orientation: mixed;
}

/* Enhanced Responsive Design - Desktop-like Mobile Layout - COMPACT VERSION */

/* ULTRA COMPACT MOBILE LAYOUT OPTIMIZATIONS */

/* Touch-friendly enhancements */

/* Loading Animation */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Alert Messages */
.alert {
    padding: 1rem 1.5rem;
    border-radius: 12px;
    margin: 1rem 0;
    font-weight: 500;
}

.alert-error {
    background: #fee2e2;
    color: var(--danger-red);
    border: 1px solid #fecaca;
}

.alert-info {
    background: var(--light-blue);
    color: var(--primary-blue);
    border: 1px solid #93c5fd;
}

/* Print Styles */
@media print {
    .no-print {
        display: none !important;
    }

    body {
        background: white;
    }

    .report-header,
    .table-container {
        box-shadow: none;
        border-radius: 0;
    }

    .data-table th,
    .data-table td {
        border: 1px solid #000 !important;
        padding: 0.5rem !important;
    }
}

/* Compact Filter Form overrides - Ultra compact for mobile space saving */

/* Maintain desktop grid layout on mobile - ultra compact */

/* Touch-friendly enhancements */

