/**
 * mobile-header-core.css
 * 
 * CSS ini berisi semua styling untuk header mobile yang digunakan di seluruh situs
 * File ini bertujuan untuk memastikan konsistensi pada semua halaman mobile
 * 
 * PERHATIAN: JANGAN EDIT FILE INI SECARA LANGSUNG!
 * Jika perlu modifikasi, ubah nilai dalam config/header-mobile.php
 */

/* ==============================
 * 1. RESET & BASE STYLES
 * ============================== */
html, body {
    overflow-x: hidden;
    width: 100%;
    max-width: 100vw;
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

/* Browser-specific fixes untuk mencegah masalah rendering */
html {
    -webkit-text-size-adjust: 100%; /* Mencegah font scaling di iOS Safari */
}

body {
    min-height: 100vh; /* Pastikan body memenuhi viewport */
    /* Prefixes untuk browser lama */
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.header, 
.navbar, 
.nav-container, 
.nav-logo, 
.nav-menu, 
.hamburger,
#mobile-menu-toggle {
    box-sizing: border-box;
}

/* ==============================
 * 2. HEADER STRUCTURE
 * ============================== */

/* Ensure mobile header is always visible on small screens regardless of other styles */
.header.mobile-header {
    display: block !important;
    visibility: visible !important;
}

/* Mobile Header Styles */
@media (max-width: 768px) {
    /* Force mobile header to be visible */
    .header.mobile-header {
        display: block !important;
        visibility: visible !important;
    }
    /* 2.1 Header Container */
    body .header,
    .header {
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        right: 0 !important;
        width: 100% !important;
        max-width: 100vw !important;
        height: var(--header-height) !important;
        padding: var(--header-padding) !important;
        margin: 0 !important;
        background-color: var(--header-bg-color) !important;
        z-index: var(--header-z-index) !important;
        box-sizing: border-box !important;
        box-shadow: var(--header-shadow) !important;
        border-bottom: 1px solid var(--header-border-color) !important;
    }
    
    /* 2.2 Navbar */
    .navbar {
        width: 100%;
        max-width: 100%;
        height: var(--header-height);
        padding: 0 10px;
        margin: 0;
        display: flex;
        align-items: center;
        justify-content: space-between;
    }
    
    /* 2.3 Nav Container */
    .nav-container {
        width: 100%;
        max-width: 100%;
        height: 100%;
        padding: 0;
        margin: 0;
        display: flex;
        align-items: center;
        justify-content: space-between;
    }

    /* ==============================
     * 3. LOGO STYLING
     * ============================== */
    .nav-logo {
        height: var(--logo-height);
        display: flex;
        align-items: center;
        padding-left: var(--logo-padding-left) !important;
    }
    
    .nav-logo img {
        max-height: var(--logo-height);
        width: auto;
        filter: var(--logo-shadow);
        margin-left: 2px;
        margin-top: 15px;
    }
    
    /* ==============================
     * 4. HAMBURGER BUTTON
     * ============================== */
    .hamburger, 
    #mobile-menu-toggle {
        display: flex !important;
        flex-direction: column;
        justify-content: space-between;
        cursor: pointer;
        width: var(--hamburger-width);
        height: var(--hamburger-height);
        position: absolute;
        right: var(--hamburger-right);
        top: var(--hamburger-top);
        z-index: var(--hamburger-z-index);
        background: transparent;
        border: none;
        outline: none;
        padding: 0;
        margin: 0;
        -webkit-tap-highlight-color: transparent;
    }
    
    /* 4.1 Extended tap target area */
    .hamburger:before,
    #mobile-menu-toggle:before {
        content: '';
        position: absolute;
        top: -15px;
        right: -15px;
        bottom: -15px;
        left: -15px;
        z-index: -1;
    }
    
    /* 4.2 Bar styling */
    .hamburger .bar,
    #mobile-menu-toggle .bar {
        width: 100%;
        height: var(--bar-height);
        background-color: var(--hamburger-color);
        display: block;
        margin: calc(var(--bar-spacing) / 2) 0;
        transition: all 0.3s ease;
        border-radius: calc(var(--bar-height) / 2);
        box-shadow: 0 1px 1px rgba(0,0,0,0.2);
    }
    
    /* 4.3 Active state animation */
    .hamburger.active .bar:nth-child(1),
    #mobile-menu-toggle.active .bar:nth-child(1) {
        transform: translateY(calc(var(--bar-height) + var(--bar-spacing) + 2px)) rotate(45deg);
        width: 100%;
    }
    
    .hamburger.active .bar:nth-child(2),
    #mobile-menu-toggle.active .bar:nth-child(2) {
        opacity: 0;
        transform: translateX(-10px);
    }
    
    .hamburger.active .bar:nth-child(3),
    #mobile-menu-toggle.active .bar:nth-child(3) {
        transform: translateY(calc(-1 * (var(--bar-height) + var(--bar-spacing) + 2px))) rotate(-45deg);
        width: 100%;
    }
    
    /* ==============================
     * 5. NAVIGATION MENU
     * ============================== */
    /* 5.1 Nav Menu Container */
    .nav-menu {
        position: fixed !important;
        left: -100% !important;
        top: var(--header-height) !important;
        flex-direction: column !important;
        background-color: var(--menu-bg-color) !important;
        width: 100% !important;
        max-width: 100vw !important;
        text-align: center !important;
        transition: all 0.3s ease !important;
        box-shadow: 0 5px 10px rgba(0, 0, 0, 0.2) !important;
        gap: 0 !important;
        z-index: var(--menu-z-index) !important;
        padding: 0 !important;
        margin: 0 !important;
        box-sizing: border-box !important;
    }
    
    /* 5.2 Active Menu State */
    .nav-menu.active {
        left: 0 !important;
        display: flex !important;
        flex-direction: column !important;
        align-items: center !important;
        padding: 0 !important;
        height: auto !important;
        max-height: calc(100vh - var(--header-height)) !important;
        overflow-y: auto !important;
    }
    
    /* 5.3 Menu Items */
    .nav-menu li {
        margin: 0;
        width: 100%;
        text-align: left;
        border-bottom: 1px solid var(--header-border-color);
    }

    .nav-menu > li:last-child {
        border-bottom: none;
    }

    /* 5.4 Menu Links */
    .nav-menu li a {
        display: block;
        width: 100%;
        padding: var(--menu-link-padding);
        color: var(--menu-link-color);
        font-size: var(--menu-link-font-size);
        font-weight: 600;
        text-decoration: none;
        transition: background-color 0.2s ease, color 0.2s ease;
        box-sizing: border-box;
    }
    
    .nav-menu li a:hover {
        background-color: rgba(255, 255, 255, 0.1);
        color: var(--menu-link-hover-color);
    }

    /* ==============================
     * 6. DROPDOWN MENU
     * ============================== */
    /* 6.1 Dropdown Container */
    .nav-menu li.dropdown {
        position: relative;
    }

    /* 6.2 Dropdown Toggle (the main link) */
    .nav-menu li.dropdown > a {
        display: flex;
        justify-content: space-between;
        align-items: center;
    }

    /* 6.3 Dropdown Arrow */
    .nav-menu li.dropdown > a .arrow {
        border: solid var(--menu-link-color);
        border-width: 0 2px 2px 0;
        display: inline-block;
        padding: 4px;
        margin-right: 20px;
        transform: rotate(45deg);
        transition: transform 0.3s ease, border-color 0.2s ease;
    }
    
    .nav-menu li.dropdown > a:hover .arrow {
        border-color: var(--menu-link-hover-color);
    }

    .nav-menu li.dropdown.open > a .arrow {
        transform: rotate(-135deg);
        margin-top: -5px;
    }

    /* 6.4 Dropdown Menu (the sub-menu) */
    .dropdown-menu {
        display: none;
        list-style: none;
        padding: 0;
        margin: 0;
        width: 100%;
        background-color: rgba(0, 0, 0, 0.15);
        box-shadow: inset 0 4px 8px rgba(0,0,0,0.1);
    }

    .dropdown.open .dropdown-menu {
        display: block;
    }

    /* 6.5 Dropdown Menu Items */
    .dropdown-menu li {
        border-bottom: none; /* No double borders */
        border-top: 1px solid var(--header-border-color);
    }
    
    .dropdown-menu li:first-child {
        border-top: none;
    }

    .dropdown-menu li a {
        padding-left: 35px !important; /* Indent dropdown links */
        font-weight: 400;
        font-size: 15px;
        color: var(--dropdown-link-color) !important; /* Use the new variable */
    }

    .dropdown-menu li a:hover {
        background-color: rgba(255, 255, 255, 0.2);
        color: var(--dropdown-link-hover-color) !important; /* Use the new variable */
    }
    
    /* ==============================
     * 7. BODY & CONTENT
     * ============================== */
    /* 7.1 Body Padding for Fixed Header */
    body {
        padding-top: var(--body-padding-top) !important;
    }
    
    /* 7.2 Special Pages with Hero Sections */
    body.special-hero-page {
        padding-top: 0 !important;
    }
    
    body.special-hero-page .header {
        background-color: rgba(0, 0, 0, 0.7) !important;
    }
    
    /* 7.3 When Menu is Open */
    body.menu-open {
        overflow: hidden !important;
        position: fixed;
        width: 100%;
        height: 100%;
    }
    
    /* ==============================
     * 8. FOOTER ADJUSTMENTS FOR MOBILE
     * ============================== */
    /* 8.1 Hide Desktop Footer */
    .footer {
        display: none;
    }
    
    /* 8.2 Show Mobile Footer */
    .footer-menu {
        display: flex !important;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        background-color: var(--header-bg-color);
        border-top: 1px solid var(--header-border-color);
        z-index: 999;
    }
}

/* ==============================
 * 8. DESKTOP STYLES
 * ============================== */
@media (min-width: 769px) {
    /* 8.1 Hide Mobile Elements */
    .hamburger, 
    #mobile-menu-toggle {
        display: none !important;
    }
    
    /* 8.2 Reset Header for Desktop */
    .header {
        position: relative !important;
        height: auto !important;
        box-shadow: none !important;
    }
    
    body {
        padding-top: 0 !important;
    }
    
    .navbar {
        height: auto !important;
        padding: 1rem 0 !important;
    }
    
    .nav-logo {
        padding-left: 20px !important;
    }
    
    /* 8.3 Hide Mobile Footer */
    .footer-menu {
        display: none !important;
    }
}
