/* =========================================
   1. GLOBAL & RESET
   ========================================= */
body {
    font-family: 'Plus Jakarta Sans', sans-serif;
    color: #2d3436;
    margin: 0;
    padding: 0;
}

.bg-primary {
    background-color: #0d6efd !important;
}

/* =========================================
   2. PAGE HEADER
   ========================================= */
.page-header {
    position: relative;
    height: 38vh;
    min-height: 260px;
    max-height: 420px;
    margin: -2rem 0 3rem 0 !important; /* margin-top ditambah */
    padding-top: 1rem; /* tambahan padding-top untuk memberi jarak dari navbar */
    background: linear-gradient(135deg, #0d6efd 0%, #0046b5 100%);
    border-radius: 0 0 2rem 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}


.page-header .container {
    position: relative;
    z-index: 2;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.page-header .header-image {
    max-width: 90%;
    max-height: 85%;
    width: auto;
    height: auto;
    object-fit: contain;
}

.page-header .header-overlay {
    position: absolute;
    inset: 0;
    z-index: 1;
    pointer-events: none;
    background:
        radial-gradient(circle at 20% 30%, rgba(255,255,255,0.15) 0 2px, transparent 3px),
        radial-gradient(circle at 80% 70%, rgba(255,255,255,0.12) 0 2px, transparent 3px),
        linear-gradient(120deg, rgba(255,255,255,0.08) 25%, transparent 25%, transparent 50%, rgba(255,255,255,0.08) 50%, rgba(255,255,255,0.08) 75%, transparent 75%);
    background-size: 40px 40px, 40px 40px, 120px 120px;
    opacity: 0.35;
}

/* Header Animation */
@keyframes fadeInDown {
    from { opacity: 0; transform: translateY(-20px); }
    to { opacity: 1; transform: translateY(0); }
}

.page-header h1 {
    animation: fadeInDown 0.8s ease-out;
}

/* =========================================
   3. NAVBAR & UTILITIES
   ========================================= */
.navbar {
    margin-bottom: 0 !important;
    border-bottom: none !important;
    box-shadow: none !important;
}
.navbar-nav .nav-item {
    position: relative !important;
}
.submenu-artikel {
    left: 0 !important;  /* Luruskan ke sisi kiri menu induk */
    right: auto !important;
    top: 125% !important; /* Tepat di bawah menu */
    transform: none !important; /* Mencegah pergeseran lain */
}
@media (max-width: 991.98px) {
    .submenu-artikel {
        position: relative !important; /* Kembali ke posisi normal di mobile */
        left: 0 !important;
        box-shadow: none !important;
        padding-left: 1rem !important;
    }
}

.navbar::before, .navbar::after {
    content: none !important;
    display: none !important;
}

.hover-lift {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.hover-lift:hover {
    transform: translateY(-8px);
    box-shadow: 0 1rem 3rem rgba(0,0,0,.1) !important;
}

/* =========================================
   4. MAP & FILTER
   ========================================= */
#mapTulungagung {
    z-index: 1;
    background: #f1f3f5;
}

/* =========================================
   4. MAP & FILTER (PREMIUM ANIMATION)
   ========================================= */

/* 1. Definisi Gerakan Halus (Floating) */
@keyframes softFloat {
    0% { transform: translateX(0); }
    50% { transform: translateX(5px); } /* Bergeser pelan ke kanan */
    100% { transform: translateX(0); }
}

.filter-btn {
    position: relative;
    border: 1px solid rgba(0,0,0,0.08) !important;
    background: #ffffff !important;
    color: #4b5563 !important;
    font-size: 0.95rem;
    font-weight: 600;
    border-radius: 14px;
    padding: 1rem 1.2rem !important;
    
    display: flex !important;
    align-items: center !important;
    justify-content: flex-start !important;
    text-align: left !important;
    width: 100%;
    
    /* Transisi dasar dibuat sangat panjang (0.8s) agar perubahan terasa "cair" */
    transition: all 0.8s cubic-bezier(0.2, 1, 0.2, 1);
    z-index: 1;
    overflow: hidden;
}

/* 2. Efek Hover: Menjalankan Animasi */
.filter-btn:hover {
    /* Menggunakan animasi softFloat saat di-hover */
    animation: softFloat 2s infinite ease-in-out; 
    border-color: rgba(0,0,0,0.1) !important;
    box-shadow: 0 10px 25px rgba(0,0,0,0.05);
    color: #000 !important;
}

/* 3. Layer Warna Menyapu (Lebih Lembut) */
.filter-btn::before {
    content: "";
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    /* Transisi warna dibuat lebih lambat dari gerakan tombol */
    transition: all 0.9s cubic-bezier(0.2, 1, 0.2, 1);
    z-index: -1;
    opacity: 0;
}

/* Warna Hover per kategori */
.filter-btn[data-filter="Bahaya"]:hover::before { background: #fee2e2; left: 0; opacity: 1; }
.filter-btn[data-filter="Waspada"]:hover::before { background: #fef3c7; left: 0; opacity: 1; }
.filter-btn[data-filter="Siaga"]:hover::before { background: #d1fae5; left: 0; opacity: 1; }
.filter-btn[data-filter="Aman"]:hover::before { background: #e0f2fe; left: 0; opacity: 1; }
.filter-btn[data-filter="all"]:hover::before { background: #f3f4f6; left: 0; opacity: 1; }

/* 4. Gerakan Ikon & Teks yang Mengikuti */
.filter-btn i {
    width: 25px;
    margin-right: 12px;
    display: flex;
    justify-content: center;
    font-size: 1.1rem;
    /* Ikon bergerak lebih lambat dari tombolnya */
    transition: all 1s cubic-bezier(0.2, 1, 0.2, 1);
}

.filter-btn:hover i {
    transform: scale(1.1) rotate(5deg);
}

.filter-btn span {
    transition: all 0.8s cubic-bezier(0.2, 1, 0.2, 1);
}

/* State Aktif */
.filter-btn.active {
    border-left: 5px solid #0d6efd !important;
    background: #f0f7ff !important;
    color: #0d6efd !important;
    box-shadow: 0 5px 15px rgba(13, 110, 253, 0.1);
}

/* =========================================
   5. TABLE STYLING
   ========================================= */
.kecamatan-section {
    background: #ffffff;
    padding: 3rem 0;
    margin-bottom: -1rem;
    min-height: 420px;
}


/* Pastikan tabel memiliki layout tetap agar tidak goyang saat filter */
#tabelKerawanan {
    table-layout: fixed !important; /* WAJIB: Mengunci lebar kolom berdasarkan header */
    width: 100%;
    border-collapse: collapse;
}

#tabelKerawanan th {
    text-align: center !important;
    vertical-align: middle;
    background: #f8f9fa;
    /* Mencegah teks judul tabel turun ke bawah jika layar mengecil */
    white-space: nowrap; 
}

#tabelKerawanan td {
    text-align: center !important;
    vertical-align: middle;
    /* Menjaga agar konten yang terlalu panjang tidak merusak lebar kolom */
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    padding: 1rem 0.5rem;
}

#tabelKerawanan tr {
    display: table-row !important;
}

#tabelKerawanan tr[style*="display: none"] {
    display: none !important;
}

.table thead th {
    font-weight: 700;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.5px;
    color: #636e72;
    position: sticky;
    top: 0;
    background: #f8f9fa;
    z-index: 2;
    border-top: none;
}

.table-fixed-scroll {
    max-height: 600px;
    overflow-y: auto;
}

.table thead th {
    font-weight: 700;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.5px;
    color: #636e72;
    position: sticky;
    top: 0;
    background: #f8f9fa;
    z-index: 2;
    border-top: none;
}

/* Custom Scrollbar */
.table-fixed-scroll::-webkit-scrollbar { width: 6px; }
.table-fixed-scroll::-webkit-scrollbar-track { background: #f1f1f1; }
.table-fixed-scroll::-webkit-scrollbar-thumb { background: #ccc; border-radius: 10px; }

/* =========================================
   6. STATUS BADGES
   ========================================= */
.status-badge {
    display: inline-block;
    padding: 0.4rem 1rem;
    font-weight: 700;
    font-size: 0.75rem;
    border-radius: 50px;
    text-transform: uppercase;
}

.status-bahaya { background-color: #fee2e2; color: #dc3545; }
.status-waspada { background-color: #fef3c7; color: #92400e; }
.status-siaga { background-color: #d1fae5; color: #065f46; }
.status-aman { background-color: #e0f2fe; color: #0369a1; }

/* =========================================
   7. PROFIL DESA SECTION
   ========================================= */
.profil-desa-section {
    position: relative;
    padding: 9rem 0 8rem;
    overflow: hidden;
    background-color: #f1f5f9;
    background-image:
        linear-gradient(135deg, rgba(13,110,253,.06) 25%, transparent 25%),
        linear-gradient(225deg, rgba(13,110,253,.06) 25%, transparent 25%),
        linear-gradient(45deg, rgba(13,110,253,.04) 25%, transparent 25%),
        linear-gradient(315deg, rgba(13,110,253,.04) 25%, transparent 25%);
    background-size: 80px 80px;
    background-position: 0 0, 0 40px, 40px -40px, -40px 0;
    margin-bottom: -3rem;
}

/* Noise Texture */
.profil-desa-section::before {
    content: "";
    position: absolute;
    inset: 0;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='120' height='120' filter='url(%23n)' opacity='0.035'/%3E%3C/svg%3E");
    pointer-events: none;
    z-index: 0;
}

/* Section Gradients (Fades) */
.profil-desa-section::after {
    content: "";
    position: absolute;
    top: 0; left: 0; width: 100%; height: 180px;
    background: linear-gradient(to bottom, #ffffff 0%, rgba(255,255,255,.75) 35%, transparent 100%);
    z-index: 1;
}

.profil-desa-section .fade-bottom {
    position: absolute;
    bottom: 0; left: 0; width: 100%; height: 200px;
    background: linear-gradient(to top, #ffffff 0%, rgba(255,255,255,.75) 40%, transparent 100%);
    z-index: 1;
}

.profil-desa-section .container {
    position: relative;
    z-index: 2;
}

/* Section Header */
.section-badge {
    display: inline-block;
    background: linear-gradient(135deg, #0d6efd, #2563eb);
    color: #fff;
    font-size: .7rem;
    font-weight: 700;
    letter-spacing: .6px;
    padding: .45rem 1.1rem;
    border-radius: 999px;
    margin-bottom: .6rem;
    box-shadow: 0 10px 25px rgba(13,110,253,.35);
}

.profil-desa-section h2 { color: #0f172a; }
.profil-desa-section p { color: #475569; }

/* =========================================
   8. CARDS & MODALS
   ========================================= */
.desa-card {
    height: 100%;
    background: #ffffff;
    border-radius: 22px;
    overflow: hidden;
    box-shadow: 0 18px 45px rgba(0,0,0,.1);
    transition: all .35s ease;
}

.desa-card:hover {
    transform: translateY(-14px);
    box-shadow: 0 35px 70px rgba(0,0,0,.18);
}

.desa-image {
    position: relative;
    height: 200px;
    overflow: hidden;
}

.desa-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform .5s ease;
}

.desa-card:hover .desa-image img {
    transform: scale(1.12);
}

.desa-image::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(0,0,0,.5), transparent 65%);
}

.desa-kecamatan {
    position: absolute;
    bottom: 14px;
    left: 14px;
    background: rgba(255,255,255,.92);
    color: #0d6efd;
    font-size: .65rem;
    font-weight: 700;
    padding: .45rem .9rem;
    border-radius: 999px;
    backdrop-filter: blur(6px);
    z-index: 2;
}

.desa-content {
    padding: 1.4rem 1.6rem 1.7rem;
    display: flex;
    flex-direction: column;
}

.desa-title {
    font-size: .9rem;
    font-weight: 700;
    color: #1e293b;
    margin-bottom: .4rem;
}

.desa-desc {
    font-size: .78rem;
    line-height: 1.6;
    color: #64748b;
    margin-bottom: 1.1rem;
    flex-grow: 1;
}

.desa-content .btn {
    font-size: .72rem;
    font-weight: 600;
    padding: .45rem 1rem;
}

.modal-content {
    box-shadow: 0 2rem 5rem rgba(0,0,0,0.2);
}

/* =========================================
   9. RESPONSIVE MEDIA QUERIES
   ========================================= */
@media (max-width: 768px) {
    .page-header {
        height: 28vh;
        min-height: 200px;
        max-height: 320px;
    }

    .page-header .header-image {
        max-width: 95%;
        max-height: 80%;
    }
}

.article-content p {
    margin-bottom: 1rem;
}

.article-content ul,
.article-content ol {
    padding-left: 1.2rem;
    margin-bottom: 1rem;
}

.article-content li {
    margin-bottom: 0.4rem;
}

.article-content strong {
    font-weight: 600;
}
