/* =====================================================================
   GeoPORTAL BPTD Jabar — Modul UPPKB & Angkutan Barang Styles (uppkb.css)
   ===================================================================== */

/* Map Card & Container */
.uppkb-map-card {
    padding: 1.25rem;
    margin-bottom: 1.5rem;
}

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

.uppkb-legend-bar {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.legend-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.25rem 0.6rem;
    border-radius: 9999px;
    background: #f1f5f9;
    color: var(--text-primary);
    border: 1px solid var(--border);
}

.legend-amber {
    background: #fffbeb;
    color: #92400e;
    border-color: #fde68a;
}

.legend-blue {
    background: #eff6ff;
    color: #1e40af;
    border-color: #bfdbfe;
}

.legend-green {
    background: #ecfdf5;
    color: #065f46;
    border-color: #a7f3d0;
}

.legend-purple {
    background: #f5f3ff;
    color: #5b21b6;
    border-color: #ddd6fe;
}

.legend-dot-solid {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex: none;
}

.uppkb-map-container {
    width: 100%;
    height: 420px;
    min-height: 420px;
    border-radius: 0.75rem;
    overflow: hidden;
    border: 1px solid var(--border);
    position: relative;
    background: #0f172a;
}

.map-status-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: rgba(15, 23, 42, 0.82);
    color: #f8fafc;
    z-index: 500;
    padding: 1.5rem;
    text-align: center;
    gap: 0.75rem;
}

.map-status-spinner {
    width: 2.25rem;
    height: 2.25rem;
    border: 3px solid rgba(255, 255, 255, 0.15);
    border-top-color: #38bdf8;
    border-radius: 50%;
    animation: mapSpin 0.8s linear infinite;
}

@keyframes mapSpin {
    to { transform: rotate(360deg); }
}

.map-status-msg {
    font-size: 0.9rem;
    color: #e2e8f0;
    max-width: 340px;
    margin: 0;
}

.map-retry-btn {
    background: #0284c7;
    color: #ffffff;
    border: none;
    padding: 0.45rem 1rem;
    border-radius: 0.375rem;
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s ease;
}

.map-retry-btn:hover {
    background: #0369a1;
}

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

.search-input-wrap {
    position: relative;
    flex: 1 1 260px;
}

.search-icon {
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    width: 1.1rem;
    height: 1.1rem;
    color: var(--text-muted);
    pointer-events: none;
}

