/* File: assets/css/style.css - Presisi Mobile & Anti-Overlap */

:root {
    --primary: #1a237e;
    --primary-light: #3949ab;
    --primary-dark: #0d1453;
    --secondary: #c62828;
    --secondary-light: #ef5350;
    --accent: #f9a825;
    --accent-light: #fdd835;
    --white: #ffffff;
    --light: #f8f9fa;
    --gray: #e0e0e0;
    --gray-dark: #757575;
    --dark: #212121;
    --success: #2e7d32;
    --info: #1565c0;
    --warning: #f57f17;
    --shadow: 0 2px 10px rgba(0,0,0,0.08);
    --shadow-lg: 0 5px 25px rgba(0,0,0,0.15);
    --transition: all 0.3s ease;
    --radius: 12px;
    --radius-sm: 8px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    overflow-x: hidden;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: var(--dark);
    background-color: var(--light);
    overflow-x: hidden;
}

a {
    text-decoration: none;
    color: inherit;
    transition: var(--transition);
}

img {
    max-width: 100%;
    height: auto;
}

/* NAVBAR */
.navbar {
    background: linear-gradient(135deg, var(--primary-dark), var(--primary));
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 10000;
    box-shadow: var(--shadow-lg);
}

.navbar-top {
    background: var(--secondary);
    padding: 6px 0;
    font-size: 0.8rem;
    color: var(--white);
}

.navbar-top .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

.navbar-top a {
    color: var(--white);
}

.navbar-main {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1200px;
    margin: 0 auto;
    padding: 10px 20px;
    position: relative;
}

.navbar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--white);
}

.navbar-brand img {
    height: 48px;
    width: auto;
}

.navbar-brand .brand-text h1 {
    font-size: 1.15rem;
    font-weight: 700;
    margin: 0;
    line-height: 1.2;
}

.navbar-brand .brand-text small {
    font-size: 0.82rem;
    color: var(--accent-light);
    font-weight: 600;
    display: block;
}

.navbar-nav {
    display: flex;
    list-style: none;
    gap: 5px;
    align-items: center;
}

.navbar-nav li {
    position: relative;
}

.navbar-nav a {
    color: var(--white);
    padding: 8px 14px;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-weight: 500;
    display: block;
}

.navbar-nav a:hover,
.navbar-nav a.active {
    background: rgba(255,255,255,0.15);
    color: var(--accent-light);
}

/* DROPDOWN DESKTOP */
.dropdown-menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    background: var(--white);
    min-width: 220px;
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-lg);
    z-index: 100;
    overflow: hidden;
}

@media (min-width: 769px) {
    .dropdown:hover .dropdown-menu {
        display: block;
    }
}

.dropdown-menu a {
    color: var(--dark);
    padding: 12px 18px;
    font-size: 0.85rem;
    border-bottom: 1px solid var(--gray);
    border-radius: 0;
}

.dropdown-menu a:hover {
    background: var(--primary);
    color: var(--white);
}

/* HAMBURGER BUTTON MOBILE */
.hamburger {
    display: none;
    flex-direction: column;
    cursor: pointer;
    gap: 5px;
    padding: 10px;
    z-index: 10005;
    position: relative;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.hamburger span {
    width: 26px;
    height: 3px;
    background: var(--white);
    border-radius: 2px;
    transition: var(--transition);
}

.btn-login-nav {
    background: var(--accent);
    color: var(--primary-dark) !important;
    font-weight: 700 !important;
    border-radius: 25px !important;
    padding: 8px 20px !important;
}

/* HERO SECTION */
.hero {
    background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 50%, var(--primary-light) 100%);
    padding-top: 140px;
    padding-bottom: 60px;
    color: var(--white);
    position: relative;
}

.hero .container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    align-items: center;
    gap: 40px;
}

.hero-content {
    flex: 1;
}

.hero-title {
    font-size: 2.6rem;
    font-weight: 800;
    color: var(--white);
    margin-bottom: 6px;
    line-height: 1.25;
}

.hero-subtitle {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--accent);
    margin-bottom: 20px;
}

.hero-text {
    font-size: 1.05rem;
    opacity: 0.9;
    margin-bottom: 30px;
    max-width: 550px;
    line-height: 1.7;
}

