/* =========================================
   1. VARIABLES & RESET
   ========================================= */
   :root {
    --primary-color: #1a472a;    /* Hijau Tua Desa */
    --secondary-color: #0d3b1f;  /* Hijau Lebih Gelap */
    --accent-color: #ffd700;     /* Kuning Emas */
    --bg-light: #e8f3fd;         /* Background Halaman */
    --text-dark: #333;
    --text-muted: #666;
    --card-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    height: 100%;
}

body {
    font-family: Arial, sans-serif;
    background: var(--bg-light);
    color: var(--text-dark);
    line-height: 1.6;
    height: 100%;
}

/* =========================================
   2. HEADER & NAVIGATION
   ========================================= */
.header {
    background: var(--primary-color);
    color: white;
    padding: 10px 0;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 1030;
    transition: transform 0.3s ease-in-out;
}

.header-hidden {
    transform: translateY(-100%);
    box-shadow: none;
}

.logo-wrapper {
    padding: 15px 20px !important;
}

.header h1 {
    font-size: 26px;
    font-weight: 600;
    color: white;
    margin: 0;
}

.subtitle {
    color: #d4d4d4;
    font-size: 14px;
    margin-top: 8px;
}

/* Navbar */
.navbar {
    padding: 0;
    margin-top: 10px;
}

.navbar-nav {
    padding: 5px 0;
}

.nav-link {
    color: #ffffff !important;
    font-size: 14px;
    padding: 12px 20px !important;
    transition: all 0.3s ease;
}

.nav-link:hover {
    background: var(--secondary-color) !important;
    color: var(--accent-color) !important;
    border-radius: 7px;
}

.navbar-toggler {
    border: none !important;
    padding: 8px 12px;
    transition: all 0.3s ease;
    border-radius: 8px;
    outline: none !important;
}

.navbar-toggler:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: scale(1.05);
}

/* =========================================
   3. MAIN LAYOUT & SECTIONS
   ========================================= */
main.container {
    padding: 40px 30px !important;
    max-width: 1200px;
    margin-top: 180px; /* Spacer untuk fixed header */
}

section {
    scroll-margin-top: 160px; /* Jarak scroll agar tidak tertutup header */
}

.section-title {
    font-size: 22px;
    font-weight: 600;
    color: var(--primary-color);
    margin-bottom: 25px;
    padding-bottom: 12px;
    border-bottom: 3px solid var(--primary-color);
    display: inline-block;
}

.row {
    margin-bottom: 30px;
}

/* =========================================
   4. COMPONENTS: CARDS
   ========================================= */
.card {
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    background: white;
    margin-bottom: 20px;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.card:hover {
    transform: translateY(-6px);
    box-shadow: var(--card-shadow);
}

.card-body {
    padding: 25px;
    box-shadow: 0 2px 5px #b1aeae;
}

.card-header {
    font-weight: 600;
    font-size: 15px;
    padding: 15px 25px;
    border-radius: 8px 8px 0 0 !important;
}

.card-title, 
.card-title a {
    color: var(--primary-color);
    font-weight: 600;
    font-size: 16px;
    margin-bottom: 15px;
    text-decoration: none;
}

.card-text {
    color: #555;
    font-size: 15px;
    line-height: 1.8;
}

/* Stats Cards */
.stats-card {
    cursor: pointer;
}

.stats-card .card-body {
    padding: 35px 20px;
}

.stat-icon {
    font-size: 2.5rem;
    margin-bottom: 15px;
}

.stat-number {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary-color);
    margin: 10px 0;
}

.stat-label {
    color: var(--text-muted);
    font-size: 14px;
    margin-top: 5px;
}

/* Lembaga Grid Items */
.lembaga-item {
    padding: 25px 15px;
    border: 1px solid #e8e8e8;
    border-radius: 8px;
    background: #fafafa;
    transition: all 0.2s ease;
    height: 100%;
}

.lembaga-item:hover {
    background: #f0f0f0;
    border-color: #d0d0d0;
}

.lembaga-item i {
    font-size: 2.5rem;
    margin-bottom: 12px;
}

.lembaga-item h6 {
    font-weight: 600;
    color: var(--primary-color);
    margin-top: 10px;
}

.list-unstyled li {
    padding: 8px 0;
}

/* =========================================
   5. COMPONENTS: POTENSI DESA (Grid Images & Video)
   ========================================= */
.card-potensi-grid {
    border-radius: 15px;
    height: 250px;
    position: relative;
    overflow: hidden;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    background-color: #333; /* Warna dasar jika video loading */
}

