/* =======================================
   RESET & BASE
======================================= */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}
html,
body {
    height: 100%;
}
body {
    font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
    color: #111827; /* gray-900 */
    background: #f4f4f5; /* zinc-100 */
}
a {
    color: inherit;
    text-decoration: none;
}

/* Container utama untuk semua halaman */
.container {
    display: flex;
    height: 100vh;
    width: 100%;
    position: relative;
    overflow: hidden; /* biar peta full tanpa scroll body */
}

/* =======================================
   BACKGROUND (opsional per halaman)
======================================= */
.page-index .container {
    background: #05205200 url("../img/ASSESTS-01.png") no-repeat right bottom /
        cover;
}
.page-map .container {
    background: #05205200 url("../img/ASSESTS-02.png") no-repeat right bottom /
        cover;
}

/* =======================================
   SIDEBAR
   Catatan:
   - Desktop: sidebar tampil normal.
   - Mobile: slide-in/out via #sidebar-container.open
======================================= */
/* =======================================
   SIDEBAR WRAPPER
======================================= */
#sidebar-container {
    position: relative;
    width: 300px;
    min-width: 280px;
    height: 100%;
    padding: 0;
    background: transparent;
    border-right: none;
    z-index: 1500;
    transition: all 0.3s ease;
}

/* =======================================
   SIDEBAR CONTENT
======================================= */
#sidebar-container .sidebar {
    position: relative;
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.92); /* putih transparan */
    backdrop-filter: blur(10px);
    border-right: 1px solid #e5e7eb;
    padding: 18px;
    box-shadow: 4px 0 16px rgba(0, 0, 0, 0.08);
    overflow-y: auto;
    border-radius: 0 16px 16px 0;
    transition: all 0.3s ease;
}

/* =======================================
   SIDEBAR HEADER / LOGO
======================================= */
.sidebar .logo {
    margin-bottom: 22px;
    text-align: center;
}
.sidebar .logo img {
    width: 130px;
    height: auto;
    display: inline-block;
    filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.1));
    transition: transform 0.3s ease;
}
.sidebar .logo img:hover {
    transform: scale(1.05);
}
.sidebar .logo h2 {
    font-size: 18px;
    margin-top: 8px;
    font-weight: 700;
    color: #0a2a66;
}
.sidebar .logo p {
    font-size: 13px;
    color: #6b7280;
}

/* =======================================
   SIDEBAR MENU
======================================= */
.sidebar .menu {
    display: grid;
    gap: 10px;
    margin-top: 12px;
}
.sidebar .menu a,
.sidebar .menu span {
    display: block;
    padding: 10px 14px;
    border-radius: 12px;
    font-weight: 600;
    color: #111;
    transition: all 0.25s ease;
}
.sidebar .menu a:hover {
    background: #f3f4f6;
    transform: translateX(4px);
    box-shadow: 2px 2px 8px rgba(0, 0, 0, 0.05);
}
.sidebar .menu a.active {
    background: #0a2a66;
    color: #fff;
    box-shadow: inset 0 0 0 2px rgba(10, 42, 102, 0.7);
}
.sidebar .menu .submenu {
    display: grid;
    gap: 6px;
    margin-top: 4px;
}
.sidebar .menu .submenu a {
    font-size: 14px;
    padding-left: 18px;
    background: #f9fafb;
    border-radius: 8px;
    transition: all 0.25s ease;
}
.sidebar .menu .submenu a:hover {
    background: #e5e7eb;
    transform: translateX(2px);
}

/* =======================================
   CLOSE BUTTON (MOBILE)
======================================= */
.close-sidebar-btn {
    position: absolute;
    top: 12px;
    right: 12px;
    border: none;
    background: rgba(255, 255, 255, 0.8);
    font-size: 26px;
    line-height: 1;
    cursor: pointer;
    display: none;
    border-radius: 50%;
    padding: 2px 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    transition: all 0.25s ease;
}
.close-sidebar-btn:hover {
    background: #0a2a66;
    color: #fff;
    transform: scale(1.1);
}

/* =======================================
   SIDEBAR PANEL ANIMATION (MOBILE)
======================================= */
#sidebarPanel {
    transform: translateX(-100%);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}
