/* ═══════════════════════════════════════════════════════
   SiPeta - Sistem Pemetaan Ancaman Strategis
   Custom Stylesheet
═══════════════════════════════════════════════════════ */

:root {
    --sidebar-width: 240px;
    --sidebar-collapsed-width: 0px;
    --topbar-height: 50px;
    --bg-dark: #0f1117;
    --bg-card: #1a1d27;
    --border-color: #2d3148;
}

body {
    background-color: var(--bg-dark);
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    min-height: 100vh;
}

/* ─── Layout ──────────────────────────────────────────── */
#wrapper {
    min-height: 100vh;
}

/* ─── Sidebar ─────────────────────────────────────────── */
#sidebar {
    width: var(--sidebar-width);
    min-width: var(--sidebar-width);
    background-color: #12151f;
    border-right: 1px solid #1e2235;
    min-height: 100vh;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    transition: all 0.3s ease;
}

#wrapper.sidebar-collapsed #sidebar {
    width: 0;
    min-width: 0;
    overflow: hidden;
}

.sidebar-brand {
    border-bottom: 1px solid #1e2235;
}

.sidebar-link {
    color: #8892a4;
    border-radius: 8px;
    padding: 10px 14px;
    margin-bottom: 2px;
    transition: all 0.2s;
    font-size: 0.9rem;
}

.sidebar-link:hover {
    color: #fff;
    background-color: rgba(255, 193, 7, 0.08);
}

.sidebar-link.active {
    color: #ffc107;
    background-color: rgba(255, 193, 7, 0.12);
    font-weight: 600;
}

/* ─── Topbar ──────────────────────────────────────────── */
.topbar {
    height: var(--topbar-height);
    background-color: #12151f;
    border-bottom: 1px solid #1e2235;
    position: sticky;
    top: 0;
    z-index: 100;
}

/* ─── Page Content ────────────────────────────────────── */
#page-content {
    min-height: 100vh;
    overflow-x: hidden;
}

.content-area {
    min-height: calc(100vh - var(--topbar-height));
}

/* ─── Cards ───────────────────────────────────────────── */
.card {
    background-color: var(--bg-card);
    border-color: #1e2235 !important;
}

.card-header {
    background-color: rgba(255, 255, 255, 0.03);
}

.hover-card {
    transition: transform 0.15s, box-shadow 0.15s;
}

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

/* ─── Form Controls ───────────────────────────────────── */
.form-control,
.form-select {
    background-color: #1a1d27;
    border-color: #2d3148;
    color: #e0e0e0;
}

.form-control:focus,
.form-select:focus {
    background-color: #1e2235;
    border-color: #ffc107;
    color: #fff;
    box-shadow: 0 0 0 0.15rem rgba(255, 193, 7, 0.2);
}

.form-control::placeholder {
    color: #555;
}

/* ─── Tables ──────────────────────────────────────────── */
.table-dark {
    --bs-table-bg: var(--bg-card);
    --bs-table-hover-bg: rgba(255, 193, 7, 0.05);
}

/* ─── Scrollbar ───────────────────────────────────────── */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: #12151f;
}

::-webkit-scrollbar-thumb {
    background: #2d3148;
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: #3d4468;
}

/* ─── Leaflet Popup Override ──────────────────────────── */
.leaflet-popup-content-wrapper {
    border-radius: 10px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.leaflet-popup-content {
    margin: 14px 16px;
}

/* ─── Badges ──────────────────────────────────────────── */
.badge {
    font-weight: 500;
}

/* ─── Alerts ──────────────────────────────────────────── */
.alert-dismissible {
    border-radius: 10px;
}

/* ─── Responsive ──────────────────────────────────────── */
@media (max-width: 992px) {
    /* Sidebar tersembunyi by default di mobile */
    #sidebar {
        position: fixed !important;
        left: 0;
        top: 0;
        z-index: 999;
        height: 100vh !important;
        transform: translateX(-100%) !important;
        width: var(--sidebar-width) !important;
        min-width: var(--sidebar-width) !important;
        overflow-y: auto;
        transition: transform 0.3s ease;
    }

    /* Reset perilaku collapse desktop di mobile */
    #wrapper.sidebar-collapsed #sidebar {
        transform: translateX(-100%) !important;
        width: var(--sidebar-width) !important;
        min-width: var(--sidebar-width) !important;
    }

    /* Sidebar muncul saat sidebar-open aktif (harus setelah collapsed) */
    #wrapper.sidebar-open #sidebar {
        transform: translateX(0) !important;
    }

    /* Overlay gelap di belakang sidebar */
    #sidebar-overlay {
        display: none;
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.55);
        z-index: 998;
    }

    #wrapper.sidebar-open #sidebar-overlay {
        display: block;
    }
}