.search-input {
    width: 100%;
    padding: 0.55rem 0.75rem 0.55rem 2.25rem;
    border-radius: 0.5rem;
    border: 1px solid var(--border);
    background: #ffffff;
    font-size: 0.85rem;
    color: var(--text-primary);
    outline: none;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.search-input:focus {
    border-color: var(--primary, #0284c7);
    box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.15);
}

.filter-select-wrap {
    flex: 0 1 220px;
}

.filter-select {
    width: 100%;
    padding: 0.55rem 0.75rem;
    border-radius: 0.5rem;
    border: 1px solid var(--border);
    background: #ffffff;
    font-size: 0.85rem;
    color: var(--text-primary);
    outline: none;
    cursor: pointer;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.filter-select:focus {
    border-color: var(--primary, #0284c7);
    box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.15);
}

.result-count {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-weight: 500;
}

/* UPPKB Cards Grid */
.uppkb-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 1.25rem;
}

.uppkb-card {
    background: #ffffff;
    border: 1px solid var(--border);
    border-radius: 0.75rem;
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.uppkb-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.08);
    border-color: var(--primary, #0284c7);
}

.uppkb-card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

.uppkb-code-pill {
    display: inline-block;
    font-size: 0.75rem;
    font-weight: 700;
    font-family: monospace;
    padding: 0.2rem 0.5rem;
    border-radius: 0.375rem;
    background: #f1f5f9;
    color: #1e293b;
    border: 1px solid #cbd5e1;
}

.uppkb-status-badge {
    font-size: 0.7rem;
    font-weight: 700;
    padding: 0.2rem 0.5rem;
    border-radius: 9999px;
    background: #ecfdf5;
    color: #065f46;
    border: 1px solid #a7f3d0;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.uppkb-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0.35rem 0 0.15rem 0;
}

.uppkb-region {
    font-size: 0.8rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.uppkb-corridor-tag {
    display: inline-block;
    margin-top: 0.5rem;
    font-size: 0.72rem;
    padding: 0.2rem 0.5rem;
    border-radius: 0.25rem;
    background: #f8fafc;
    color: #475569;
    border: 1px solid #e2e8f0;
}

.uppkb-stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
    margin: 1rem 0;
    background: #f8fafc;
    border-radius: 0.5rem;
    padding: 0.75rem;
    border: 1px solid #e2e8f0;
}

.uppkb-stat-item {
    display: flex;
    flex-direction: column;
}

.uppkb-stat-label {
    font-size: 0.7rem;
    color: var(--text-muted);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

.uppkb-stat-val {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-top: 0.1rem;
}

.uppkb-stat-sub {
    font-size: 0.7rem;
    color: var(--text-muted);
}

.uppkb-progress-wrap {
    margin-bottom: 1rem;
}

.uppkb-progress-label-row {
    display: flex;
    justify-content: space-between;
    font-size: 0.75rem;
    margin-bottom: 0.35rem;
}

.uppkb-progress-title {
    color: var(--text-muted);
}

.uppkb-progress-val {
    font-weight: 700;
    color: #059669;
}

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

.uppkb-progress-fill {
    height: 100%;
    background: #10b981;
    border-radius: 9999px;
    transition: width 0.3s ease;
}

.uppkb-card-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: auto;
    padding-top: 0.75rem;
    border-top: 1px solid #f1f5f9;
}

.btn-card-focus,
.btn-card-detail {
    flex: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    font-size: 0.78rem;
    font-weight: 600;
    padding: 0.45rem 0.65rem;
    border-radius: 0.375rem;
    cursor: pointer;
    transition: all 0.15s ease;
}

.btn-card-focus {
    background: #ffffff;
    border: 1px solid var(--border);
    color: var(--text-primary);
}

.btn-card-focus:hover {
    background: #f8fafc;
    border-color: #cbd5e1;
    color: var(--primary, #0284c7);
}

.btn-card-detail {
    background: var(--primary, #0284c7);
    border: 1px solid transparent;
    color: #ffffff;
}

.btn-card-detail:hover {
    background: #0369a1;
}

/* Modal Dialog & Backdrop */
.modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.65);
    backdrop-filter: blur(4px);
    z-index: 1000;
    transition: opacity 0.2s ease;
}

.modal-dialog {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: #ffffff;
    border-radius: 0.75rem;
    width: 90%;
    max-width: 820px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    z-index: 1001;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    overflow: hidden;
    animation: modalSlideIn 0.2s ease-out;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translate(-50%, -46%);
    }
    to {
        opacity: 1;
        transform: translate(-50%, -50%);
    }
}