#sidebarPanel.open {
    transform: translateX(0);
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.18);
}

/* =======================================
   MAP AREA (Cesium)
======================================= */
.map-wrapper {
    position: relative;
    flex: 1;
    overflow: hidden;
}
#cesiumContainer {
    position: absolute;
    inset: 0; /* full cover parent */
    width: 100%;
    height: 100%;
    display: block;
    z-index: 1; /* di bawah UI mengambang */
}

/* =======================================
   OVERLAY (untuk tutup sidebar di mobile)
======================================= */
#overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.3);
    z-index: 1400;
}
#overlay.active {
    display: block;
}

/* =======================================
   CTA / TOGGLE LIST BUTTONS (floating)
======================================= */
.toggle-buttons {
    position: absolute;
    top: 24px;
    left: 64px; /* beri ruang dari tombol â˜° */
    z-index: 1200;
    background: rgba(255, 255, 255, 0.75);
    backdrop-filter: blur(8px);
    padding: 10px 12px;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.18);
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.toggle-buttons button {
    appearance: none;
    border: none;
    cursor: pointer;
    padding: 8px 12px;
    font-weight: 700;
    border-radius: 10px;
    background: #fff;
}
.toggle-buttons button:hover {
    background: #e5e7eb;
}

/* =======================================
   FLOATING TABLE PANELS
======================================= */
.floating-panel {
    position: absolute;
    z-index: 1100;
    background: #ffffffcc;
    backdrop-filter: blur(6px);
    padding: 12px;
    border-radius: 12px;
    border: 1px solid #e5e7eb;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
    max-height: 40vh;
    overflow: auto;
    width: 560px;
    display: none; /* default tersembunyi */
}
#table-bangunan-container {
    bottom: 72px;
    left: 12px;
}
#table-persil-container {
    bottom: 72px;
    right: 12px;
}

/* Table style */
table {
    width: 100%;
    border-collapse: collapse;
}
thead th {
    background: #f3f4f6;
    padding: 6px 8px;
    text-align: left;
    border-bottom: 1px solid #e5e7eb;
    position: sticky;
    top: 0;
    z-index: 1;
}
tbody td {
    padding: 6px 8px;
    border-bottom: 1px solid #eee;
}
tbody tr:hover {
    background: #fef9c3;
    cursor: pointer;
}

/* =======================================
   POPUP INFO CARD
======================================= */
#popup-info {
    position: absolute;
    top: 80px;
    right: 20px;
    width: 360px;
    max-width: 92vw;
    background: #fff;
    border-radius: 16px;
    border: 1px solid #e5e7eb;
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.22);
    z-index: 1300;
    padding: 16px;
    display: none;
    max-height: 80vh;
    overflow: auto;
}
.popup-card h2 {
    font-size: 18px;
    margin: 0 0 10px;
    font-weight: 700;
}
.popup-card table {
    width: 100%;
    font-size: 14px;
    line-height: 1.6;
    margin-bottom: 12px;
}
.popup-card table td:first-child {
    font-weight: 700;
    width: 120px;
    color: #374151;
}
.popup-card img {
    width: 100%;
    border-radius: 8px;
    border: 1px solid #e5e7eb;
}

/* =======================================
   HERO (untuk index)
======================================= */
.hero-section {
    flex: 1;
    margin-top: 10px;
    padding: 80px;
    color: #fff;
}
.hero-section h1 {
    font-size: 38px;
    line-height: 1.25;
    margin-bottom: 10px;
}
.hero-section .tagline {
    font-size: 18px;
    font-style: italic;
    margin-bottom: 20px;
    color: #f0f0f0;
}
.hero-section .cta {
    display: inline-block;
    background: #fff;
    color: #0a2a66;
    padding: 10px 20px;
    font-weight: 700;
    border-radius: 8px;
}
.hero-section .cta:hover {
    background: #e5e7eb;
    color: #111;
}
.info-boxes {
    display: flex;
    gap: 20px;
    margin-top: 40px;
    flex-wrap: wrap;
}
.info-card {
    width: 160px;
    text-align: center;
    padding: 16px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(6px);
}
.info-card img {
    width: 42px;
    margin-bottom: 10px;
}
.info-card p {
    color: #fff;
    font-size: 14px;
}

