/**
 * HEADER-NEW.CSS - Desain header sesuai referensi (gambar)
 * Top bar: teal gelap (kontak kiri, sosial kanan)
 * Main bar: putih (logo + nama + navigasi bersih)
 */

:root {
    --header-top-bg: #1f5a22; /* hijau tua (selaras logo) */
    --header-main-bg: #ffffff;
    --header-text: #1f2937;
    --header-text-muted: #6b7280;
    --header-border: #e5e7eb;
}

/* Wrapper header fixed */
.site-header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: var(--z-fixed, 1030);
    background: var(--header-main-bg);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

/* ========== TOP BAR (teal gelap) ========== */
.header-top-bar {
    background: var(--header-top-bg);
    color: #fff;
    padding: 0.4rem 0;
    font-size: 0.8125rem;
}

.header-top-bar-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}

.header-contact {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.header-contact-link {
    color: rgba(255, 255, 255, 0.95);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    transition: color 0.2s;
}

.header-contact-link:hover {
    color: #fff;
}

.header-contact-link i {
    font-size: 0.75rem;
    opacity: 0.9;
}

.header-social {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.header-social-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
    font-size: 0.875rem;
    transition: background 0.2s, color 0.2s;
}

.header-social-link:hover {
    background: rgba(255, 255, 255, 0.35);
    color: #fff;
}

/* ========== MAIN BAR (putih) ========== */
.header-main {
    background: var(--header-main-bg);
    border-bottom: 1px solid var(--header-border);
    padding: 0.6rem 0;
}

.site-header .header-main .header-main-inner,
.header-main-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

/* Desktop: logo + nama + slogan mepet kiri, menu mepet kanan */
@media (min-width: 992px) {
    .site-header .header-main .container.header-main-inner {
        display: flex !important;
        flex-wrap: nowrap !important;
        justify-content: space-between !important;
        align-items: center !important;
        padding-left: var(--spacing-md, 1rem);
        padding-right: var(--spacing-md, 1rem);
    }
    .site-header .header-main .header-brand {
        flex: 0 0 auto !important;
        margin: 0 !important;
        margin-right: auto !important;
        padding-left: 0 !important;
        align-items: center;
    }
    .site-header .header-main .main-nav {
        flex: 0 0 auto !important;
        margin: 0 !important;
        margin-left: auto !important;
        padding-right: 0 !important;
        justify-content: flex-end !important;
    }
    .site-header .header-main .main-nav ul {
        flex-wrap: nowrap !important;
        gap: 0.1rem;
        justify-content: flex-end !important;
        margin: 0 !important;
        padding: 0 !important;
    }
    .site-header .header-main .main-nav > ul > li > a {
        padding: 0.5rem 0.6rem;
        font-size: 0.875rem;
    }
}

/* Brand: logo + nama */
.header-brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    text-decoration: none;
    color: var(--header-text);
    flex-shrink: 0;
    min-width: 0;
}

.header-brand:hover {
    color: var(--header-text);
}

.header-logo {
    width: 52px;
    height: 52px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.header-logo img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    padding: 4px;
}

.header-logo-fallback {
    display: none;
    font-size: 1.5rem;
    color: var(--header-top-bg);
}

.header-logo img[style*="display: none"] + .header-logo-fallback {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
}