.card-potensi-grid:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0,0,0,0.2);
}

/* --- LOGIKA VIDEO BACKGROUND --- */
.card-potensi-grid video.bg-video {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover; /* Video akan mengisi kotak tanpa gepeng */
    z-index: 0; /* Posisi di paling belakang */
}

/* Konten Teks (Harus di atas video) */
.potensi-content {
    background: rgba(0, 0, 0, 0.3); /* Overlay gelap agar teks terbaca */
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    color: white;
    text-align: center;
    padding: 20px;
    transition: background 0.3s;
    text-shadow: 1px 1px 3px rgba(0,0,0,0.8);
    
    /* PENTING: Agar teks berada di ATAS video */
    position: relative; 
    z-index: 1; 
}

.card-potensi-grid:hover .potensi-content {
    background: rgba(0, 0, 0, 0.6);
    color: var(--accent-color);
}

/* --- BACKGROUND IMAGE (Untuk yang bukan Video) --- */
.bg-potensi-3 { 
    background-image: url('https://images.unsplash.com/photo-1545468860-71b585c83288?q=80&w=1000&auto=format&fit=crop'); 
    background-size: cover;
    background-position: center;
}

.bg-potensi-4 { 
    background-image: url('https://images.unsplash.com/photo-1472851294608-41524b43640b?q=80&w=1000&auto=format&fit=crop'); 
    background-size: cover;
    background-position: center;
}

/* =========================================
   6. COMPONENTS: MODALS
   ========================================= */
.custom-modal-overlay {
    display: none;
    position: fixed;
    z-index: 9999;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.6);
    backdrop-filter: blur(4px);
    align-items: center;
    justify-content: center;
}

.custom-modal-content {
    background-color: white;
    padding: 30px;
    border-radius: 12px;
    width: 90%;
    max-width: 380px;
    box-shadow: 0 15px 30px rgba(0,0,0,0.3);
    position: relative;
    animation: popIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

/* Modifier: Modal Lebar (Sejarah) */
.custom-modal-content.wide-modal {
    max-width: 800px !important;
    width: 95%; /* Agar tetap rapi di layar HP kecil */
}

@keyframes popIn {
    from { transform: scale(0.8); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

.custom-close-btn {
    position: absolute;
    top: 10px;
    right: 15px;
    color: #aaa;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    line-height: 1;
    padding: 5px;
}

.custom-close-btn:hover { color: #dc3545; }

.modal-header-text {
    margin-top: 0;
    color: var(--primary-color);
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 15px;
}

/* Jaga Grid */
.jaga-section-title {
    margin: 20px 0 10px;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    text-align: center;
}

.jaga-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.jaga-box {
    background-color: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 10px;
    text-align: center;
    display: flex;
    flex-direction: column;
    transition: background 0.2s;
}

.jaga-box:hover {
    background-color: #e8f5e9;
    border-color: #c3e6cb;
}

.jaga-label {
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 600;
}

.jaga-value {
    font-size: 18px;
    font-weight: 700;
    color: var(--primary-color);
}

/* =========================================
   7. FOOTER & UTILITIES
   ========================================= */
.footer {
    background: var(--primary-color);
    color: white;
    padding: 20px 0;
    margin-top: auto;
}

.back-to-top {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 50px;
    height: 50px;
    background: var(--primary-color);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    text-decoration: none;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    z-index: 1000;
}

.back-to-top.show {
    opacity: 1;
    visibility: visible;
}

.back-to-top:hover {
    background: var(--secondary-color);
    transform: translateY(-3px);
    color: var(--accent-color);
}

/* =========================================
   8. RESPONSIVE MEDIA QUERIES
   ========================================= */
@media (max-width: 991px) {
    main.container {
        padding: 10px 20px !important;
        margin-top: 140px;
    }
    
    .navbar-collapse {
        background: rgba(13, 59, 31, 0.95);
        backdrop-filter: blur(10px);
        margin-top: 10px;
        border-radius: 13px;
        padding: 15px;
        box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
    }

    .nav-link:hover, .nav-link:active {
        background: rgba(255, 215, 0, 0.15) !important;
        color: var(--accent-color) !important;
        padding-left: 25px !important;
    }
}

@media (max-width: 768px) {
    .header h1 { font-size: 22px; }
    .subtitle { font-size: 13px; }
    .stat-number { font-size: 1.6rem; }
    .section-title { font-size: 18px; }
}

@media (max-width: 576px) {
    main.container { padding: 20px 12px !important; }
    .header h1 { font-size: 20px; }
    .stat-number { font-size: 1.4rem; }
}