/* =====================================================================
   GeoPORTAL BPTD Jabar — Modul Program & Kinerja Transportasi (program.css)
   Monitoring Capaian Output Fisik, Serapan Anggaran & Registri KPI BPTD
   ===================================================================== */

/* =====================================================================
   1. MAP SECTION & SPATIAL MARKERS
   ===================================================================== */
.program-map-card {
    padding: 1.25rem;
    margin-bottom: 1.5rem;
}

.program-map-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}

.program-map-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.btn-map-control {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.4rem 0.85rem;
    border-radius: 0.375rem;
    background: #ffffff;
    color: #334155;
    border: 1px solid var(--border);
    cursor: pointer;
    transition: all 0.15s ease;
}

.btn-map-control:hover {
    background: #f1f5f9;
    color: var(--blue-700);
    border-color: #cbd5e1;
}

.program-map {
    width: 100%;
    height: 460px;
    border-radius: 0.5rem;
    border: 1px solid var(--border);
    background: #f8fafc;
    position: relative;
    z-index: 1;
}

/* Bidang Filter Chips Bar */
.bidang-filter-bar {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.bidang-filter-title {
    font-size: 0.75rem;
    font-weight: 600;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.bidang-toggle-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.bidang-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.35rem 0.75rem;
    border-radius: 9999px;
    background: #f8fafc;
    border: 1px solid var(--border);
    color: #334155;
    cursor: pointer;
    transition: all 0.15s ease;
}

.bidang-chip:hover {
    border-color: #94a3b8;
    background: #f1f5f9;
}

.bidang-chip.is-active {
    background: #0f172a;
    color: #ffffff;
    border-color: #0f172a;
}

.bidang-chip .chip-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.chip-dot-all { background: #64748b; }
.chip-dot-angkutan { background: #3b82f6; }
.chip-dot-lalin { background: #f59e0b; }
.chip-dot-sarpras { background: #10b981; }

/* Custom Spatial Program Markers */
.program-marker {
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
}

.program-marker-pin {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    font-size: 0.6875rem;
    font-weight: 800;
    box-shadow: 0 4px 10px rgba(15, 23, 42, 0.25);
    border: 2px solid #ffffff;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.program-marker-pin:hover {
    transform: scale(1.15);
    box-shadow: 0 6px 14px rgba(15, 23, 42, 0.35);
}

.program-marker-pin.is-angkutan {
    background: linear-gradient(135deg, #3b82f6, #1d4ed8);
}

.program-marker-pin.is-lalin {
    background: linear-gradient(135deg, #f59e0b, #d97706);
}

.program-marker-pin.is-sarpras {
    background: linear-gradient(135deg, #10b981, #059669);
}

.marker-percent-text {
    font-size: 0.625rem;
    font-weight: 700;
    line-height: 1;
}

.marker-sub-text {
    font-size: 0.5rem;
    opacity: 0.9;
    line-height: 1;
    margin-top: 1px;
}

/* Program Marker Popup */
.program-popup {
    min-width: 250px;
    max-width: 320px;
    font-family: inherit;
    padding: 0.25rem;
}

.program-popup .popup-title {
    font-size: 0.875rem;
    font-weight: 700;
    color: #0f172a;
    line-height: 1.3;
    margin-bottom: 0.4rem;
}

.program-popup .popup-param {
    font-size: 0.75rem;
    color: #475569;
    margin-bottom: 0.3rem;
    line-height: 1.35;
}

.program-popup .popup-btn {
    display: inline-block;
    width: 100%;
    margin-top: 0.5rem;
    padding: 0.4rem 0.6rem;
    font-size: 0.75rem;
    font-weight: 600;
    text-align: center;
    background: var(--blue-600);
    color: #ffffff;
    border: none;
    border-radius: 0.25rem;
    cursor: pointer;
    transition: background 0.15s ease;
}

.program-popup .popup-btn:hover {
    background: var(--blue-700);
}

/* =====================================================================
   2. ANALYTICS TABS & CONTROLS
   ==================================================================== */
.program-analytics-card {
    padding: 1.25rem;
    margin-bottom: 2rem;
}

.program-tabs {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    border-bottom: 1px solid var(--border);
    margin-bottom: 1.25rem;
    overflow-x: auto;
    scrollbar-width: none;
}

.program-tabs::-webkit-scrollbar {
    display: none;
}

.tab-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.65rem 1rem;
    font-size: 0.8125rem;
    font-weight: 600;
    color: #64748b;
    border: none;
    background: transparent;
    border-bottom: 2px solid transparent;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.15s ease;
}

.tab-btn:hover {
    color: #0f172a;
}

.tab-btn.is-active {
    color: var(--blue-700);
    border-bottom-color: var(--blue-700);
}

.tab-count-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.15rem 0.45rem;
    font-size: 0.6875rem;
    font-weight: 700;
    border-radius: 9999px;
    background: #e2e8f0;
    color: #475569;
}

.tab-btn.is-active .tab-count-badge {
    background: #dbeafe;
    color: #1d4ed8;
}

/* Tab Panels */
.program-tabpanel {
    display: block;
}

.program-tabpanel[hidden] {
    display: none !important;
}

/* Table Toolbar */
.table-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}

.table-toolbar-left {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
    flex: 1;
}

.search-input-wrap {
    position: relative;
    min-width: 260px;
    max-width: 380px;
    flex: 1;
}

.search-input-wrap svg {
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    width: 1rem;
    height: 1rem;
    color: #94a3b8;
    pointer-events: none;
}

.search-input {
    width: 100%;
    padding: 0.45rem 0.75rem 0.45rem 2.2rem;
    font-size: 0.8125rem;
    border: 1px solid var(--border);
    border-radius: 0.375rem;
    background: #ffffff;
    color: #0f172a;
    outline: none;
    transition: border-color 0.15s ease;
}

.search-input:focus {
    border-color: var(--blue-600);
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.12);
}

.select-filter {
    padding: 0.45rem 0.75rem;
    font-size: 0.8125rem;
    border: 1px solid var(--border);
    border-radius: 0.375rem;
    background: #ffffff;
    color: #334155;
    outline: none;
    cursor: pointer;
    transition: border-color 0.15s ease;
}

.select-filter:focus {
    border-color: var(--blue-600);
}

.table-count-info {
    font-size: 0.75rem;
    color: #64748b;
    white-space: nowrap;
}

/* Table Wrap & Styling */
.table-wrap {
    width: 100%;
    overflow-x: auto;
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    background: #ffffff;
    max-height: 520px;
    overflow-y: auto;
}

.program-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8125rem;
    text-align: left;
}

.program-table thead th {
    background: #f8fafc;
    color: #475569;
    font-weight: 700;
    padding: 0.75rem 0.875rem;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
    position: sticky;
    top: 0;
    z-index: 2;
}

.program-table tbody td {
    padding: 0.75rem 0.875rem;
    border-bottom: 1px solid #f1f5f9;
    color: #1e293b;
    vertical-align: middle;
}

.program-table tbody tr:hover {
    background: #f8fafc;
}

.th-center {
    text-align: center !important;
}

.td-center {
    text-align: center !important;
}

/* Badges & Indicators */
.bidang-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.2rem 0.5rem;
    border-radius: 0.25rem;
    font-size: 0.6875rem;
    font-weight: 700;
    white-space: nowrap;
}

.bidang-angkutan {
    background: #dbeafe;
    color: #1d4ed8;
}

.bidang-lalin {
    background: #fef3c7;
    color: #b45309;
}

.bidang-sarpras {
    background: #dcfce7;
    color: #15803d;
}

.code-pill {
    display: inline-block;
    padding: 0.15rem 0.4rem;
    border-radius: 0.25rem;
    background: #f1f5f9;
    color: #475569;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: 0.6875rem;
    font-weight: 600;
}

.badge-status-on-track {
    display: inline-flex;
    align-items: center;
    padding: 0.2rem 0.5rem;
    border-radius: 9999px;
    font-size: 0.6875rem;
    font-weight: 700;
    background: #dcfce7;
    color: #166534;
    white-space: nowrap;
}

/* Visual Progress Bar */
.progress-cell {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.progress-cell-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.6875rem;
    font-weight: 600;
}

.progress-bar-track {
    width: 100%;
    height: 7px;
    background: #e2e8f0;
    border-radius: 9999px;
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    border-radius: 9999px;
    transition: width 0.4s ease;
}

.progress-fill-blue {
    background: linear-gradient(90deg, #3b82f6, #2563eb);
}

.progress-fill-amber {
    background: linear-gradient(90deg, #f59e0b, #d97706);
}

.progress-fill-green {
    background: linear-gradient(90deg, #10b981, #059669);
}

.btn-detail {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.35rem 0.65rem;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 0.25rem;
    background: #ffffff;
    color: var(--blue-700);
    border: 1px solid var(--border);
    cursor: pointer;
    transition: all 0.15s ease;
}

.btn-detail:hover {
    background: #eff6ff;
    border-color: #bfdbfe;
}

/* =====================================================================
   3. DETAIL MODAL DIALOG
   ===================================================================== */
.modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(2px);
    z-index: 999;
}

.modal-dialog {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 90%;
    max-width: 720px;
    max-height: 88vh;
    background: #ffffff;
    border-radius: 0.75rem;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: modalFadeIn 0.2s ease;
}

@keyframes modalFadeIn {
    from {
        opacity: 0;
        transform: translate(-50%, -48%) scale(0.98);
    }
    to {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
}

.modal-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border);
    background: #f8fafc;
}

.modal-title-group {
    flex: 1;
}

.modal-badge-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.4rem;
    flex-wrap: wrap;
}

.modal-title {
    font-size: 1.125rem;
    font-weight: 700;
    color: #0f172a;
    line-height: 1.3;
    margin: 0 0 0.25rem 0;
}

.modal-sub {
    font-size: 0.75rem;
    color: #64748b;
    margin: 0;
}

.modal-close-btn {
    background: transparent;
    border: none;
    color: #94a3b8;
    cursor: pointer;
    padding: 0.25rem;
    border-radius: 0.375rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.15s ease, background-color 0.15s ease;
}

.modal-close-btn:hover {
    color: #0f172a;
    background: #e2e8f0;
}

.modal-body {
    padding: 1.5rem;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.modal-section-title {
    font-size: 0.8125rem;
    font-weight: 700;
    color: #475569;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin: 0 0 0.5rem 0;
}

.modal-desc-box {
    margin: 0;
    font-size: 0.8125rem;
    line-height: 1.5;
    color: #334155;
    background: #f8fafc;
    border: 1px solid var(--border);
    border-radius: 0.375rem;
    padding: 0.75rem;
}

.modal-evaluation-box {
    margin: 0;
    font-size: 0.8125rem;
    line-height: 1.5;
    color: #1e293b;
    background: #f0fdf4;
    border-left: 3px solid #16a34a;
    border-radius: 0 0.375rem 0.375rem 0;
    padding: 0.75rem;
}

.modal-stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.75rem;
}

.modal-stat-card {
    background: #f8fafc;
    border: 1px solid var(--border);
    border-radius: 0.375rem;
    padding: 0.75rem;
    display: flex;
    flex-direction: column;
}

.modal-stat-label {
    font-size: 0.6875rem;
    font-weight: 600;
    color: #64748b;
    margin-bottom: 0.25rem;
}

.modal-stat-val {
    font-size: 1rem;
    font-weight: 700;
    line-height: 1.2;
    margin: 0 0 0.25rem 0;
}

.modal-stat-sub {
    font-size: 0.6875rem;
    color: #64748b;
}

.text-green { color: #16a34a; }
.text-amber { color: #d97706; }
.text-blue { color: #2563eb; }
.text-purple { color: #7c3aed; }
.font-mono { font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace; }

/* Subkegiatan List in Modal */
.modal-subkegiatan-list {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
}

.subkegiatan-item {
    background: #f8fafc;
    border: 1px solid var(--border);
    border-radius: 0.375rem;
    padding: 0.65rem 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.subkegiatan-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.5rem;
}

.subkegiatan-name {
    font-size: 0.8125rem;
    font-weight: 600;
    color: #0f172a;
    line-height: 1.3;
}

.subkegiatan-percent {
    font-size: 0.75rem;
    font-weight: 700;
    color: #16a34a;
    white-space: nowrap;
}

.subkegiatan-targets {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.6875rem;
    color: #64748b;
}

.modal-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.75rem;
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border);
    background: #f8fafc;
}

/* =====================================================================
   4. RESPONSIVE BREAKPOINTS
   ===================================================================== */
@media (max-width: 768px) {
    .program-map {
        height: 360px;
    }

    .modal-stats-grid {
        grid-template-columns: 1fr;
    }

    .table-toolbar {
        flex-direction: column;
        align-items: stretch;
    }

    .table-toolbar-left {
        flex-direction: column;
        align-items: stretch;
    }

    .search-input-wrap {
        max-width: 100%;
        min-width: 100%;
    }
}
