/* Variabel Warna Utama */
:root {
    --primary-color: #006633; 
    --secondary-color: #F2A900; 
    --text-dark: #333333;
    --text-light: #ffffff;
    --bg-light: #f8fafc;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: 'Inter', sans-serif;
    color: var(--text-dark);
    line-height: 1.6;
    background-color: var(--bg-light);
}

.container {
    width: 90%;
    max-width: 1200px;
    margin: auto;
}

a { text-decoration: none; color: inherit; }
.text-center { text-align: center; }

/* ================= NAVBAR ================= */
.navbar {
    background-color: var(--primary-color);
    color: var(--text-light);
    padding: 1rem 0;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.nav-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-links {
    list-style: none;
    display: flex;
    gap: 1.5rem;
    align-items: center; 
}

.nav-links a {
    color: var(--text-light);
    font-weight: 600;
    transition: color 0.3s ease;
}

.nav-links a:hover, .nav-links a.active { color: var(--secondary-color); }

.nav-btn {
    padding: 8px 15px !important;
    border-radius: 5px;
    font-weight: 700 !important;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 5px;
    transition: all 0.3s ease !important;
}

.nav-btn.btn-eass { background-color: #ffffff; color: var(--primary-color) !important; border: 1px solid #ffffff; }
.nav-btn.btn-eass:hover { background-color: #e6f0eb; }

.nav-btn.btn-rdm { background-color: var(--secondary-color); color: #000 !important; border: 1px solid var(--secondary-color); }
.nav-btn.btn-rdm:hover { background-color: #d19200; }

/* ================= DROPDOWN MENU (KOTAK MENGAMBANG) ================= */

.nav-links li.dropdown-parent {
    position: relative;
    height: 100%;
    display: flex;
    align-items: center;
}

.dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    width: 220px;
    background-color: #ffffff;
    box-shadow: 0 10px 30px rgba(0,0,0,0.15);
    border-top: 4px solid var(--secondary-color);
    border-radius: 0 0 8px 8px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    padding: 10px 0;
    z-index: 999;
}

.nav-links li.dropdown-parent:hover > .dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-menu li {
    width: 100%;
    margin: 0;
    display: block;
    position: relative;
}

.dropdown-menu li a {
    display: block;
    color: #333 !important;
    padding: 10px 20px;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.2s;
    text-align: left;
    border-bottom: 1px solid #f0f0f0;
}

.dropdown-menu li:last-child a { border-bottom: none; }

.dropdown-menu li a:hover {
    background-color: #f9f9f9;
    color: var(--primary-color) !important;
    padding-left: 25px;
}

/* ================= NESTED DROPDOWN (SUB-MENU EKSKUL) ================= */

.submenu {
    position: absolute;
    left: 100%; 
    top: 0;
    width: 220px;
    background-color: #ffffff;
    box-shadow: 0 10px 30px rgba(0,0,0,0.15);
    border-left: 4px solid var(--secondary-color);
    border-radius: 0 8px 8px 8px;
    padding: 10px 0;
    list-style: none;
    z-index: 1001;
    display: none; 
    opacity: 0;
    transform: translateX(10px);
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.submenu-parent:hover > .submenu {
    display: block;
    opacity: 1;
    transform: translateX(0);
}

.submenu li a {
    display: block;
    color: #333 !important;
    padding: 10px 20px;
    font-size: 0.9rem;
    font-weight: 500;
    border-bottom: 1px solid #f0f0f0;
}

/* ================= HERO SECTION (BANNER UTAMA) ================= */
.hero {
    background: linear-gradient(rgba(0, 102, 51, 0.85), rgba(0, 0, 0, 0.7)), url('https://images.unsplash.com/photo-1523050854058-8df90110c9f1?ixlib=rb-4.0.3&auto=format&fit=crop&w=1350&q=80') center/cover;
    height: 25vh; 
    min-height: 250px; 
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-light);
    padding: 0;
}

.hero-container {
    display: grid;
    grid-template-columns: 250px 1fr 250px; 
    align-items: center; 
    width: 95%; 
    max-width: 1400px;
    margin: auto;
    height: 100%;
}

.hero-logo {
    grid-column: 1; 
    display: flex;
    align-items: center;
    justify-content: flex-start;
    height: 100%; 
}

.hero-logo img {
    max-height: 200px; 
    width: auto;
    object-fit: contain;
    filter: drop-shadow(0 5px 15px rgba(0,0,0,0.4)); 
    margin: 0;
    padding: 0;
}

.hero-text {
    grid-column: 2; 
    text-align: center; 
    display: flex;
    flex-direction: column;
    align-items: center; 
    justify-content: center;
}

.hero-text h2 {
    font-size: 2.8rem; 
    white-space: nowrap; 
    margin-bottom: 0.8rem;
    font-weight: 700;
    line-height: 1.2;
}

.hero-text p {
    font-size: 1.1rem;
    margin-bottom: 1.5rem;
    font-weight: 300;
}

.btn {
    display: inline-block;
    padding: 12px 30px;
    border-radius: 8px;
    font-weight: bold;
    transition: all 0.3s ease;
    cursor: pointer;
    border: none;
    font-size: 1rem;
}

.btn-primary { background-color: var(--secondary-color); color: var(--text-dark); }
.btn-primary:hover { background-color: #d19200; transform: translateY(-2px); }

/* ===================================================================== */
/* EFEK ANIMASI MODERN UNTUK JUDUL BANNER (DIPANGGIL DARI ADMIN)         */
/* ===================================================================== */

/* 1. Efek Cahaya Berjalan (Shine / Sweep) */
.effect-shine {
    color: transparent !important; 
    background: linear-gradient(to right, var(--secondary-color) 30%, #ffffff 50%, var(--secondary-color) 70%);
    background-size: 200% auto;
    -webkit-background-clip: text;
    background-clip: text;
    animation: anim-shine 3s linear infinite;
}
@keyframes anim-shine { 0% { background-position: 200% center; } 100% { background-position: -200% center; } }

/* 2. Efek Mengetik (Typewriter) */
.effect-typewriter {
    display: inline-block;
    overflow: hidden;
    white-space: nowrap;
    border-right: 4px solid var(--secondary-color);
    animation: anim-type 3.5s steps(40, end) infinite alternate, anim-blink .75s step-end infinite;
}
@keyframes anim-type { 0% { width: 0; } 80%, 100% { width: 100%; } }
@keyframes anim-blink { from, to { border-color: transparent } 50% { border-color: var(--secondary-color); } }

/* 3. Muncul dari Bawah (Fade-In Up) */
.effect-fade-up {
    animation: anim-fadeup 1.5s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}
@keyframes anim-fadeup { 0% { opacity: 0; transform: translateY(40px); } 100% { opacity: 1; transform: translateY(0); } }

/* 4. Fokus Sinematik (Blur to Focus) */
.effect-blur-focus {
    animation: anim-blurfocus 2s ease-out forwards;
}
@keyframes anim-blurfocus { 0% { opacity: 0; filter: blur(15px); transform: scale(1.05); } 100% { opacity: 1; filter: blur(0); transform: scale(1); } }

/* 5. Peregangan Huruf (Cinematic Spacing) */
.effect-spacing {
    animation: anim-spacing 2.5s cubic-bezier(0.25, 1, 0.5, 1) forwards;
}
@keyframes anim-spacing { 0% { opacity: 0; letter-spacing: 15px; } 100% { opacity: 1; letter-spacing: normal; } }

/* 6. Gradasi Mengalir Lambat (Flowing Gradient) */
.effect-gradient-flow {
    color: transparent !important; 
    background: linear-gradient(135deg, #ffffff 25%, var(--secondary-color) 50%, #ffffff 75%);
    background-size: 300% 300%;
    -webkit-background-clip: text;
    background-clip: text;
    animation: anim-gradient 6s ease-in-out infinite alternate;
}
@keyframes anim-gradient { 0% { background-position: 0% 50%; } 100% { background-position: 100% 50%; } }

/* ===================================================================== */

/* ================= STATISTIK ================= */
.stats {
    background-color: #fff;
    padding: 3rem 0;
    box-shadow: 0 4px 15px rgba(0,0,0,0.05);
    margin-top: 2rem; 
    border-radius: 10px;
}

.stats-container { display: flex; justify-content: space-around; text-align: center; flex-wrap: wrap; gap: 1rem; }
.stat-item h3 { font-size: 2.5rem; color: var(--primary-color); font-weight: 700; }

/* ================= HALAMAN LAIN ================= */
.about, .osis-section { padding: 5rem 0; background-color: var(--bg-light); }
.about-container { display: flex; align-items: center; gap: 4rem; }
.about-image { flex: 1; }
.about-image img { width: 100%; border-radius: 12px; box-shadow: 0 10px 30px rgba(0,0,0,0.1); }
.about-content { flex: 1; }
.about-content h2 { font-size: 2.2rem; color: var(--primary-color); margin-bottom: 1.5rem; }
.about-content p { margin-bottom: 2rem; font-size: 1.1rem; color: #555; }
.btn-outline { display: inline-block; padding: 12px 30px; border: 2px solid var(--primary-color); color: var(--primary-color); border-radius: 8px; font-weight: bold; transition: all 0.3s ease; }
.btn-outline:hover { background-color: var(--primary-color); color: var(--text-light); }

/* ================= BERITA ================= */
.news { padding: 4rem 0; background-color: #ffffff; }
.page-news { background-color: var(--bg-light); }

.section-header { display: flex; justify-content: space-between; align-items: flex-end; margin-bottom: 3rem; border-bottom: 2px solid #eee; padding-bottom: 1rem; }
.section-header.text-center { flex-direction: column; border-bottom: none; }
.section-header h2 { color: var(--primary-color); font-size: 2rem; }

.news-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 2rem; }
.news-card { background: #fff; border-radius: 10px; overflow: hidden; box-shadow: 0 4px 15px rgba(0,0,0,0.05); transition: transform 0.3s ease; }
.news-card:hover { transform: translateY(-5px); box-shadow: 0 8px 25px rgba(0,0,0,0.1); }
.news-body p { color: #666; font-size: 0.95rem; }
.news-date { display: block; font-size: 0.85rem; color: #888; margin-bottom: 0.5rem; }
.news-body h3 { font-size: 1.2rem; margin-bottom: 1rem; color: var(--text-dark); line-height: 1.4; }
.read-more { color: var(--primary-color); font-weight: 600; font-size: 0.95rem; }

/* ================= ATURAN UKURAN GAMBAR BERITA DARI ADMIN ================= */
.news-card img.size-kecil {
    height: 200px !important;
    width: auto !important;
    max-width: 100%;
    display: block;
    margin: 0 auto 15px auto !important; 
}

.news-card img.size-sedang { height: 350px !important; }
.news-card img.size-besar { height: 500px !important; }
.news-card img.size-original { height: auto !important; }

/* ================= LAYOUT BERITA FINAL ================= */
.news-layout-wrapper {
    display: grid;
    grid-template-columns: 30px 1fr 30px; 
    gap: 2rem; 
    width: 100%;
}

.news-main-content { width: 100%; }

/* Desain Pencarian */
.search-box-top {
    display: flex;
    justify-content: flex-start; 
    gap: 10px;
    margin-bottom: 3rem;
    max-width: 400px; 
}

.search-box-top input {
    flex: 1;
    padding: 12px 20px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-family: inherit;
    font-size: 1rem;
    outline: none;
}

.search-box-top button {
    background-color: var(--secondary-color);
    color: #000;
    padding: 12px 30px;
    border-radius: 8px;
    font-weight: bold;
    cursor: pointer;
    border: none;
}

/* ================= FOOTER ================= */
.footer { background-color: #1a1a1a; color: #cccccc; padding: 4rem 0 1rem; margin-top: 3rem; }
.footer-container { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 2rem; margin-bottom: 3rem; }
.footer-about { flex: 1; min-width: 300px; }
.footer-about h2 { color: var(--text-light); margin-bottom: 1rem; }
.footer-contact { flex: 1; min-width: 200px; }
.footer-contact h3 { color: var(--text-light); margin-bottom: 1rem; }
.footer-bottom { text-align: center; border-top: 1px solid #333; padding-top: 1.5rem; font-size: 0.9rem; }

/* =========================================
   PENGATURAN WARNA LINK & FOOTER
   ========================================= */
#modal-article-body a, .news-body a, .news-card a { color: #0056b3 !important; text-decoration: underline !important; font-weight: 600; transition: color 0.3s ease; }
#modal-article-body a:hover, .news-body a:hover, .news-card a:hover { color: #dc3545 !important; }
.footer-social a { color: white; text-decoration: none; font-size: 0.95rem; transition: all 0.3s ease; display: inline-block; }
.footer-social a:hover { color: var(--secondary-color); transform: translateX(5px); text-decoration: underline; }

/* ====================================================
   ANIMASI LOADING SPINNER (MELINGKAR)
   ==================================================== */
.loader-spinner {
    width: 45px; height: 45px; border: 5px solid #e6f0eb; border-top: 5px solid var(--primary-color); border-radius: 50%; animation: putarSpinner 1s linear infinite;
}
@keyframes putarSpinner { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }

/* =========================================================================
   SISTEM RESPONSIVE & PERBAIKAN DROPDOWN HP (SOLUSI FINAL)
   ========================================================================= */

/* --- LAYAR KECIL / HP (MAX 992PX) --- */
@media screen and (max-width: 992px) {
    html, body { overflow-x: hidden; width: 100%; max-width: 100vw; }
    .container { width: 100%; padding: 0 15px; }

    /* 1. Kunci Utama: Navbar menjadi patokan (Pondasi) untuk Dropdown */
    .navbar { position: relative; z-index: 999; }
    
    .nav-container { flex-direction: column; padding: 15px 0 0 0; align-items: flex-start; }
    .logo { padding: 0 15px 10px 15px; }

    /* 2. Menu Geser Horizontal */
    .nav-links { 
        display: flex !important;
        flex-direction: row; 
        flex-wrap: nowrap !important; 
        overflow-x: auto !important; 
        -webkit-overflow-scrolling: touch; 
        width: 100%; 
        padding: 0 15px 15px 15px; 
        margin: 0;
        gap: 1.5rem;
        justify-content: flex-start; 
        align-items: center;
        position: static; /* PENTING: Melepas ikatan scroll untuk dropdown */
    }

    .nav-links::-webkit-scrollbar { display: none; }
    .nav-links { -ms-overflow-style: none; scrollbar-width: none; }

    .nav-links li { width: auto; flex-shrink: 0; position: static; }
    .nav-links li a { display: inline-flex; align-items: center; white-space: nowrap; }

    .nav-links li.dropdown-parent { position: static; }

    /* 3. Tampilan Laci Menu (Dropdown) HP */
    .dropdown-menu {
        display: none !important; /* Wajib disembunyikan awalnya */
        position: absolute !important;
        top: 100% !important; /* Jatuh tepat di pinggir bawah border hijau navbar! */
        left: 0 !important;
        width: 100vw !important; 
        max-height: 65vh; /* Bisa di-scroll jika isinya banyak */
        overflow-y: auto;
        border-radius: 0 0 15px 15px !important;
        box-shadow: 0 10px 30px rgba(0,0,0,0.3) !important;
        transform: none !important;
        background-color: #ffffff !important;
        padding: 0 !important;
        margin: 0 !important;
        z-index: 1050 !important;
    }

    /* Pemicu Cerdas Buka/Tutup Menu Utama di HP via Javascript */
    .nav-links li.dropdown-parent.hp-active > .dropdown-menu {
        display: block !important;
    }

    .dropdown-menu li { width: 100% !important; display: block !important; position: relative !important;}
    
    .dropdown-menu li a {
        display: block !important;
        width: 100% !important;
        text-align: left !important; /* Rata Kiri dengan tegas */
        padding: 15px 25px !important;
        font-size: 1rem !important;
        color: #333 !important;
        border-bottom: 1px solid #eee !important;
        white-space: normal !important; /* Membiarkan teks turun baris jika kepanjangan */
    }

    /* 4. Sub-Menu Ekskul (Laci Anak) */
    .submenu {
        display: none !important; /* Mencegah Ekskul langsung terbuka berbarengan */
        position: relative !important; /* Turun ke bawah seperti laci bertingkat */
        top: 0 !important; 
        left: 0 !important;
        width: 100% !important;
        box-shadow: none !important;
        background-color: #f8fafc !important; /* Warna abu halus */
        border-radius: 0 !important;
        padding: 0 !important;
        margin: 0 !important;
        border-left: 4px solid var(--secondary-color) !important; /* Garis batas kuning */
        transform: none !important;
    }

    /* Pemicu Cerdas Buka/Tutup Sub-Menu Ekskul di HP via Javascript */
    .nav-links li.submenu-parent.hp-active-sub > .submenu {
        display: block !important;
    }
    
    .submenu li a {
        padding-left: 45px !important; /* Teks menjorok tajam ke dalam */
        font-size: 0.95rem !important;
        background: transparent !important;
        border-bottom: 1px solid #f0f0f0 !important;
    }

    /* 5. Penyesuaian Sisa Komponen di HP */
    .hero { height: auto; padding: 3rem 1rem; }
    .hero-container { display: flex; flex-direction: column; text-align: center; gap: 1.2rem; }
    .hero-logo img { height: 110px; }
    .hero-text h2 { font-size: 1.8rem; white-space: normal; word-wrap: break-word; }
    .stats-container, .about-container, .section-header, .footer-container { flex-direction: column; text-align: center; align-items: center; gap: 1.5rem; }
    .search-box-top { max-width: 100%; justify-content: center; }
    .news-layout-wrapper { grid-template-columns: 1fr; }
    .news-sidebar-left, .news-sidebar-right { display: none; }
    .map-section { padding: 40px 10px !important; }
    .map-wrapper iframe { height: 300px !important; }
    .map-section h2 { font-size: 1.5rem !important; }
}

/* --- LAYAR BESAR / PC / LAPTOP (MIN 993PX) --- */
@media screen and (min-width: 993px) {
    .nav-links {
        display: flex !important;
        flex-wrap: nowrap !important; 
        justify-content: center;
        overflow: visible !important; 
    }
    
    #navbar-container ul li a, .navbar ul li a, .nav-links li a {
        font-size: 0.85rem !important; 
        padding: 10px 5px !important; 
        white-space: nowrap;
    }
}
/* ====================================================
   PERBAIKAN FINAL GAMBAR DARI EDITOR (ANTI-JEBOL DI HP)
   ==================================================== */

/* 1. Kunci kotak pembungkus teks agar tidak bisa melar melebihi layar */
#modal-article-body, .news-body, .ql-editor, .halaman-konten, .article-content,
#modal-article-body p, .news-body p, .ql-editor p, .halaman-konten p, .article-content p {
    max-width: 100% !important;
    box-sizing: border-box !important;
    overflow-wrap: break-word !important;
    word-wrap: break-word !important;
}

/* 2. Aturan Standar Gambar */
#modal-article-body img, 
.news-body img, 
.ql-editor img,
.halaman-konten img,
.article-content img {
    max-width: 100% !important; 
    height: auto !important; 
    display: block !important; 
    margin: 20px auto !important; 
    border-radius: 8px !important; 
    box-shadow: 0 4px 10px rgba(0,0,0,0.05) !important; 
    box-sizing: border-box !important;
}

/* 3. Aturan Super Ketat Khusus Layar HP (Mobile) */
@media screen and (max-width: 768px) {
    #modal-article-body img, 
    .news-body img, 
    .ql-editor img,
    .halaman-konten img,
    .article-content img {
        /* KUNCI UTAMA: Paksa gambar mentok 100% dari lebar fisik layar HP, dikurangi jarak aman margin 40px */
        max-width: calc(100vw - 40px) !important; 
        width: auto !important;
    }
}