/* 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;
    /* Kunci: Sembunyikan total agar tidak terbuka bersama Kesiswaan */
    display: none; 
    opacity: 0;
    transform: translateX(10px);
    transition: opacity 0.3s ease, transform 0.3s ease;
}

/* Tampilkan sub-menu HANYA saat mouse menyentuh item Ekstrakurikuler */
.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); }

/* ================= 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; }

/* ================= RESPONSIVE (LAYAR KECIL / HP) ================= */
@media screen and (max-width: 992px) {
    /* 1. Kunci Utama: Mematikan geser kanan (horizontal scroll) */
    html, body {
        overflow-x: hidden;
        width: 100%;
        max-width: 100vw;
    }

    .container {
        width: 95%; /* Memaksimalkan lebar layar */
    }

    /* 2. Merapikan Navbar agar turun ke bawah */
    .nav-container { 
        flex-direction: column; 
        gap: 10px; 
        padding: 10px 0;
    }
    
    .nav-links { 
        flex-direction: column; /* Menu berbaris rapi ke bawah */
        width: 100%;
        gap: 10px; 
    }

    .nav-links li {
        width: 100%;
        text-align: center;
    }

    /* 3. Mencegah Dropdown dan Sub-menu meluber keluar layar HP */
    .dropdown-menu, .submenu {
        position: static; /* Hilangkan efek melayang di HP */
        width: 100%;
        box-shadow: none;
        border: 1px solid #eee;
        display: none; /* Sembunyikan default */
    }

    .nav-links li.dropdown-parent:hover .dropdown-menu {
        display: block; /* Muncul ke bawah saat disentuh di HP */
    }
    
    .submenu-parent:hover > .submenu {
        display: block;
    }

    /* 4. Penyesuaian Konten Lainnya */
    .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; /* Paksa teks panjang turun ke bawah */
        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;
    }

    /* Penyesuaian Berita */
    .news-layout-wrapper { grid-template-columns: 1fr; } /* 1 Kolom penuh */
    .news-sidebar-left, .news-sidebar-right { display: none; }
}