/* Global Body Clearance for Fixed Floating Navbar */
body {
    padding-top: 115px !important;
}

.navbar,
.navbar *,
.navbar *::before,
.navbar *::after {
    box-sizing: border-box;
}

.navbar {
    background-color: #ffffff;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    width: 100%;
    line-height: 1.5;
}

.navbar-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    max-width: var(--site-max-width, 1520px);
    margin: 0 auto;
    padding: 0.85rem var(--site-gutter, clamp(1.25rem, 3.5vw, 4rem));
}

.navbar-logo {
    display: flex;
    align-items: center;
    flex-shrink: 0;
    justify-self: start;
}

.navbar-logo a {
    display: flex;
    align-items: center;
}

.navbar-logo img,
.navbar-logo-img {
    height: clamp(62px, 4.5vw, 83px);
    width: auto;
    aspect-ratio: 1 / 1;
    display: block;
    object-fit: contain;
}

/* ---------- Hidden Checkbox Inputs ---------- */
.nav-toggle,
.dropdown-check {
    position: absolute;
    opacity: 0;
    width: 1px;
    height: 1px;
    pointer-events: none;
}

/* ---------- Desktop Menu ---------- */
.navbar-menu {
    display: flex;
    align-items: center;
    gap: clamp(0.1rem, 0.4vw, 0.25rem);
    list-style: none;
    margin: 0;
    padding: 0;
    justify-self: center;
}

.navbar-item {
    position: relative;
}

.navbar-link {
    position: relative;
    display: block;
    padding: 0.65rem clamp(0.6rem, 0.9vw, 1.25rem);
    color: #333;
    text-decoration: none;
    font-weight: 600;
    font-size: clamp(0.92rem, 0.95vw, 1.12rem);
    line-height: 1.5;
    border-radius: 8px;
    transition: all 0.2s ease;
    white-space: nowrap;
    margin: 0;
}

.navbar-link:hover,
.navbar-link:focus-visible {
    color: #D81251;
    outline: none;
}

.navbar-link:focus-visible {
    box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.15);
}

/* Underline animasi pada link navbar: dari kiri ke kanan saat hover */
.navbar-link::after {
    content: '';
    position: absolute;
    left: clamp(0.6rem, 0.9vw, 1.25rem);
    right: clamp(0.6rem, 0.9vw, 1.25rem);
    bottom: 0.4rem;
    height: 2px;
    background-color: #D81251;
    transform: scaleX(0);
    transform-origin: center;
    transition: transform 0.2s ease;
}

.navbar-link:hover::after,
.navbar-link:focus-visible::after {
    transform: scaleX(1);
}

/* Mode active: underline tetap ada tanpa animasi */
.navbar-link:active::after {
    transform: scaleX(1);
    transition: none;
}

/* ====================================================
   ACTIVE NAVBAR LINK (SEO & JS DETECTED)
   ==================================================== */
.navbar-link[aria-current="page"],
.navbar-link.active,
.dropdown-toggle[aria-current="page"],
.dropdown-toggle.active,
.dropdown-link[aria-current="page"],
.dropdown-link.active {
    color: #D81251 !important;
    font-weight: 700;
}

.navbar-link[aria-current="page"]::after,
.navbar-link.active::after,
.dropdown-toggle[aria-current="page"]::after,
.dropdown-toggle.active::after {
    transform: scaleX(1) !important;
    opacity: 1 !important;
    visibility: visible !important;
}

/* Indikator aktif untuk Dropdown menu item */
.dropdown-link[aria-current="page"],
.dropdown-link.active {
    background-color: rgba(216, 18, 81, 0.05);
    border-left: 3px solid #D81251;
    padding-left: 12px;
}

/* ---------- Custom Dropdown (Pure CSS) ---------- */
.navbar-dropdown {
    position: relative;
}

.dropdown-toggle {
    position: relative;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.65rem clamp(0.6rem, 0.9vw, 1.25rem);
    color: #333;
    text-decoration: none;
    font-weight: 600;
    font-size: clamp(0.92rem, 0.95vw, 1.12rem);
    line-height: 1.5;
    border-radius: 8px;
    background: none;
    border: none;
    cursor: pointer;
    transition: color 0.2s ease, background-color 0.2s ease, box-shadow 0.2s ease;
    white-space: nowrap;
    margin: 0;
}

.dropdown-toggle:hover,
.dropdown-toggle:focus-visible {
    color: #D81251;
    outline: none;
}

.dropdown-toggle:focus-visible {
    box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.15);
}

/* Underline animasi pada "Layanan": dari kiri ke kanan saat hover */
.dropdown-toggle::after {
    content: '';
    position: absolute;
    left: clamp(0.6rem, 0.9vw, 1.25rem);
    right: clamp(0.6rem, 0.9vw, 1.25rem);
    bottom: 0.4rem;
    height: 2px;
    background-color: #D81251;
    transform: scaleX(0);
    transform-origin: center;
    transition: transform 0.2s ease;
}

.dropdown-toggle:hover::after,
.dropdown-toggle:focus-visible::after {
    transform: scaleX(1);
}

