/* =====================================================================
   DATA-MASTER.CSS — Modul Data Master & Katalog Referensi Transportasi
   Transport Command Center | BPTD Kelas I Jawa Barat
   ===================================================================== */

/* ================= MAP CONTAINER & CONTROLS ================= */
.master-map-container {
    width: 100%;
    height: 560px;
    background: #0b1120;
    border: 1px solid var(--border-color);
    border-top: none;
    border-radius: 0 0 12px 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
    position: relative;
    z-index: 10;
}

/* Sembunyikan attribution leaflet agar tampilan command center bersih */
.leaflet-control-attribution {
    display: none !important;
}

.map-controls-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    padding: 12px 18px;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 12px 12px 0 0;
}

.map-layer-toggles {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}

.layer-toggle-title {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-right: 4px;
}

.layer-checkbox-label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    font-size: 0.82rem;
    user-select: none;
}

.layer-checkbox-label input[type="checkbox"] {
    accent-color: var(--accent-primary);
    cursor: pointer;
}

.layer-badge {
    padding: 3px 8px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    line-height: 1.2;
    transition: opacity 0.2s ease;
}

.layer-checkbox-label input[type="checkbox"]:not(:checked) + .layer-badge {
    opacity: 0.45;
}

.badge-terminal {
    background: rgba(59, 130, 246, 0.15);
    color: #60a5fa;
    border: 1px solid rgba(59, 130, 246, 0.35);
}

.badge-uppkb {
    background: rgba(245, 158, 11, 0.15);
    color: #fbbf24;
    border: 1px solid rgba(245, 158, 11, 0.35);
}

.badge-trayek {
    background: rgba(16, 185, 129, 0.15);
    color: #34d399;
    border: 1px solid rgba(16, 185, 129, 0.35);
}

.badge-multimoda {
    background: rgba(139, 92, 246, 0.15);
    color: #a78bfa;
    border: 1px solid rgba(139, 92, 246, 0.35);
}

.badge-wilayah {
    background: rgba(6, 182, 212, 0.15);
    color: #22d3ee;
    border: 1px solid rgba(6, 182, 212, 0.35);
}

.map-footnote {
    font-size: 0.78rem;
    color: var(--text-muted);
    padding: 8px 4px;
    text-align: right;
}

/* Custom Marker Styling */
.custom-map-marker {
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    color: #ffffff;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
    border: 2px solid #ffffff;
    font-size: 11px;
    font-weight: bold;
    cursor: pointer;
    transition: transform 0.2s ease;
}

.custom-map-marker:hover {
    transform: scale(1.15);
    z-index: 1000 !important;
}

.marker-terminal {
    background: #2563eb;
}

.marker-uppkb {
    background: #d97706;
}

.marker-trayek {
    background: #059669;
}

.marker-multimoda {
    background: #7c3aed;
}

.marker-wilayah {
    background: #0891b2;
}

/* Custom Leaflet Dark Popup */
.leaflet-popup-content-wrapper {
    background: rgba(15, 23, 42, 0.95) !important;
    backdrop-filter: blur(8px);
    color: #f1f5f9 !important;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 10px !important;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.6) !important;
    padding: 4px !important;
}

.leaflet-popup-tip {
    background: rgba(15, 23, 42, 0.95) !important;
    border: 1px solid rgba(255, 255, 255, 0.12);
}

.popup-master-box {
    padding: 6px 8px;
    min-width: 200px;
}

.popup-master-badge {
    display: inline-block;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    padding: 2px 6px;
    border-radius: 4px;
    margin-bottom: 4px;
}

.popup-master-title {
    font-size: 0.92rem;
    font-weight: 700;
    color: #ffffff;
    margin: 0 0 4px 0;
}

.popup-master-sub {
    font-size: 0.78rem;
    color: #94a3b8;
    margin: 0 0 8px 0;
}

.popup-master-action {
    display: block;
    width: 100%;
    padding: 5px 8px;
    background: #2563eb;
    color: #ffffff;
    border: none;
    border-radius: 6px;
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
    text-align: center;
}

.popup-master-action:hover {
    background: #1d4ed8;
}

/* ================= FILTER TOOLBAR ================= */
.filter-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
    padding: 14px 18px;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    margin-bottom: 20px;
}

.filter-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.filter-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
    white-space: nowrap;
}

