/* =====================================================================
   MOBILE FIX CSS — gerejaganjuran.org
   Dipasang di head.php, berlaku di semua halaman
   ===================================================================== */

/* ── 1. NAVBAR & HAMBURGER FIX ─────────────────────────────────────── */

/* Pastikan topbar sticky agar menu selalu terlihat */
.topbar {
    position: sticky;
    top: 0;
    z-index: 9999;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

/* Fix tombol hamburger — selalu muncul & mudah diklik */
@media (max-width: 991px) {
    .menu-toggle {
        display: block !important;
        position: absolute;
        top: 50%;
        right: 15px;
        transform: translateY(-50%);
        font-size: 1.6rem;
        color: #9C6F34;
        padding: 8px 12px;
        z-index: 1000;
        cursor: pointer;
        -webkit-tap-highlight-color: transparent;
    }

    .topbar .container {
        position: relative;
        min-height: 60px;
        display: flex;
        align-items: center;
    }

    /* Logo kiri, hamburger kanan */
    h1.logo {
        margin: 8px 0;
        flex: 1;
    }

    h1.logo img {
        max-height: 44px;
        width: auto;
    }

    /* Main menu tersembunyi default di mobile */
    .main-menu-wrapper {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: #fff;
        border-top: 2px solid #9C6F34;
        box-shadow: 0 6px 20px rgba(0,0,0,0.15);
        z-index: 9998;
        max-height: 80vh;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }

    .main-menu-wrapper.open {
        display: block !important;
    }

    /* Menu item di mobile — full width, lebih tinggi */
    .sf-menu,
    .sf-menu li,
    .sf-menu li a {
        display: block;
        width: 100%;
        float: none;
    }

    .sf-menu > li > a {
        padding: 13px 20px !important;
        font-size: 0.95rem;
        border-bottom: 1px solid #f0e8d5;
        color: #333 !important;
        font-weight: 600;
    }

    .sf-menu > li > a:hover {
        background: #FFF8DC;
        color: #9C6F34 !important;
    }

    /* Dropdown di mobile — tampil as normal block */
    .sf-menu li ul.dropdown,
    .sf-menu li:hover ul.dropdown {
        display: block !important;
        position: static !important;
        box-shadow: none !important;
        border: none !important;
        background: #FAFAFA !important;
        padding-left: 0 !important;
        margin: 0 !important;
        opacity: 1 !important;
        visibility: visible !important;
        pointer-events: all !important;
    }

    .sf-menu li ul.dropdown li a {
        padding: 10px 20px 10px 36px !important;
        font-size: 0.88rem;
        color: #666 !important;
        border-bottom: 1px solid #f5f0e8;
    }

    .sf-menu li ul.dropdown li a:hover {
        color: #9C6F34 !important;
        background: #FFF8DC;
    }
}

/* ── 2. HERO SLIDER FIX ────────────────────────────────────────────── */
@media (max-width: 767px) {
    .hero-slider.flexslider {
        height: 55vw !important;
        min-height: 220px !important;
        max-height: 340px !important;
        margin-top: 0 !important;
    }

    .hero-slider .slides li {
        height: 55vw !important;
        min-height: 220px !important;
        max-height: 340px !important;
        background-size: cover !important;
        background-position: center top !important;
    }
}

@media (min-width: 768px) and (max-width: 991px) {
    .hero-slider.flexslider,
    .hero-slider .slides li {
        height: 50vw !important;
        max-height: 440px !important;
    }
}

/* ── 3. SIDEBAR / CONTENT LAYOUT FIX ──────────────────────────────── */
@media (max-width: 767px) {
    /* Stack sidebar di bawah konten utama */
    .col-md-8.col-sm-6,
    .col-md-4.col-sm-6.sidebar {
        width: 100% !important;
        float: none !important;
    }

    /* Artikel listing — foto dan teks tidak tumpang tindih */
    article.post .col-md-4,
    article.post .col-md-8 {
        width: 100% !important;
        float: none !important;
    }

    article.post .col-md-4 img {
        width: 100% !important;
        height: 200px !important;
        object-fit: cover;
        margin-bottom: 12px;
        border-radius: 4px;
    }

    article.post {
        margin-bottom: 24px;
        padding-bottom: 20px;
        border-bottom: 1px dashed #eee;
    }

    /* Renungan sidebar panel */
    .panel.panel-default {
        margin-bottom: 15px;
    }

    .panel-heading {
        height: 140px !important;
    }
}

/* ── 4. FOOTER FIX ─────────────────────────────────────────────────── */
@media (max-width: 767px) {
    /* Footer kolom icon (col-md-1) fix */
    .site-footer .col-md-1 {
        width: auto !important;
        float: left !important;
        padding-right: 8px;
    }

    .site-footer .col-md-11 {
        width: calc(100% - 30px) !important;
        float: left !important;
    }

    .site-footer .row {
        display: flex;
        align-items: flex-start;
        margin-bottom: 8px;
    }

    /* Footer widget kolom stack */
    .col-md-5.col-sm-5.widget.footer-widget,
    .col-md-4.col-sm-4.widget.footer-widget,
    .col-md-3.col-sm-3.footer-widget {
        width: 100% !important;
        float: none !important;
        margin-bottom: 24px;
    }

    .site-footer img[alt="Logo"] {
        max-width: 120px;
        height: auto;
    }

    /* Featured gallery (video) di footer */
    .featured-gallery .col-md-3.col-sm-2 {
        width: 100% !important;
        float: none !important;
        margin-bottom: 12px;
    }

    .featured-gallery .col-md-9.col-sm-10 {
        width: 100% !important;
        float: none !important;
        display: flex;
        gap: 8px;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        padding-bottom: 8px;
    }

    .featured-gallery .col-md-4.col-sm-4.post {
        flex: 0 0 160px !important;
        width: 160px !important;
        float: none !important;
    }

    .featured-gallery .col-md-4.col-sm-4.post img {
        width: 100%;
        height: 100px;
        object-fit: cover;
    }
}

/* ── 5. TABEL JADWAL MISA ──────────────────────────────────────────── */
@media (max-width: 767px) {
    .table-responsive-fix {
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch;
        border: 1px solid #dee2e6;
        border-radius: 4px;
    }

    /* Auto wrap semua tabel */
    table.table {
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
}

/* ── 6. PRODUK GRID FIX (Toko) ─────────────────────────────────────── */
@media (max-width: 480px) {
    /* 1 kolom di HP sangat kecil */
    .produk-grid .col-md-3.col-sm-6 {
        width: 100% !important;
        float: none !important;
    }
}

@media (min-width: 481px) and (max-width: 767px) {
    /* 2 kolom di HP normal */
    .produk-grid .col-md-3.col-sm-6 {
        width: 50% !important;
        float: left !important;
    }
}

/* ── 7. KATEGORI FILTER BAR (Toko) ────────────────────────────────── */
@media (max-width: 767px) {
    .kategori-bar {
        overflow-x: auto !important;
        white-space: nowrap !important;
        -webkit-overflow-scrolling: touch;
        padding: 12px 0 !important;
        text-align: left !important;
        padding-left: 10px !important;
    }

    .kategori-btn {
        display: inline-block !important;
        white-space: nowrap;
    }
}

/* ── 8. GENERAL TYPOGRAPHY & SPACING ──────────────────────────────── */
@media (max-width: 767px) {
    /* Judul halaman */
    h1 { font-size: 1.6rem !important; }
    h2 { font-size: 1.3rem !important; }
    h3 { font-size: 1.1rem !important; }

    /* Container padding */
    .container { padding-left: 15px !important; padding-right: 15px !important; }

    /* Tombol lebih besar agar mudah diklik */
    .btn { min-height: 42px; padding: 10px 16px !important; font-size: 0.9rem; }

    /* Pengumuman/warta card */
    .listing-header h3 { font-size: 1.2rem !important; }

    /* Overflow fix global */
    body { overflow-x: hidden !important; }

    /* Spasi atas untuk main content agar tidak tertutup topbar sticky */
    .main { padding-top: 0 !important; }
}

/* ── 9. BACK TO TOP BUTTON ──────────────────────────────────────────── */
@media (max-width: 767px) {
    #back-to-top {
        bottom: 20px !important;
        right: 15px !important;
        width: 40px !important;
        height: 40px !important;
        line-height: 40px !important;
        font-size: 1.1rem !important;
    }
}

/* ── 10. NOTICE BAR / ANNOUNCEMENT ─────────────────────────────────── */
@media (max-width: 767px) {
    .container-fluid h4 {
        font-size: 0.85rem !important;
        line-height: 1.5 !important;
        padding: 10px 0 !important;
    }
}