.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 {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

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

.badge-code {
    font-family: monospace;
    font-size: 0.75rem;
    font-weight: 700;
    padding: 0.15rem 0.45rem;
    background: #e2e8f0;
    color: #1e293b;
    border-radius: 0.25rem;
}

.badge-endpoint-status {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.badge-lf-pill {
    font-size: 0.72rem;
    font-weight: 600;
    padding: 0.15rem 0.5rem;
    border-radius: 9999px;
    background: #ecfdf5;
    color: #065f46;
    border: 1px solid #a7f3d0;
}

.modal-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
}

.modal-sub {
    font-size: 0.82rem;
    color: var(--text-muted);
    margin: 0;
}

.modal-close-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0.35rem;
    border-radius: 0.375rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.modal-close-btn:hover {
    background: #e2e8f0;
    color: var(--text-primary);
}

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

.modal-section-title {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 0.75rem 0;
    padding-bottom: 0.4rem;
    border-bottom: 1px solid var(--border);
}

.modal-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

.modal-stat-card {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 0.5rem;
    padding: 0.85rem 1rem;
    display: flex;
    flex-direction: column;
}

.modal-stat-label {
    font-size: 0.72rem;
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

.modal-stat-val {
    font-size: 1.35rem;
    font-weight: 800;
    color: var(--text-primary);
    margin: 0.2rem 0;
}

.modal-stat-sub {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.enforcement-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 0.75rem;
}

.enforce-box {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 0.5rem;
    padding: 0.75rem;
    display: flex;
    flex-direction: column;
}

.enforce-label {
    font-size: 0.72rem;
    color: var(--text-muted);
    font-weight: 600;
}

.enforce-val {
    font-size: 1.2rem;
    font-weight: 800;
    color: var(--text-primary);
    margin: 0.2rem 0;
}

.enforce-sub {
    font-size: 0.68rem;
    color: var(--text-muted);
}

.modal-desc-box {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 0.5rem;
    padding: 0.85rem 1rem;
    font-size: 0.85rem;
    line-height: 1.5;
    color: var(--text-primary);
}

.modal-desc-text {
    margin: 0 0 0.5rem 0;
}

.modal-address-text {
    margin: 0;
    color: #475569;
}

.monthly-table-wrap {
    overflow-x: auto;
    border: 1px solid var(--border);
    border-radius: 0.5rem;
}

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

.monthly-table th {
    background: #f8fafc;
    padding: 0.6rem 0.75rem;
    font-weight: 600;
    color: var(--text-primary);
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

.monthly-table td {
    padding: 0.55rem 0.75rem;
    border-bottom: 1px solid #f1f5f9;
    color: var(--text-primary);
}

.monthly-table tr:last-child td {
    border-bottom: none;
}

.monthly-table tr:hover td {
    background: #f8fafc;
}

.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;
}

.btn-primary-sm {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    background: var(--primary, #0284c7);
    color: #ffffff;
    border: none;
    padding: 0.45rem 0.85rem;
    border-radius: 0.375rem;
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s ease;
}

.btn-primary-sm:hover {
    background: #0369a1;
}

.btn-secondary {
    display: inline-flex;
    align-items: center;
    background: #ffffff;
    color: var(--text-primary);
    border: 1px solid var(--border);
    padding: 0.45rem 0.85rem;
    border-radius: 0.375rem;
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s ease;
}

.btn-secondary:hover {
    background: #f8fafc;
}

/* Color utility classes */
.text-green { color: #059669 !important; }
.text-red { color: #dc2626 !important; }
.text-amber { color: #d97706 !important; }
.text-blue { color: #2563eb !important; }

/* Custom Leaflet Marker */
.uppkb-custom-marker {
    background: transparent;
    border: none;
}

.uppkb-marker-pin {
    width: 32px;
    height: 32px;
    border-radius: 50% 50% 50% 0;
    background: #f59e0b;
    position: absolute;
    transform: rotate(-45deg);
    left: 50%;
    top: 50%;
    margin: -20px 0 0 -16px;
    box-shadow: 0 4px 10px rgba(245, 158, 11, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid #ffffff;
    transition: transform 0.2s ease, background-color 0.2s ease;
}

.uppkb-marker-pin::after {
    content: '';
    width: 14px;
    height: 14px;
    margin: 7px 0 0 7px;
    background: #ffffff;
    position: absolute;
    border-radius: 50%;
}

.uppkb-marker-pulse {
    background: rgba(245, 158, 11, 0.35);
    border-radius: 50%;
    height: 14px;
    width: 14px;
    position: absolute;
    left: 50%;
    top: 50%;
    margin: 8px 0px 0px -7px;
    transform: rotateX(55deg);
    z-index: -2;
    animation: uppkbPulsate 1.8s ease-out infinite;
}

@keyframes uppkbPulsate {
    0% { transform: scale(0.1, 0.1); opacity: 0.0; }
    50% { opacity: 1.0; }
    100% { transform: scale(2.2, 2.2); opacity: 0.0; }
}

.uppkb-custom-popup .leaflet-popup-content-wrapper {
    border-radius: 0.5rem;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
    padding: 0;
    overflow: hidden;
}

.uppkb-custom-popup .leaflet-popup-content {
    margin: 0;
    line-height: 1.4;
}

.popup-inner {
    padding: 0.85rem 1rem;
    min-width: 220px;
}

.popup-badge {
    font-size: 0.7rem;
    font-weight: 700;
    font-family: monospace;
    background: #f1f5f9;
    color: #1e293b;
    padding: 0.15rem 0.4rem;
    border-radius: 0.25rem;
}

.popup-title {
    font-size: 0.95rem;
    font-weight: 700;
    color: #0f172a;
    margin: 0.35rem 0 0.15rem 0;
}

.popup-sub {
    font-size: 0.75rem;
    color: #64748b;
    margin-bottom: 0.6rem;
}

.popup-metrics {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    font-size: 0.78rem;
    border-top: 1px solid #f1f5f9;
    padding-top: 0.5rem;
    margin-bottom: 0.6rem;
}

.popup-btn {
    width: 100%;
    padding: 0.35rem 0.5rem;
    background: #0284c7;
    color: #ffffff;
    border: none;
    border-radius: 0.25rem;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    text-align: center;
}

.popup-btn:hover {
    background: #0369a1;
}

/* Responsive */
@media (max-width: 768px) {
    .uppkb-map-container {
        height: 320px;
    }

    .uppkb-filter-bar {
        flex-direction: column;
        align-items: stretch;
    }

    .filter-select-wrap {
        flex: 1 1 100%;
    }

    .uppkb-grid {
        grid-template-columns: 1fr;
    }

    .modal-dialog {
        width: 95%;
        max-height: 94vh;
    }

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

    .enforcement-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}