.filter-select {
    background: var(--bg-primary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 8px 12px;
    font-size: 0.85rem;
    cursor: pointer;
    outline: none;
    transition: border-color 0.2s;
}

.filter-select:focus {
    border-color: var(--accent-primary);
}

.search-group {
    flex-grow: 1;
    min-width: 240px;
}

.search-input-wrap {
    position: relative;
    width: 100%;
}

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

.search-input {
    width: 100%;
    background: var(--bg-primary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 8px 12px 8px 36px;
    font-size: 0.85rem;
    outline: none;
    transition: border-color 0.2s;
}

.search-input:focus {
    border-color: var(--accent-primary);
}

.filter-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

.btn-export {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--bg-primary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 8px 14px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-export:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: var(--text-muted);
}

/* ================= TABS CONTROLLER ================= */
.tabs-header {
    display: flex;
    gap: 8px;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 20px;
}

.tab-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-secondary);
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    cursor: pointer;
    transition: all 0.2s;
}

.tab-btn:hover {
    color: var(--text-primary);
}

.tab-btn.is-active {
    color: var(--accent-primary);
    border-bottom-color: var(--accent-primary);
    background: rgba(59, 130, 246, 0.08);
    border-radius: 8px 8px 0 0;
}

.tab-icon {
    width: 18px;
    height: 18px;
}

.tab-panel {
    display: none;
}

.tab-panel.is-active {
    display: block;
}

/* ================= TABLE & DIRECTORY ================= */
.table-meta-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    padding: 10px 0;
    margin-bottom: 8px;
}

.directory-count-text {
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.table-legend-pills {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.legend-pill {
    font-size: 0.72rem;
    font-weight: 600;
    padding: 2px 7px;
    border-radius: 4px;
}

.pill-terminal { background: rgba(59, 130, 246, 0.15); color: #60a5fa; }
.pill-uppkb { background: rgba(245, 158, 11, 0.15); color: #fbbf24; }
.pill-trayek { background: rgba(16, 185, 129, 0.15); color: #34d399; }
.pill-multimoda { background: rgba(139, 92, 246, 0.15); color: #a78bfa; }
.pill-wilayah { background: rgba(6, 182, 212, 0.15); color: #22d3ee; }
.pill-kamus { background: rgba(236, 72, 153, 0.15); color: #f472b6; }

.table-responsive {
    overflow-x: auto;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 12px;
}

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

.master-table th {
    background: rgba(0, 0, 0, 0.2);
    color: var(--text-secondary);
    padding: 12px 14px;
    font-weight: 600;
    border-bottom: 1px solid var(--border-color);
    white-space: nowrap;
}

.master-table td {
    padding: 12px 14px;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-primary);
    vertical-align: middle;
}

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

.master-table tr:hover td {
    background: rgba(255, 255, 255, 0.03);
}

.badge-cat-pill {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 6px;
    font-size: 0.74rem;
    font-weight: 600;
    white-space: nowrap;
}

.badge-cat-TERMINAL { background: rgba(59, 130, 246, 0.18); color: #60a5fa; }
.badge-cat-UPPKB { background: rgba(245, 158, 11, 0.18); color: #fbbf24; }
.badge-cat-TRAYEK { background: rgba(16, 185, 129, 0.18); color: #34d399; }
.badge-cat-MULTIMODA { background: rgba(139, 92, 246, 0.18); color: #a78bfa; }
.badge-cat-WILAYAH { background: rgba(6, 182, 212, 0.18); color: #22d3ee; }
.badge-cat-KAMUS_DATA { background: rgba(236, 72, 153, 0.18); color: #f472b6; }

.status-tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.75rem;
    font-weight: 600;
}

.status-tag-active {
    color: #34d399;
}

.status-tag-active::before {
    content: "";
    display: inline-block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #34d399;
}

.btn-table-detail {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 4px 10px;
    font-size: 0.78rem;
    font-weight: 600;
    background: rgba(59, 130, 246, 0.12);
    color: #60a5fa;
    border: 1px solid rgba(59, 130, 246, 0.3);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-table-detail:hover {
    background: #2563eb;
    color: #ffffff;
}

/* Empty State */
.empty-state {
    padding: 48px 24px;
    text-align: center;
    background: var(--bg-surface);
    border: 1px dashed var(--border-color);
    border-radius: 12px;
    margin-top: 16px;
}

.empty-icon {
    width: 48px;
    height: 48px;
    color: var(--text-muted);
    margin-bottom: 12px;
}

.empty-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 6px 0;
}

.empty-desc {
    font-size: 0.88rem;
    color: var(--text-secondary);
    margin: 0 0 16px 0;
}

/* ================= DICTIONARY GRID ================= */
.dict-intro-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: linear-gradient(135deg, rgba(30, 41, 59, 0.8), rgba(15, 23, 42, 0.95));
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 18px 24px;
    margin-bottom: 20px;
    gap: 16px;
}

.dict-intro-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 6px 0;
}

.dict-intro-desc {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin: 0;
    line-height: 1.5;
}

.dict-intro-badge {
    background: rgba(236, 72, 153, 0.15);
    color: #f472b6;
    border: 1px solid rgba(236, 72, 153, 0.35);
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 700;
    white-space: nowrap;
}

.dict-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 18px;
}

.dict-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-top: 3px solid #ec4899;
    border-radius: 12px;
    padding: 18px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    transition: transform 0.2s, box-shadow 0.2s;
}

.dict-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3);
}

.dict-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 8px;
}

.dict-code-badge {
    font-family: monospace;
    font-size: 0.78rem;
    font-weight: 700;
    color: #f472b6;
    background: rgba(236, 72, 153, 0.12);
    border: 1px solid rgba(236, 72, 153, 0.25);
    padding: 2px 7px;
    border-radius: 6px;
}

.dict-category-tag {
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--text-muted);
}

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

.dict-desc {
    font-size: 0.84rem;
    color: var(--text-secondary);
    line-height: 1.5;
    margin: 0;
}

.dict-formula-box {
    background: rgba(0, 0, 0, 0.3);
    border: 1px dashed rgba(255, 255, 255, 0.15);
    border-radius: 8px;
    padding: 10px 12px;
    font-family: monospace;
    font-size: 0.8rem;
    color: #38bdf8;
    line-height: 1.4;
    word-break: break-word;
}

.dict-meta-row {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: auto;
    padding-top: 6px;
}

.dict-pill {
    font-size: 0.72rem;
    padding: 3px 8px;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-secondary);
}

/* ================= MODAL DIALOG ================= */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    padding: 16px;
}

.modal-overlay[hidden] {
    display: none !important;
}

.modal-dialog {
    background: #0f172a;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 16px;
    width: 100%;
    max-width: 660px;
    max-height: 88vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.7);
    animation: modalSlideIn 0.2s ease-out;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(12px) scale(0.98);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
    background: rgba(255, 255, 255, 0.02);
}

.modal-header-badges {
    display: flex;
    gap: 8px;
    margin-bottom: 6px;
}

.modal-badge-cat {
    font-size: 0.75rem;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 6px;
    background: rgba(59, 130, 246, 0.2);
    color: #60a5fa;
}

.modal-badge-status {
    font-size: 0.75rem;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 6px;
    background: rgba(16, 185, 129, 0.2);
    color: #34d399;
}

.modal-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: #ffffff;
    margin: 0 0 4px 0;
}

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