/* =======================================
   FOOTER
======================================= */
.footer {
    position: absolute;
    inset-inline: 0;
    bottom: 0;
    font-family: inherit;
    line-height: 0.7;
}

/* Background gradasi dengan animasi */
.footer-text {
    background: linear-gradient(270deg, #002563, #426db7, #002563);
    background-size: 600% 600%;
    animation: gradientMove 7s ease infinite;
    color: #fff;
    text-align: center;
    padding: 10px 0;
    font-size: 0.95rem;
    font-weight: 500;
    letter-spacing: 0.5px;
    box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.1);
    z-index: 9999999;
}

/* Efek animasi gradasi */
@keyframes gradientMove {
    0% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
    100% {
        background-position: 0% 50%;
    }
}

/* Link di footer */
.footer-text a {
    color: #fffb;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.3s ease;
}
.footer-text a:hover {
    color: #fff;
    text-shadow: 0 0 8px rgba(255, 255, 255, 0.8);
}

/* =======================================
   HAMBURGER (â˜°) â€” tombol toggle sidebar
======================================= */
#toggleSidebar {
    position: absolute;
    top: 12px;
    left: 12px;
    z-index: 2001; /* di atas overlay dan canvas */
    background: #ffffffdd;
    border: 1px solid #d1d5db;
    padding: 8px 12px;
    font-size: 20px;
    border-radius: 10px;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.18);
    display: none; /* tampilkan di mobile */
}

/* =======================================
   THEME OVERRIDES (opsional halaman map)
======================================= */
.page-map .sidebar .menu a,
.page-map .sidebar .menu span,
.page-map .sidebar .logo h2 {
    color: #111 !important;
}
.page-map .sidebar .logo p {
    color: #6b7280 !important;
}
.page-map .sidebar .menu a.active {
    background: rgba(0, 0, 0, 0.08) !important;
    color: #111 !important;
    box-shadow: inset 0 0 0 2px #111 !important;
}
.page-map .sidebar .menu a:hover {
    background: rgba(0, 0, 0, 0.06) !important;
}

/* =======================================
   RESPONSIVE
======================================= */
@media (max-width: 1200px) {
    .hero-section {
        padding: 64px;
    }
}
@media (max-width: 1024px) {
    #sidebar-container {
        width: 280px;
        min-width: 260px;
    }
    .hero-section {
        padding: 48px;
    }
}
@media (max-width: 768px) {
    /* Sidebar jadi slide-in */
    #sidebar-container {
        position: fixed;
        top: 0;
        left: 0;
        height: 100vh;
        width: 85vw;
        max-width: 320px;
        transform: translateX(-100%);
        transition: transform 0.28s ease-in-out;
        background: #ffffffcc;
        border-right: 1px solid #e5e7eb;
        box-shadow: 4px 0 12px rgba(0, 0, 0, 0.15);
        z-index: 1500;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }
    #sidebar-container.open {
        transform: translateX(0);
    }
    #sidebar-container .close-sidebar-btn {
        display: block;
    }

    /* Tampilkan tombol â˜° */
    #toggleSidebar {
        display: block;
    }

    /* Pindahkan panel tombol agar tidak tabrakan dengan â˜° */
    .toggle-buttons {
        top: 60px;
        left: 12px;
    }

    /* Panel tabel responsif */
    .floating-panel {
        width: 92%;
        left: 4%;
        right: auto;
        bottom: 72px;
        max-width: 680px;
        -webkit-overflow-scrolling: touch;
        overflow-x: auto;
    }

    /* Popup menyesuaikan layar kecil */
    #popup-info {
        right: 4%;
        width: 92%;
        top: 64px;
    }

    /* Index hero padding lebih kecil */
    .hero-section {
        padding: 28px;
    }
}

/* =======================================
   ACCESSIBILITY & MOTION
======================================= */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* =======================================
   HELPER (utilitas kecil)