/* Mode active: underline tetap ada tanpa animasi */
.dropdown-toggle:active::after {
    transform: scaleX(1);
    transition: none;
}

.dropdown-icon {
    width: 16px;
    height: 16px;
    transition: transform 0.2s ease;
    flex-shrink: 0;
}

/* Rotate chevron on hover / focus / checked */
.navbar-dropdown:hover .dropdown-icon,
.dropdown-check:checked ~ .dropdown-toggle .dropdown-icon {
    transform: rotate(180deg);
}

.dropdown-menu {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    min-width: 260px;
    width: max-content;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.12), 0 2px 8px rgba(0, 0, 0, 0.08);
    border: 1px solid #e5e7eb;
    padding: 0.5rem 0;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    transition: all 0.2s ease;
    z-index: 100;
    list-style: none;
    margin: 0;
}

/* Desktop: hover + focus-within + checked */
.navbar-dropdown:hover .dropdown-menu,
.dropdown-check:checked ~ .dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-item {
    margin: 0;
}

.dropdown-link {
    display: block;
    padding: 0.75rem 1.25rem;
    text-decoration: none;
    font-size: 0.9375rem;
    line-height: 1.5;
    color: #4b5563;
    border-radius: 8px;
    font-weight: 500;
    transition: all 0.15s ease;
    margin: 0;
    white-space: nowrap;
}

.dropdown-link:hover,
.dropdown-link:focus-visible {
    color: #D81251;
    background-color: #f9fafb;
    outline: none;
}

.dropdown-link:focus-visible {
    color: #D81251;
}

/* Dropdown Arrow */
.dropdown-menu::before {
    content: '';
    position: absolute;
    top: -6px;
    left: 24px;
    width: 12px;
    height: 12px;
    background: #fff;
    border-left: 1px solid #e5e7eb;
    border-top: 1px solid #e5e7eb;
    transform: rotate(45deg);
    z-index: -1;
}

/* ---------- Login CTA Button ---------- */
.navbar-cta {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.60rem 1.2rem;
    background-color: #D81251;
    color: #fff;
    font-weight: 600;
    font-size: 1.1rem;
    line-height: 1.5;
    border-radius: 8px;
    text-decoration: none;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    margin: 0;
}

/* CTA desktop: posisi paling kanan pada grid */
.navbar-cta-desktop {
    justify-self: end;
    margin-left: clamp(0.5rem, 0.9vw, 1.2rem);
    padding: 0.60rem clamp(0.85rem, 1vw, 1.2rem);
    font-size: clamp(0.92rem, 0.95vw, 1.1rem);
}

/* CTA mobile: disembunyikan di desktop, hanya tampil di drawer */
.navbar-cta-mobile,
.navbar-cta-mobile-item {
    display: none;
}

.navbar-cta:hover,
.navbar-cta:focus-visible {
    background-color: #D81251;
    color: #fff;
    transform: translateY(-1px);
    box-shadow: 0 1px 5px rgba(0, 0, 0, 0.3);
    outline: none;
}

.navbar-cta:focus-visible {
    box-shadow: 0 0.5px 0.5px 1px rgba(0, 0, 0, 0.4), 0 4px 12px rgba(0, 0, 0, 0.4);
}

.navbar-cta:active {
    transform: translateY(0);
}

/* ---------- Mobile Menu Toggle (Checkbox Hack) ---------- */
.mobile-menu-toggle {
    display: none;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    border-radius: 8px;
    transition: background-color 0.2s ease;
}

.mobile-menu-toggle:hover {
    background-color: #f3f4f6;
}

.mobile-menu-toggle:focus-within {
    box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.4);
}

/* Focus ring when nav-toggle is focused via keyboard */
.nav-toggle:focus-visible ~ .mobile-menu-toggle {
    box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.4);
}

.hamburger {
    display: block;
    width: 24px;
    height: 2px;
    background-color: #333;
    position: relative;
    transition: background-color 0.2s ease;
}

.hamburger::before,
.hamburger::after {
    content: '';
    position: absolute;
    left: 0;
    width: 100%;
    height: 2px;
    background-color: #333;
    transition: transform 0.2s ease;
}

.hamburger::before {
    top: -7px;
}

.hamburger::after {
    bottom: -7px;
}

/* Hamburger → X animation when checkbox checked */
.nav-toggle:checked ~ .mobile-menu-toggle .hamburger {
    background-color: transparent;
}

.nav-toggle:checked ~ .mobile-menu-toggle .hamburger::before {
    transform: translateY(7px) rotate(45deg);
}

.nav-toggle:checked ~ .mobile-menu-toggle .hamburger::after {
    transform: translateY(-7px) rotate(-45deg);
}

/* ---------- Mobile Menu Overlay (Checkbox Hack) ---------- */
.mobile-menu-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
    opacity: 0;
    transition: opacity 0.3s ease;
    cursor: pointer;
}

/* Show overlay and open menu when checkbox is checked */
.nav-toggle:checked ~ .mobile-menu-overlay {
    display: block;
    opacity: 1;
}