.hero-buttons {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

.hero-image {
    flex: 0.8;
    display: flex;
    justify-content: center;
}

.hero-image img {
    max-width: 280px;
    filter: drop-shadow(0 10px 20px rgba(0,0,0,0.3));
}

/* PAGE HEADER (INNER PAGES) */
.page-header {
    background: linear-gradient(135deg, var(--primary-dark), var(--primary));
    padding: 140px 0 40px;
    color: var(--white);
    text-align: center;
}

/* BUTTONS */
.btn {
    display: inline-block;
    padding: 12px 28px;
    border-radius: 25px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: var(--transition);
    text-align: center;
}

.btn-primary {
    background: var(--accent);
    color: var(--primary-dark);
}

.btn-primary:hover {
    background: var(--accent-light);
}

.btn-secondary {
    background: transparent;
    color: var(--white);
    border: 2px solid var(--white);
}

.btn-secondary:hover {
    background: var(--white);
    color: var(--primary);
}

.btn-info {
    background: var(--info);
    color: var(--white);
}

.btn-danger {
    background: var(--secondary);
    color: var(--white);
}

.btn-sm {
    padding: 8px 18px;
    font-size: 0.85rem;
}

.btn-lg {
    padding: 14px 32px;
    font-size: 1rem;
}

/* SECTIONS */
.section {
    padding: 60px 0;
}

.section .container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

.section-header {
    text-align: center;
    margin-bottom: 40px;
}

.section-header h2 {
    font-size: 2rem;
    color: var(--primary);
    margin-bottom: 10px;
    font-weight: 800;
}

.section-header .divider {
    width: 60px;
    height: 4px;
    background: var(--accent);
    margin: 12px auto;
    border-radius: 2px;
}

.section-alt {
    background: var(--white);
}

/* ABOUT YAYASAN */
.about-yayasan {
    display: flex;
    align-items: center;
    gap: 40px;
}

.about-image {
    flex: 1;
    text-align: center;
}

.about-image img {
    max-width: 250px;
}

.about-text {
    flex: 2;
}

.about-text h3 {
    font-size: 1.6rem;
    color: var(--primary);
    margin-bottom: 15px;
}

/* SCHOOL CARDS */
.schools-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 25px;
}

.school-card {
    background: var(--white);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: var(--transition);
}

.school-card-header {
    padding: 25px;
    text-align: center;
}

