/*
 * Agoogi mobile navigation drawer
 * Load after style.css, shop-marketplace.css and header-responsive-nav.css.
 * The drawer is independently scrollable so Login, Create Account, Cart and
 * other links remain reachable on short phones and in landscape orientation.
 */

.mobile-menu-panel-header,
.mobile-menu-section-label,
.mobile-menu-backdrop {
    display: none;
}

.mobile-menu-toggle {
    align-items: center;
    gap: 8px;
}

@media (max-width: 900px) {
    html {
        scroll-padding-top: 86px;
    }

    body.mobile-nav-open {
        overflow: hidden !important;
    }

    .site-header {
        z-index: 1200 !important;
    }

    .mobile-menu-toggle {
        display: inline-flex !important;
        justify-content: center;
        min-width: 86px;
        min-height: 44px;
        position: relative;
        z-index: 1201;
    }

    .mobile-menu-toggle[aria-expanded="true"] {
        background: #0f172a !important;
        border-color: #0f172a !important;
        color: #ffffff !important;
    }

    /* Override the older display:none mobile rule with an off-canvas drawer. */
    .header-nav-row#siteMobileMenu {
        display: block !important;
        position: fixed !important;
        top: 0 !important;
        right: 0 !important;
        bottom: 0 !important;
        left: auto !important;
        width: min(430px, 94vw) !important;
        max-width: 100% !important;
        height: 100dvh !important;
        max-height: 100dvh !important;
        overflow-x: hidden !important;
        overflow-y: auto !important;
        overscroll-behavior: contain !important;
        -webkit-overflow-scrolling: touch;
        background: #f8fafc !important;
        border: 0 !important;
        box-shadow: -24px 0 60px rgba(15, 23, 42, 0.24) !important;
        z-index: 1300 !important;
        visibility: hidden !important;
        opacity: 0 !important;
        pointer-events: none !important;
        transform: translateX(105%) !important;
        transition:
            transform 220ms ease,
            opacity 180ms ease,
            visibility 0s linear 220ms !important;
    }

    .header-nav-row#siteMobileMenu.mobile-menu-open {
        visibility: visible !important;
        opacity: 1 !important;
        pointer-events: auto !important;
        transform: translateX(0) !important;
        transition:
            transform 220ms ease,
            opacity 180ms ease,
            visibility 0s linear 0s !important;
    }

    .mobile-menu-panel-header {
        position: sticky;
        top: 0;
        z-index: 3;
        display: flex !important;
        align-items: center;
        justify-content: space-between;
        min-height: 70px;
        padding: 14px 18px;
        background: rgba(255, 255, 255, 0.97);
        border-bottom: 1px solid #e2e8f0;
        backdrop-filter: blur(12px);
    }

    .mobile-menu-panel-header strong {
        color: #0f172a;
        font-size: 20px;
    }

    .mobile-menu-close {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 44px;
        height: 44px;
        border: 1px solid #cbd5e1;
        border-radius: 999px;
        background: #ffffff;
        color: #0f172a;
        cursor: pointer;
        font-size: 30px;
        line-height: 1;
    }

    .mobile-menu-close:hover,
    .mobile-menu-close:focus-visible {
        background: #f1f5f9;
        border-color: #94a3b8;
    }

    .mobile-menu-backdrop {
        position: fixed;
        inset: 0;
        z-index: 1250;
        width: 100%;
        height: 100%;
        border: 0;
        padding: 0;
        background: rgba(15, 23, 42, 0.54);
        cursor: pointer;
    }

    .mobile-menu-backdrop:not([hidden]) {
        display: block !important;
    }

    .header-nav-row .nav-container {
        width: 100% !important;
        max-width: none !important;
        margin: 0 !important;
        padding: 0 16px calc(28px + env(safe-area-inset-bottom)) !important;
    }

    .header-nav-row .nav {
        width: 100% !important;
        display: flex !important;
        flex-direction: column !important;
        align-items: stretch !important;
        justify-content: flex-start !important;
        gap: 10px !important;
        padding: 18px 0 !important;
        overflow: visible !important;
    }

    .mobile-menu-section-label {
        display: block !important;
        width: 100%;
        margin: 12px 0 0;
        padding: 0 4px;
        color: #64748b;
        font-size: 12px;
        font-weight: 800;
        letter-spacing: 0.08em;
        text-transform: uppercase;
    }

    .header-nav-row .nav-dropdown,
    .header-nav-row .header-search-wrap,
    .header-nav-row .header-currency-form,
    .header-nav-row .nav-inline-form {
        width: 100% !important;
        max-width: none !important;
        min-width: 0 !important;
        margin: 0 !important;
        flex: 0 0 auto !important;
    }

    .header-nav-row .nav > a,
    .header-nav-row .nav-dropdown > summary,
    .header-nav-row .nav .nav-link-button,
    .header-nav-row .nav .btn {
        width: 100% !important;
        min-height: 52px !important;
        display: flex !important;
        align-items: center !important;
        justify-content: space-between !important;
        margin: 0 !important;
        padding: 14px 16px !important;
        border: 1px solid #dbe3ee !important;
        border-radius: 14px !important;
        background: #ffffff !important;
        color: #0f172a !important;
        font-size: 17px !important;
        font-weight: 800 !important;
        line-height: 1.25 !important;
        text-align: left !important;
        box-shadow: 0 3px 12px rgba(15, 23, 42, 0.035) !important;
    }

    .header-nav-row .nav-dropdown > summary {
        cursor: pointer;
        list-style: none;
    }

    .header-nav-row .nav-dropdown > summary::-webkit-details-marker {
        display: none;
    }

    .header-nav-row .nav-dropdown > summary::after {
        content: "+" !important;
        flex: 0 0 auto;
        margin-left: 12px;
        color: #64748b !important;
        font-size: 23px !important;
        font-weight: 500 !important;
        line-height: 1 !important;
    }

    .header-nav-row .nav-dropdown[open] > summary {
        border-color: #7dd3fc !important;
        background: #f0f9ff !important;
        color: #075985 !important;
    }

    .header-nav-row .nav-dropdown[open] > summary::after {
        content: "−" !important;
    }

    /* Avoid nested scrolling. The entire drawer scrolls instead. */
    .header-nav-row .dropdown-menu {
        position: static !important;
        display: none !important;
        width: 100% !important;
        min-width: 0 !important;
        max-width: none !important;
        max-height: none !important;
        overflow: visible !important;
        margin: 7px 0 2px !important;
        padding: 8px !important;
        border: 1px solid #dbe3ee !important;
        border-radius: 14px !important;
        background: #eef6fb !important;
        box-shadow: none !important;
    }

    .header-nav-row .nav-dropdown[open] .dropdown-menu {
        display: block !important;
    }

    .header-nav-row .dropdown-menu a {
        display: flex !important;
        align-items: center !important;
        width: 100% !important;
        min-height: 46px !important;
        margin: 0 0 6px !important;
        padding: 12px 13px !important;
        border: 1px solid transparent !important;
        border-radius: 10px !important;
        background: #ffffff !important;
        color: #0f172a !important;
        font-size: 15px !important;
        font-weight: 700 !important;
        line-height: 1.35 !important;
        white-space: normal !important;
    }

    .header-nav-row .dropdown-menu a:last-child {
        margin-bottom: 0 !important;
    }

    .header-nav-row .dropdown-menu a:hover,
    .header-nav-row .dropdown-menu a:focus-visible {
        border-color: #bae6fd !important;
        background: #f0f9ff !important;
        color: #0369a1 !important;
    }

    .header-nav-row .header-search {
        width: 100% !important;
        display: grid !important;
        grid-template-columns: minmax(0, 1fr) auto !important;
        gap: 6px !important;
        padding: 5px !important;
        border-radius: 14px !important;
        background: #ffffff !important;
    }

    .header-nav-row .header-search input {
        width: 100% !important;
        min-width: 0 !important;
        min-height: 44px !important;
        padding: 8px 10px !important;
        font-size: 16px !important; /* Prevents iOS zoom. */
    }

    .header-nav-row .header-search button {
        min-height: 44px !important;
        padding: 8px 14px !important;
    }

    .header-nav-row .search-suggestions {
        position: static !important;
        width: 100% !important;
        max-height: 210px !important;
        margin-top: 7px !important;
        overflow-y: auto !important;
    }

    .header-nav-row .header-currency-form {
        display: grid !important;
        grid-template-columns: minmax(0, 1fr) auto !important;
        gap: 8px !important;
        align-items: center !important;
    }

    .header-nav-row .header-currency-form select {
        width: 100% !important;
        min-height: 52px !important;
        padding: 10px 14px !important;
        border: 1px solid #dbe3ee !important;
        border-radius: 14px !important;
        background: #ffffff !important;
        color: #0f172a !important;
        font-size: 16px !important;
        font-weight: 800 !important;
    }

    .header-nav-row .currency-submit {
        min-height: 52px !important;
        padding: 10px 15px !important;
        border: 1px solid #cbd5e1 !important;
        border-radius: 14px !important;
        background: #ffffff !important;
        color: #0f172a !important;
        font-weight: 800 !important;
    }

    .header-nav-row .nav .btn,
    .header-nav-row .nav > a[href="/pay-online"] {
        justify-content: center !important;
        border-color: #0f172a !important;
        background: #0f172a !important;
        color: #ffffff !important;
    }

    .header-nav-row .nav-login-link {
        justify-content: center !important;
        border-color: #0284c7 !important;
        background: #0284c7 !important;
        color: #ffffff !important;
    }

    .header-nav-row .nav-register-link {
        justify-content: center !important;
        border-color: #0f172a !important;
        background: #ffffff !important;
        color: #0f172a !important;
    }

    .header-nav-row .nav-inline-form {
        display: block !important;
    }

    .header-nav-row .nav .nav-link-button {
        appearance: none !important;
        justify-content: center !important;
        cursor: pointer !important;
        font-family: inherit !important;
    }

    .header-nav-row a:focus-visible,
    .header-nav-row summary:focus-visible,
    .header-nav-row button:focus-visible,
    .header-nav-row select:focus-visible,
    .header-nav-row input:focus-visible {
        outline: 3px solid rgba(14, 165, 233, 0.42) !important;
        outline-offset: 2px !important;
    }
}

@media (max-width: 420px) {
    .header-nav-row#siteMobileMenu {
        width: 100vw !important;
    }

    .header-nav-row .nav-container {
        padding-inline: 12px !important;
    }

    .brand span small {
        display: none;
    }
}

@media (prefers-reduced-motion: reduce) {
    .header-nav-row#siteMobileMenu {
        transition: none !important;
    }
}