.modal-close-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px;
    border-radius: 6px;
    transition: color 0.2s;
}

.modal-close-btn:hover {
    color: #ffffff;
}

.modal-body {
    padding: 20px 24px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.modal-info-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.modal-info-item {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 10px 14px;
}

.info-label {
    display: block;
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: 2px;
    font-weight: 600;
}

.info-value {
    display: block;
    font-size: 0.88rem;
    color: #ffffff;
    font-weight: 600;
}

.modal-section-title {
    font-size: 0.88rem;
    font-weight: 700;
    color: var(--text-secondary);
    margin: 0 0 8px 0;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.spec-highlight-box {
    background: rgba(59, 130, 246, 0.08);
    border: 1px solid rgba(59, 130, 246, 0.25);
    border-radius: 8px;
    padding: 12px 16px;
    font-size: 0.88rem;
    color: #93c5fd;
    line-height: 1.5;
}

.coords-box {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 8px 12px;
    font-size: 0.82rem;
    margin-bottom: 6px;
}

.coords-label {
    color: var(--text-muted);
    font-weight: 600;
}

.coords-value {
    color: #38bdf8;
    font-family: monospace;
}

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

.modal-desc-text {
    font-size: 0.86rem;
    color: #cbd5e1;
    line-height: 1.5;
    margin: 0;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 16px 24px;
    border-top: 1px solid var(--border-color);
    background: rgba(255, 255, 255, 0.02);
}

/* ================= RESPONSIVE ================= */
@media (max-width: 768px) {
    .master-map-container {
        height: 420px;
    }

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

    .search-group {
        min-width: 100%;
    }

    .filter-actions {
        width: 100%;
        justify-content: flex-end;
    }

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

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

    .dict-intro-card {
        flex-direction: column;
        align-items: flex-start;
    }
}