.header-brand-text {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.header-site-name {
    font-size: 1.0625rem;
    font-weight: 700;
    line-height: 1.25;
    color: var(--header-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.header-tagline {
    font-size: 0.75rem;
    color: var(--header-text-muted);
    margin-top: 1px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ========== NAVIGASI (link bersih, seperti referensi) ========== */
.site-header .header-main .main-nav {
    display: flex;
    align-items: center;
    flex: 1 1 auto;
    justify-content: flex-end;
}

.site-header .header-main .main-nav ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    align-items: center;
    gap: 0.15rem;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.main-nav > ul > li {
    position: relative;
}

.main-nav > ul > li > a {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.5rem 0.75rem;
    color: var(--header-text);
    text-decoration: none;
    font-size: 0.9375rem;
    font-weight: 500;
    border-radius: 6px;
    transition: color 0.2s, background 0.2s;
    white-space: nowrap;
}

.main-nav > ul > li > a:hover {
    color: var(--header-top-bg);
    background: rgba(31, 90, 34, 0.08);
}

.main-nav > ul > li > a.active {
    color: var(--header-top-bg);
    font-weight: 600;
}

/* Sembunyikan ikon di desktop (tampilan bersih seperti referensi) */
.main-nav > ul > li > a .nav-icon {
    display: none;
}

.main-nav .nav-dropdown-arrow {
    font-size: 0.6rem;
    margin-left: 0.15rem;
    opacity: 0.7;
    transition: transform 0.2s;
}

.nav-has-dropdown:hover .nav-dropdown-arrow,
.nav-has-dropdown[aria-expanded="true"] .nav-dropdown-arrow {
    transform: rotate(180deg);
}

/* Dropdown menu - susunan vertikal, tanpa icon */
.nav-dropdown {
    list-style: none;
    margin: 0;
    padding: 0.35rem 0;
    position: absolute;
    top: 100%;
    display: flex;
    flex-direction: column;
    left: 0;
    min-width: 200px;
    background: #fff;
    border: 1px solid var(--header-border);
    border-radius: 8px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
    opacity: 0;
    visibility: hidden;
    transform: translateY(4px);
    transition: opacity 0.2s, visibility 0.2s, transform 0.2s;
    z-index: 100;
}

.nav-has-dropdown:hover .nav-dropdown,
.nav-has-dropdown[aria-expanded="true"] .nav-dropdown {
    opacity: 1;
    visibility: visible;
    transform: translateY(8px);
}

.nav-dropdown li {
    display: block;
}
.nav-dropdown a {
    display: block;
    padding: 0.5rem 1rem;
    color: var(--header-text);
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 500;
    transition: background 0.2s, color 0.2s;
}

.nav-dropdown a:hover {
    background: rgba(31, 90, 34, 0.10);
    color: var(--header-top-bg);
}

/* Tombol hamburger (mobile) - warna gelap di main bar putih */
.menu-toggle {
    display: none;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    padding: 0;
    border: 1px solid var(--header-border);
    border-radius: 8px;
    background: #fff;
    color: var(--header-text);
    font-size: 1.25rem;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s;
}

.menu-toggle:hover {
    background: #f9fafb;
    border-color: var(--header-text-muted);
}

.menu-toggle.active {
    background: rgba(31, 90, 34, 0.10);
    border-color: var(--header-top-bg);
    color: var(--header-top-bg);
}

.nav-overlay {
    display: none;
}

/* ========== RESPONSIF: mobile menu ========== */
@media (max-width: 991px) {
    .site-header {
        box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    }

    .header-top-bar {
        padding: 0.35rem 0;
    }

    .header-contact-link span {
        display: none;
    }

    .header-main-inner {
        flex-wrap: nowrap;
        position: relative;
        z-index: 51;
    }

    .site-header .header-main .header-brand {
        flex: 1 1 0;
        min-width: 0;
        overflow: hidden;
    }

    .site-header .header-main .header-brand-text {
        min-width: 0;
        overflow: hidden;
    }

    .site-header .header-main .header-site-name {
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .site-header .header-main .menu-toggle {
        flex-shrink: 0;
    }

    .main-nav {
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        flex: none;
        display: none !important;
        background: #fff;
        border-bottom: 1px solid var(--header-border);
        box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1);
        max-height: 70vh;
        overflow-y: auto;
        margin-top: 0;
        z-index: 50;
    }

    .main-nav.active {
        display: block !important;
    }

    .main-nav {
        text-align: left;
    }

    .main-nav ul {
        flex-direction: column;
        gap: 0;
        padding: 0.5rem 0;
        align-items: stretch;
        justify-content: flex-start;
        text-align: left;
    }

    .main-nav > ul > li {
        width: 100%;
        border-bottom: 1px solid var(--header-border);
        text-align: left;
    }

    .main-nav .nav-has-dropdown {
        text-align: left;
    }

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

    .main-nav > ul > li > a {
        width: 100%;
        padding: 0.75rem 1rem;
        justify-content: flex-start;
    }

    .main-nav > ul > li > a .nav-icon {
        display: inline-flex;
        width: 1.25rem;
        font-size: 1rem;
    }

    .menu-toggle {
        display: flex !important;
        position: relative;
        z-index: 999;
    }

    .nav-dropdown {
        position: static;
        opacity: 1;
        visibility: visible;
        transform: none;
        max-height: 0;
        overflow: hidden;
        box-shadow: none;
        border: none;
        border-radius: 0;
        background: #f9fafb;
        padding: 0;
        margin: 0;
        margin-left: 0;
        margin-right: 0;
        transition: max-height 0.25s ease;
        text-align: left;
        width: 100%;
        display: block;
        align-items: stretch;
    }

    .nav-has-dropdown[aria-expanded="true"] .nav-dropdown {
        max-height: 320px;
        overflow-y: auto;
        padding: 0.25rem 0;
    }

    .nav-dropdown li {
        display: block;
        text-align: left;
        width: 100%;
    }

    .nav-dropdown a {
        display: block;
        width: 100%;
        padding: 0.5rem 1rem 0.5rem 1.25rem;
        text-align: left;
        box-sizing: border-box;
    }

    .nav-close-wrap {
        border-top: 2px solid var(--header-border);
        margin-top: 0.5rem;
        padding-top: 0.5rem;
    }
    .nav-close-btn {
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 0.5rem;
        width: 100%;
        padding: 0.75rem 1rem;
        font-size: 0.9375rem;
        font-weight: 600;
        color: var(--header-top-bg);
        background: rgba(31, 90, 34, 0.12);
        border: 1px solid var(--header-top-bg);
        border-radius: 8px;
        cursor: pointer;
    }
    .nav-close-btn:active {
        background: rgba(31, 90, 34, 0.22);
    }

    .nav-overlay {
        display: block;
        position: fixed;
        top: var(--header-height, 100px);
        left: 0;
        width: 100%;
        height: calc(100vh - var(--header-height, 100px));
        background: rgba(0, 0, 0, 0.4);
        z-index: 40;
        opacity: 0;
        visibility: hidden;
        transition: opacity 0.2s, visibility 0.2s;
        cursor: pointer;
        pointer-events: none;
    }

    .nav-overlay.active {
        opacity: 1;
        visibility: visible;
        pointer-events: auto;
    }

    body {
        padding-top: 100px !important;
    }

    :root {
        --header-height: 100px;
    }
}

@media (max-width: 480px) {
    .header-logo {
        width: 44px;
        height: 44px;
    }

    .header-site-name {
        font-size: 0.9375rem;
    }

    .header-tagline {
        display: none;
    }
}

/* Desktop: pastikan nav terlihat, hamburger dan tombol tutup disembunyikan */
@media (min-width: 992px) {
    :root {
        --header-height: 100px;
        --header-height-desktop: 100px;
    }

    body {
        padding-top: 100px !important;
    }

    .menu-toggle {
        display: none !important;
    }

    .nav-close-wrap {
        display: none !important;
    }

    .nav-overlay {
        display: none !important;
    }
}