======================================= */
.hidden {
    display: none !important;
}
.block {
    display: block !important;
}

/* Preloader */
.preloader {
    position: fixed;
    inset: 0;
    background: #fff;
    z-index: 3000;
    display: grid;
    place-items: center;
    transition: opacity 0.4s ease;
}
.preloader.fade-out {
    opacity: 0;
    pointer-events: none;
}
.preloader-inner {
    text-align: center;
}
.preloader img {
    width: 96px;
    height: auto;
    margin-bottom: 10px;
}
.preloader .brand {
    font-weight: 800;
    color: #002563;
    margin-bottom: 6px;
}
.progress-text {
    font-weight: 700;
    color: #002563;
    margin-top: 6px;
}
.progress-bar {
    width: 240px;
    height: 8px;
    background: #7e8197;
    border-radius: 9999px;
    overflow: hidden;
    margin: 8px auto 0;
}
.progress-bar span {
    display: block;
    height: 100%;
    width: 0%;
    background: #002563;
    transition: width 0.2s ease;
}

/* ===== Footer selalu di bawah untuk halaman index ===== */
body.page-index {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}
.page-index .container {
    flex: 1;
    height: auto;
}
.page-index .footer {
    position: static !important;
}

/* ===== Desktop (>=769px): jarak judul & CTA ===== */
@media (min-width: 769px) {
    .page-index .hero-section h1 {
        margin-bottom: 14px;
    }
    .page-index .hero-section .cta {
        margin-top: 12px;
    }
}

/* ===== Mobile (<=768px): kontras teks + info card rapi ===== */
@media (max-width: 768px) {
    /* Tombol ☰ fixed agar tidak menutupi teks */
    #toggleSidebar {
        position: fixed;
        top: 12px;
        left: 12px;
        z-index: 2001;
    }

    /* Ruang atas untuk tombol ☰ */
    .page-index .hero-section {
        padding: 16px;
        padding-top: 88px;
        color: #fff;
    }

    /* Kartu blur gelap di belakang teks hero */
    .page-index .hero-section .hero-content {
        background: rgba(5, 20, 60, 0.45);
        backdrop-filter: blur(8px);
        -webkit-backdrop-filter: blur(8px);
        border: 1px solid rgba(255, 255, 255, 0.18);
        border-radius: 16px;
        padding: 14px 16px;
    }

    .page-index .hero-section h1 {
        font-size: 24px;
        line-height: 1.22;
        margin-bottom: 10px;
        letter-spacing: 0.2px;
        text-wrap: balance;
        text-shadow: 0 2px 6px rgba(0, 0, 0, 0.35);
    }
    .page-index .hero-section .tagline {
        font-size: 13px;
        margin-bottom: 10px;
        opacity: 0.95;
        text-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
    }
    .page-index .hero-section p {
        font-size: 14px;
        margin-bottom: 10px;
        text-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
    }
    .page-index .hero-section .cta {
        display: inline-block;
        padding: 10px 16px;
        font-size: 14px;
        border-radius: 10px;
        margin-top: 4px;
    }

    /* Info boxes jadi grid 2 kolom, kartu seragam */
    .page-index .info-boxes {
        display: grid !important;
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
        margin-top: 14px;
    }
    .page-index .info-card {
        width: 100% !important;
        min-height: 74px;
        display: flex;
        align-items: center;
        gap: 12px;
        background: #ffffffee !important;
        color: #111 !important;
        padding: 12px 14px;
        border: 1px solid #e5e7eb;
        border-radius: 14px;
        box-shadow: 0 6px 16px rgba(0, 0, 0, 0.08);
    }
    /* Tambahkan latar warna di belakang ikon agar ikon putih terlihat */
    .page-index .info-card img {
        width: 32px;
        height: 32px;
        margin: 0;
        background: #0a2a66; /* biru gelap senada desktop */
        padding: 6px;
        border-radius: 10px;
        box-shadow: 0 2px 6px rgba(0, 0, 0, 0.18);
    }
    .page-index .info-card p {
        margin: 0;
        font-size: 13px;
        color: #111 !important;
    }

    .page-index .hero-section {
        padding-bottom: 22px;
    }
}