/* ---------- Mobile & Tablet Menu Panel (Hamburger Drawer <= 1024px) ---------- */
@media (max-width: 1024px) {
    body {
        padding-top: 95px !important;
    }

    .navbar-logo img,
    .navbar-logo-img {
        height: 65px;
        width: 65px;
        aspect-ratio: 1 / 1;
    }

    .navbar-container {
        padding: 0.5rem clamp(1rem, 3vw, 1.5rem);
    }

    .mobile-menu-toggle {
        display: flex;
        justify-self: end;
    }

    .mobile-menu-overlay {
        display: none;
        opacity: 0;
    }

    /* Sembunyikan CTA desktop di layar kecil/tablet */
    .navbar-cta-desktop {
        display: none;
    }

    /* Tampilkan CTA mobile di dalam drawer */
    .navbar-cta-mobile,
    .navbar-cta-mobile-item {
        display: flex;
    }

    .navbar-menu {
        position: fixed;
        top: 0;
        right: 0;
        bottom: 0;
        width: 320px;
        max-width: 100%;
        flex-direction: column;
        align-items: stretch;
        background: #fff;
        padding: 5rem 1.5rem 2rem;
        gap: 0;
        box-shadow: -4px 0 20px rgba(0, 0, 0, 0.1);
        transform: translateX(100%);
        transition: transform 0.3s ease;
        overflow-y: auto;
        border-left: 1px solid #e5e7eb;
        z-index: 1001;
    }

    .nav-toggle:checked ~ .navbar-menu {
        transform: translateX(0);
    }

    .navbar-item {
        border-bottom: 1px solid #f3f4f6;
    }

    .navbar-item:last-child {
        border-bottom: none;
    }

    .navbar-link {
        padding: 1rem 0;
        border-radius: 0;
        font-size: 1.125rem;
    }

    .navbar-link:hover,
    .navbar-link:focus-visible {
        background-color: transparent;
        color: #D81251;
        padding-left: 0.5rem;
    }

    /* Mobile: underline mengikuti tanpa padding horizontal */
    .navbar-link::after {
        left: 0;
        right: 0;
        bottom: 0.4rem;
    }

    .dropdown-toggle {
        width: 100%;
        justify-content: space-between;
        padding: 1rem 0;
        border-radius: 0;
        font-size: 1.125rem;
        text-align: left;
    }

    .dropdown-toggle:hover,
    .dropdown-toggle:focus-visible {
        background-color: transparent;
        color: #D81251;
    }

    /* Mobile: underline mengikuti tanpa padding horizontal */
    .dropdown-toggle::after {
        left: 0;
        right: 0;
        bottom: 0.4rem;
    }

    /* Mobile dropdown: hidden by default, shown when checkbox checked */
    .dropdown-menu {
        position: static;
        opacity: 1;
        visibility: visible;
        transform: none;
        box-shadow: none;
        border: none;
        border-radius: 0;
        padding: 0.5rem 0 0.5rem 1rem;
        background: #f9fafb;
        margin-top: 0.5rem;
        border-top: 1px solid #e5e7eb;
        display: none;
    }

    .dropdown-check:checked ~ .dropdown-menu {
        display: block;
    }

    .dropdown-menu::before {
        display: none;
    }

    .dropdown-link {
        padding: 0.75rem 0;
        font-size: 1rem;
        color: #4b5563;
    }

    .dropdown-link:hover,
    .dropdown-link:focus-visible {
        background-color: transparent;
        color: #D81251;
        padding-left: 0.5rem;
    }

    .navbar-cta {
        width: 100%;
        margin-top: 1rem;
        margin-bottom: 1rem;
        padding: 1rem;
        font-size: 1.125rem;
    }

    .navbar-cta-mobile-item {
        border-bottom: none !important;
    }
}

/* ---------- Desktop Dropdown Hover (> 1024px) ---------- */
@media (min-width: 1025px) {
    .navbar-dropdown:hover .dropdown-menu {
        opacity: 1;
        visibility: visible;
        transform: translateY(0);
    }

    .dropdown-check:checked ~ .dropdown-menu {
        opacity: 1;
        visibility: visible;
        transform: translateY(0);
    }
}

/* ---------- Reduced Motion ---------- */
@media (prefers-reduced-motion: reduce) {
    .dropdown-menu,
    .dropdown-icon,
    .navbar-menu,
    .mobile-menu-toggle .hamburger,
    .mobile-menu-toggle .hamburger::before,
    .mobile-menu-toggle .hamburger::after,
    .mobile-menu-overlay,
    .navbar-link,
    .dropdown-toggle,
    .dropdown-link,
    .navbar-cta {
        transition: none !important;
    }
}

/* ---------- High Contrast Mode ---------- */
@media (prefers-contrast: high) {
    .navbar {
        border-bottom: 2px solid #000;
    }

    .dropdown-menu {
        border: 2px solid #000;
    }

    .navbar-link:focus-visible,
    .dropdown-toggle:focus-visible,
    .dropdown-link:focus-visible,
    .navbar-cta:focus-visible {
        outline: 3px solid #000;
        outline-offset: 2px;
    }
}