.school-card-header.tk { background: linear-gradient(135deg, #e91e63, #f06292); }
.school-card-header.sd { background: linear-gradient(135deg, #2196f3, #64b5f6); }
.school-card-header.smp { background: linear-gradient(135deg, #4caf50, #81c784); }
.school-card-header.sma { background: linear-gradient(135deg, #ff9800, #ffb74d); }

.jenjang-badge {
    display: inline-block;
    background: rgba(255,255,255,0.25);
    color: var(--white);
    padding: 4px 16px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 700;
    margin-bottom: 8px;
}

.school-card-header h3 {
    color: var(--white);
    font-size: 1.25rem;
}

.school-card-body {
    padding: 20px 25px;
}

.info-item {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
    color: var(--gray-dark);
    font-size: 0.9rem;
}

.school-card-footer {
    padding: 15px 25px 20px;
    display: flex;
    gap: 10px;
}

.school-card-footer .btn {
    flex: 1;
}

/* SPMB BANNER */
.spmb-banner {
    background: linear-gradient(135deg, var(--secondary), #e53935);
    color: var(--white);
    padding: 50px 20px;
    text-align: center;
}

.spmb-banner h2 {
    font-size: 2.2rem;
    margin-bottom: 8px;
}

.spmb-banner .highlight {
    background: var(--accent);
    color: var(--primary-dark);
    padding: 2px 12px;
    border-radius: 4px;
    font-weight: 700;
}

.spmb-info-boxes {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
}

.spmb-info-box {
    background: rgba(255,255,255,0.15);
    padding: 20px;
    border-radius: var(--radius);
    backdrop-filter: blur(5px);
}

/* NEWS CARDS */
.news-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 25px;
}

.news-card {
    background: var(--white);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
}

.news-card-image {
    height: 180px;
}

.news-card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.news-card-body {
    padding: 20px;
}

.news-card-body h3 {
    font-size: 1.1rem;
    color: var(--primary);
    margin-bottom: 8px;
}

/* STATS */
.stats {
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    padding: 40px 0;
    color: var(--white);
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 20px;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    text-align: center;
}

.stat-number {
    font-size: 2.5rem;
    font-weight: 800;
}

/* FOOTER */
.footer {
    background: var(--primary-dark);
    color: var(--white);
    padding: 50px 0 0;
}

.footer-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 30px;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

.footer-section h3 {
    font-size: 1.1rem;
    margin-bottom: 15px;
    position: relative;
    padding-bottom: 8px;
}

.footer-section h3::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 35px;
    height: 3px;
    background: var(--accent);
}

.footer-section ul {
    list-style: none;
}

.footer-section ul li {
    margin-bottom: 8px;
    font-size: 0.9rem;
}

.footer-bottom {
    border-top: 1px solid rgba(255,255,255,0.1);
    margin-top: 35px;
    padding: 20px 0;
    text-align: center;
    font-size: 0.85rem;
    opacity: 0.8;
}

/* ============================================
   RESPONSIF KHUSUS HP (MEDIA QUERIES)
   ============================================ */

@media (max-width: 992px) {
    .hero .container {
        flex-direction: column;
        text-align: center;
    }
    
    .hero-text {
        margin: 0 auto 30px;
    }
    
    .hero-buttons {
        justify-content: center;
    }
    
    .about-yayasan {
        flex-direction: column;
        text-align: center;
    }
}

@media (max-width: 768px) {
    /* TOPBAR MOBILE */
    .navbar-top .container {
        flex-direction: column;
        gap: 4px;
        text-align: center;
    }

    /* LOGO & TITLE MOBILE */
    .navbar-brand img {
        height: 34px;
    }

    .navbar-brand .brand-text h1 {
        font-size: 0.92rem;
    }

    .navbar-brand .brand-text small {
        font-size: 0.7rem;
    }

    /* HAMBURGER & MENU SLIDE OUT MOBILE */
    .hamburger {
        display: flex !important;
    }

    .navbar-nav {
        display: none !important;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: var(--primary-dark);
        flex-direction: column;
        padding: 15px 20px;
        box-shadow: 0 10px 25px rgba(0,0,0,0.4);
        max-height: 80vh;
        overflow-y: auto;
    }

    .navbar-nav.active {
        display: flex !important;
    }

    /* SUB-DROPDOWN DI MOBILE */
    .dropdown-menu {
        position: static;
        box-shadow: none;
        background: rgba(255, 255, 255, 0.08);
        border-radius: 6px;
        margin-top: 5px;
        display: none !important;
    }

    .dropdown.open-dropdown .dropdown-menu {
        display: block !important;
    }

    .dropdown-menu a {
        color: var(--white);
        border-bottom: 1px solid rgba(255, 255, 255, 0.08);
        padding: 10px 15px;
    }

    /* PERBAIKAN JARAK ATAS HP (BEBAS TERCOVER HEADER) */
    .hero {
        padding-top: 180px !important;
        padding-bottom: 40px;
    }

    .page-header {
        padding-top: 180px !important;
        padding-bottom: 30px;
    }

    .hero-title {
        font-size: 1.65rem;
        word-wrap: break-word;
    }

    .hero-subtitle {
        font-size: 1.2rem;
        margin-bottom: 15px;
    }

    .hero-text {
        font-size: 0.92rem;
    }

    .hero-buttons {
        flex-direction: column;
        width: 100%;
    }

    .hero-buttons .btn {
        width: 100%;
    }

    .hero-image img {
        max-width: 160px;
    }

    .section-header h2 {
        font-size: 1.5rem;
    }

    .schools-grid,
    .spmb-info-boxes,
    .news-grid {
        grid-template-columns: 1fr;
    }

    .stats-grid {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 480px) {
    .hero {
        padding-top: 190px !important;
    }
    
    .page-header {
        padding-top: 190px !important;
    }

    .hero-title {
        font-size: 1.45rem;
    }

    .hero-subtitle {
        font-size: 1.1rem;
    }

    .spmb-banner h2 {
        font-size: 1.5rem;
    }

    .stat-number {
        font-size: 1.8rem;
    }
}
/* =====================================================
   KUNCI TOTAL ANTI GESER HORIZONTAL (OVERFLOW FIX)
   ===================================================== */

*, *::before, *::after {
    box-sizing: border-box !important;
}

html, body {
    width: 100% !important;
    max-width: 100% !important;
    overflow-x: hidden !important;
    position: relative;
}

/* Mencegah Bootstrap Row melar ke kanan/kiri */
.row {
    --bs-gutter-x: 0 !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    max-width: 100% !important;
}

.container, .container-fluid {
    padding-left: 12px !important;
    padding-right: 12px !important;
    max-width: 100% !important;
    overflow: hidden;
}

/* Kunci semua Gambar, Audio, Iframe agar tidak melebihi layar HP */
img, iframe, audio, video, table {
    max-width: 100% !important;
}

/* KUNCI TOMBOL CHATBOT & WHATSAPP DI MOBILE */
@media (max-width: 768px) {
    /* Chat AI Robot */
    #ai-chat-btn {
        right: 12px !important;
        bottom: 75px !important;
        width: 46px !important;
        height: 46px !important;
        font-size: 1.3rem !important;
        z-index: 9998 !important;
    }

    /* Kotak Chat AI */
    #ai-chat-window {
        right: 10px !important;
        left: 10px !important;
        width: auto !important;
        max-width: calc(100vw - 20px) !important;
        bottom: 130px !important;
        height: 68vh !important;
        z-index: 9999 !important;
    }

    /* WhatsApp Float */
    .whatsapp-float {
        left: 12px !important;
        bottom: 15px !important;
        width: 46px !important;
        height: 46px !important;
        font-size: 1.4rem !important;
    }

    /* Back to Top */
    .back-to-top {
        right: 12px !important;
        bottom: 20px !important;
        width: 38px !important;
        height: 38px !important;
    }
}
/* =====================================================
   KUNCI MUTLAK LEBAR LAYAR HP (MAX 100VW)
   ===================================================== */

html, body {
    width: 100vw !important;
    max-width: 100vw !important;
    overflow-x: hidden !important;
    position: relative !important;
}

body {
    margin: 0 !important;
    padding: 0 !important;
}

/* Kunci semua section dan container agar tidak melar */
.top-bar, .navbar, .hero-section, .mars-player-section, .stats-section, .section, footer {
    max-width: 100vw !important;
    overflow-x: hidden !important;
    box-sizing: border-box !important;
}

/* Kunci audio player di mobile agar tidak mendorong card */
audio {
    max-width: 100% !important;
    min-width: 0 !important;
}

/* Hilangkan margin negatif bawaan bootstrap row */
.row {
    --bs-gutter-x: 0 !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
}

.container, .container-fluid {
    max-width: 100% !important;
    padding-left: 10px !important;
    padding-right: 10px !important;
}
/* =====================================================
   KUNCI MUTLAK ANTI OVERFLOW / GESER KANAN MOBILE
   ===================================================== */

/* 1. Hapus 100vw & Paksa Kunci Body */
html, body {
    width: 100% !important;
    max-width: 100% !important;
    overflow-x: hidden !important;
    position: relative !important;
    margin: 0 !important;
    padding: 0 !important;
}

/* 2. Wrapper Utama Pembungkus Layar */
.main-wrapper {
    width: 100% !important;
    max-width: 100% !important;
    overflow-x: hidden !important;
    position: relative !important;
}

/* 3. Mencegah Elemen Flexbox Melar Ke Luar Layar */
* {
    min-width: 0;
    box-sizing: border-box !important;
}

/* 4. Mencegah Audio, Gambar & Iframe Melebihi Lebar HP */
audio, video, img, iframe, table {
    max-width: 100% !important;
}

/* 5. Khusus Tampilan Layar HP (< 576px) */
@media (max-width: 575.98px) {
    /* Kartu Pemutar Mars di HP */
    .mars-hero-box {
        width: 100% !important;
        max-width: 100% !important;
        padding: 10px !important;
        box-sizing: border-box !important;
    }

    /* Susun Tombol Hero Secara Vertikal (Atas-Bawah) Agar Tidak Mendorong Layar */
    .hero-buttons {
        flex-direction: column !important;
        width: 100% !important;
        padding: 0 10px !important;
    }

    .hero-buttons .btn {
        width: 100% !important;
        margin-bottom: 6px;
    }

    /* Top Bar Mobile Anti-Melar */
    .top-bar {
        overflow: hidden !important;
    }

    /* Posisi Tombol Floating (WhatsApp & Chatbot AI) */
    .whatsapp-float {
        left: 12px !important;
        bottom: 15px !important;
        width: 44px !important;
        height: 44px !important;
        font-size: 1.3rem !important;
    }

    #ai-chat-btn {
        right: 12px !important;
        bottom: 75px !important;
        width: 44px !important;
        height: 44px !important;
        font-size: 1.3rem !important;
    }

    #ai-chat-window {
        right: 8px !important;
        left: 8px !important;
        width: auto !important;
        max-width: calc(100vw - 16px) !important;
    }
}