/**
 * MarketNext mobile UI — mirrors eTrade-style mobile home.
 * Scoped under body.theme-marketnext and max-width 991.98px so desktop is untouched.
 */

:root {
    --mn-m-blue: #3577f0;
    --mn-m-pink: #ff6b9d;
    --mn-m-pink-soft: #ffe4ef;
    --mn-m-bg: #f5f6fa;
    --mn-m-text: #1a1a2e;
    --mn-m-muted: #8c8c9a;
    --mn-m-card: #ffffff;
    --mn-m-radius: 14px;
    --mn-m-nav-h: 64px;
}

/* Brand mark (icon + text) — desktop + mobile */
body.theme-marketnext .mn-brand {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    color: var(--mn-m-blue, #3577f0);
    min-width: 0;
}

body.theme-marketnext .mn-brand .mn-brand-icon {
    width: 32px;
    height: 32px;
    object-fit: contain;
    flex-shrink: 0;
}

body.theme-marketnext .mn-brand .mn-brand-text {
    font-weight: 700;
    font-size: 22px;
    line-height: 1.1;
    font-family: Poppins, DM Sans, sans-serif;
    color: inherit;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

body.theme-marketnext .mn-brand .mn-brand-logo-img {
    max-height: 40px;
    width: auto;
    max-width: 160px;
    object-fit: contain;
}

body.theme-marketnext .header-brand .mn-brand.logo {
    max-width: 100%;
}

.mn-m-topbar,
.mn-m-search,
.mn-m-home,
.mn-m-bottom-nav {
    display: none !important;
}

/*
 * Product variant radios are visually hidden by the base styles
 * (opacity: 0; position: absolute) while the styled label is what the user
 * sees. They also inherit `width: 100%` and `height: 40px` from the generic
 * `button, input, select, textarea` rules, and because nothing around them is
 * positioned, that 100% resolves against the viewport. Every option in a
 * wrapped variant list therefore lays out a full viewport-wide box starting at
 * its own label, pushing the document far past the right edge and making the
 * whole page scroll sideways on phones. Being absolutely positioned against
 * the initial containing block, they are not clipped by overflow rules on
 * html/body, so the footprint has to be removed here.
 *
 * Not inside the mobile media query: the stray width breaks the document at
 * any viewport. 1px rather than 0 keeps the input focusable for accessibility.
 */
.product-variation .attribute-option-input,
.product-variations-wrapper .attribute-option-input {
    width: 1px;
    height: 1px;
    min-width: 0;
    min-height: 0;
    padding: 0;
    margin: 0;
}

@media (max-width: 991.98px) {
    body.theme-marketnext.mn-has-mobile-ui {
        background: var(--mn-m-bg);
        padding-bottom: calc(var(--mn-m-nav-h) + env(safe-area-inset-bottom, 0px));
    }

    /*
     * Kill page-level horizontal scroll. When the document is wider than the
     * viewport, mobile browsers pan the visual viewport and the fixed bottom
     * nav gets clipped, so its right-hand items become unreachable.
     * `clip` is used instead of `hidden` so the sticky mobile topbar keeps working.
     */
    html:has(> body.theme-marketnext.mn-has-mobile-ui),
    body.theme-marketnext.mn-has-mobile-ui {
        max-width: 100%;
        overflow-x: clip;
    }

    /* Common overflow sources on the non-mobile-native pages (product, cart, checkout…) */
    body.theme-marketnext.mn-has-mobile-ui img,
    body.theme-marketnext.mn-has-mobile-ui video,
    body.theme-marketnext.mn-has-mobile-ui iframe {
        max-width: 100%;
    }

    body.theme-marketnext.mn-has-mobile-ui .woocommerce-tabs .nav.tabs,
    body.theme-marketnext.mn-has-mobile-ui .tab-content table {
        max-width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    /* Collapse desktop header chrome; keep .header-main-nav for offcanvas menu */
    body.theme-marketnext.mn-has-mobile-ui .axil-header,
    body.theme-marketnext.mn-has-mobile-ui header.header.axil-header {
        position: static !important;
        height: 0 !important;
        min-height: 0 !important;
        padding: 0 !important;
        margin: 0 !important;
        border: 0 !important;
        background: transparent !important;
        box-shadow: none !important;
        overflow: visible !important;
    }

    body.theme-marketnext.mn-has-mobile-ui .axil-header > .header-top-campaign,
    body.theme-marketnext.mn-has-mobile-ui .axil-header > .axil-header-top,
    body.theme-marketnext.mn-has-mobile-ui .axil-header #axil-sticky-placeholder,
    body.theme-marketnext.mn-has-mobile-ui .axil-header .header-brand,
    body.theme-marketnext.mn-has-mobile-ui .axil-header .header-top-dropdown,
    body.theme-marketnext.mn-has-mobile-ui .axil-header .header-top-link,
    body.theme-marketnext.mn-has-mobile-ui .axil-header .header-action,
    body.theme-marketnext.mn-has-mobile-ui .axil-header .aside-category-area,
    body.theme-marketnext.mn-has-mobile-ui .axil-header .header-nav-department,
    body.theme-marketnext.mn-has-mobile-ui .axil-header .header-top-left,
    body.theme-marketnext.mn-has-mobile-ui .axil-header .header-top-right {
        display: none !important;
    }

    body.theme-marketnext.mn-has-mobile-ui .axil-header .axil-mainmenu {
        padding: 0 !important;
        margin: 0 !important;
        background: transparent !important;
        border: 0 !important;
        min-height: 0 !important;
    }

    body.theme-marketnext.mn-has-mobile-ui .axil-header .axil-mainmenu > .container {
        padding: 0 !important;
        margin: 0 !important;
        max-width: none !important;
        width: 100% !important;
    }

    body.theme-marketnext.mn-has-mobile-ui .axil-header .axil-mainmenu .row {
        margin: 0 !important;
    }

    body.theme-marketnext.mn-has-mobile-ui .axil-header .axil-mainmenu .row > [class*="col"] {
        padding: 0 !important;
        width: 100% !important;
        max-width: 100% !important;
        flex: 0 0 100% !important;
    }

    body.theme-marketnext.mn-has-mobile-ui .axil-header .header-navbar {
        display: block !important;
        padding: 0 !important;
        margin: 0 !important;
        border: 0 !important;
        background: transparent !important;
        min-height: 0 !important;
    }

    body.theme-marketnext.mn-has-mobile-ui .mn-desktop-home {
        display: none !important;
    }

    body.theme-marketnext.mn-has-mobile-ui .axil-footer-area,
    body.theme-marketnext.mn-has-mobile-ui footer.axil-footer-area {
        display: none !important;
    }

    body.theme-marketnext.mn-has-mobile-ui .back-to-top {
        bottom: calc(var(--mn-m-nav-h) + 16px);
    }

    .mn-m-topbar,
    .mn-m-search,
    .mn-m-home,
    .mn-m-bottom-nav {
        display: block !important;
    }

    /* ── Top bar ── */
    .mn-m-topbar {
        display: flex !important;
        align-items: center;
        justify-content: space-between;
        gap: 10px;
        padding: 12px 16px 8px;
        background: #fff;
        position: sticky;
        top: 0;
        z-index: 1020;
    }

    .mn-m-brand {
        display: inline-flex !important;
        align-items: center;
        gap: 8px;
        text-decoration: none;
        color: var(--mn-m-blue);
        font-weight: 700;
        font-size: 20px;
        font-family: Poppins, DM Sans, sans-serif;
        min-width: 0;
    }

    .mn-m-brand .mn-brand-logo-img {
        height: 28px;
        width: auto;
        max-width: 120px;
        object-fit: contain;
    }

    .mn-m-brand .mn-brand-icon {
        width: 28px;
        height: 28px;
        object-fit: contain;
        flex-shrink: 0;
    }

    .mn-m-brand .mn-brand-text {
        font-size: 20px;
        font-weight: 700;
        color: var(--mn-m-blue);
    }

    .mn-m-brand-mark {
        width: 28px;
        height: 28px;
        border-radius: 8px;
        background: var(--mn-m-blue);
        color: #fff;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        font-size: 14px;
        flex-shrink: 0;
    }

    .mn-m-topbar-actions {
        display: flex;
        align-items: center;
        gap: 8px;
        flex-shrink: 0;
    }

    .mn-m-currency {
        position: relative;
    }

    .mn-m-currency-btn {
        display: inline-flex;
        align-items: center;
        gap: 6px;
        padding: 8px 12px;
        border: 1px solid #e6e8f0;
        border-radius: 10px;
        background: #fff;
        color: var(--mn-m-text);
        font-size: 13px;
        font-weight: 600;
        line-height: 1;
    }

    .mn-m-currency-btn i {
        font-size: 11px;
        color: var(--mn-m-muted);
    }

    .mn-m-currency-menu {
        position: absolute;
        top: calc(100% + 6px);
        right: 0;
        min-width: 120px;
        background: #fff;
        border: 1px solid #eef0f5;
        border-radius: 10px;
        box-shadow: 0 10px 28px rgba(26, 26, 46, 0.12);
        padding: 6px 0;
        display: none;
        z-index: 1030;
    }

    .mn-m-currency.is-open .mn-m-currency-menu {
        display: block;
    }

    .mn-m-currency-menu a {
        display: block;
        padding: 8px 14px;
        color: var(--mn-m-text);
        text-decoration: none;
        font-size: 13px;
    }

    .mn-m-currency-menu a:hover,
    .mn-m-currency-menu a.is-active {
        background: rgba(53, 119, 240, 0.08);
        color: var(--mn-m-blue);
    }

    .mn-m-icon-btn {
        position: relative;
        width: 40px;
        height: 40px;
        border: 0;
        background: transparent;
        color: var(--mn-m-text);
        display: inline-flex;
        align-items: center;
        justify-content: center;
        font-size: 20px;
        text-decoration: none;
        border-radius: 10px;
        padding: 0;
    }

    .mn-m-icon-btn .mn-m-badge {
        position: absolute;
        top: 4px;
        right: 2px;
        min-width: 16px;
        height: 16px;
        padding: 0 4px;
        border-radius: 999px;
        background: var(--mn-m-blue);
        color: #fff;
        font-size: 10px;
        font-weight: 700;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        line-height: 1;
    }

    /* ── Search ── */
    .mn-m-search {
        padding: 4px 16px 12px;
        background: #fff;
    }

    .mn-m-search-form {
        display: flex !important;
        flex-direction: row !important;
        align-items: center !important;
        flex-wrap: nowrap !important;
        gap: 0;
        width: 100%;
        background: #fff;
        border: 1px solid #e4e7ef;
        border-radius: 12px;
        overflow: hidden;
        padding: 4px 4px 4px 12px;
        margin: 0;
    }

    .mn-m-search-form > i {
        color: var(--mn-m-muted);
        font-size: 16px;
        flex: 0 0 auto;
        line-height: 1;
    }

    .mn-m-search-form input[type="search"],
    .mn-m-search-form input {
        flex: 1 1 auto !important;
        width: auto !important;
        max-width: none !important;
        min-width: 0 !important;
        border: 0 !important;
        outline: 0 !important;
        box-shadow: none !important;
        background: transparent !important;
        padding: 10px 8px !important;
        margin: 0 !important;
        font-size: 14px;
        color: var(--mn-m-text);
        height: auto !important;
        line-height: 1.4;
        -webkit-appearance: none;
        appearance: none;
    }

    .mn-m-search-form input::placeholder {
        color: #b0b3c0;
    }

    .mn-m-search-form button[type="submit"] {
        flex: 0 0 auto !important;
        width: auto !important;
        max-width: none !important;
        min-width: 0 !important;
        border: 0 !important;
        background: var(--mn-m-blue) !important;
        color: #fff !important;
        font-weight: 600;
        font-size: 13px;
        line-height: 1;
        padding: 11px 16px !important;
        border-radius: 10px !important;
        margin: 0 !important;
        white-space: nowrap;
        height: auto !important;
        display: inline-flex !important;
        align-items: center;
        justify-content: center;
    }

    /* ── Home storefront ── */
    .mn-m-home {
        padding: 4px 0 8px;
    }

    .mn-m-section {
        padding: 0 16px;
        margin-bottom: 22px;
    }

    .mn-m-cats {
        display: flex;
        gap: 14px;
        overflow-x: auto;
        padding: 8px 16px 14px;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }

    .mn-m-cats::-webkit-scrollbar {
        display: none;
    }

    .mn-m-cat {
        flex: 0 0 auto;
        width: 64px;
        text-align: center;
        text-decoration: none;
        color: var(--mn-m-text);
    }

    .mn-m-cat-icon {
        width: 56px;
        height: 56px;
        margin: 0 auto 8px;
        border-radius: 50%;
        background: #eef1f7;
        display: flex;
        align-items: center;
        justify-content: center;
        overflow: hidden;
    }

    .mn-m-cat-icon img {
        width: 32px;
        height: 32px;
        object-fit: contain;
    }

    .mn-m-cat-icon i {
        font-size: 20px;
        color: var(--mn-m-text);
    }

    .mn-m-cat.is-active .mn-m-cat-icon {
        background: var(--mn-m-blue);
        border-radius: 16px;
        color: #fff;
    }

    .mn-m-cat.is-active .mn-m-cat-icon i {
        color: #fff;
    }

    .mn-m-cat-label {
        display: block;
        font-size: 12px;
        font-weight: 500;
        color: var(--mn-m-text);
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    /* Hero */
    .mn-m-hero {
        margin: 0 16px 22px;
        border-radius: 18px;
        background: linear-gradient(135deg, #fff5f9 0%, #ffe4ef 55%, #fff 100%);
        overflow: hidden;
        position: relative;
        min-height: 168px;
    }

    .mn-m-hero-slide {
        display: none;
        padding: 20px 16px 28px;
        min-height: 168px;
        align-items: center;
        gap: 8px;
    }

    .mn-m-hero-slide.is-active {
        display: flex;
    }

    .mn-m-hero-copy {
        flex: 1;
        min-width: 0;
        z-index: 1;
    }

    .mn-m-hero-eyebrow {
        display: inline-flex;
        align-items: center;
        gap: 6px;
        color: var(--mn-m-pink);
        font-size: 12px;
        font-weight: 600;
        margin-bottom: 6px;
    }

    .mn-m-hero-sub {
        font-size: 13px;
        color: #5c5c6e;
        margin: 0 0 4px;
    }

    .mn-m-hero-title {
        font-size: 22px;
        font-weight: 700;
        color: var(--mn-m-text);
        line-height: 1.25;
        margin: 0 0 10px;
        font-family: Poppins, DM Sans, sans-serif;
    }

    .mn-m-hero-cta {
        color: var(--mn-m-text);
        font-weight: 600;
        font-size: 14px;
        text-decoration: none;
        border-bottom: 1px solid var(--mn-m-text);
        display: inline-flex;
        align-items: center;
        gap: 6px;
        padding-bottom: 1px;
    }

    .mn-m-hero-media {
        flex: 0 0 42%;
        max-width: 150px;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .mn-m-hero-media img {
        max-width: 100%;
        max-height: 130px;
        object-fit: contain;
    }

    .mn-m-hero-dots {
        position: absolute;
        left: 0;
        right: 0;
        bottom: 10px;
        display: flex;
        justify-content: center;
        gap: 6px;
    }

    .mn-m-hero-dot {
        width: 7px;
        height: 7px;
        border-radius: 999px;
        background: #d0d3de;
        border: 0;
        padding: 0;
    }

    .mn-m-hero-dot.is-active {
        width: 18px;
        background: var(--mn-m-pink);
    }

    /* Flash deals */
    .mn-m-flash-head {
        display: flex;
        align-items: center;
        justify-content: space-between;
        margin-bottom: 6px;
    }

    .mn-m-flash-head h3 {
        margin: 0;
        font-size: 18px;
        font-weight: 700;
        color: var(--mn-m-text);
        display: flex;
        align-items: center;
        gap: 6px;
    }

    .mn-m-flash-head a {
        color: var(--mn-m-blue);
        font-size: 13px;
        font-weight: 600;
        text-decoration: none;
    }

    .mn-m-flash-timer {
        color: var(--mn-m-pink);
        font-weight: 700;
        font-size: 16px;
        letter-spacing: 0.04em;
        margin-bottom: 12px;
        font-variant-numeric: tabular-nums;
    }

    .mn-m-flash-track {
        display: flex;
        gap: 12px;
        overflow-x: auto;
        padding-bottom: 4px;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }

    .mn-m-flash-track::-webkit-scrollbar {
        display: none;
    }

    .mn-m-flash-card {
        flex: 0 0 148px;
        background: var(--mn-m-card);
        border: 1px solid #eef0f5;
        border-radius: 14px;
        padding: 10px;
        position: relative;
        text-decoration: none;
        color: inherit;
    }

    .mn-m-flash-badge {
        position: absolute;
        top: 10px;
        left: 10px;
        z-index: 1;
        background: var(--mn-m-pink);
        color: #fff;
        font-size: 11px;
        font-weight: 700;
        padding: 3px 8px;
        border-radius: 999px;
    }

    .mn-m-flash-img {
        height: 110px;
        display: flex;
        align-items: center;
        justify-content: center;
        margin-bottom: 8px;
    }

    .mn-m-flash-img img {
        max-width: 100%;
        max-height: 100%;
        object-fit: contain;
    }

    .mn-m-flash-name {
        font-size: 13px;
        font-weight: 600;
        color: var(--mn-m-text);
        margin: 0 0 6px;
        line-height: 1.3;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
        min-height: 2.6em;
    }

    .mn-m-flash-row {
        display: flex;
        align-items: flex-end;
        justify-content: space-between;
        gap: 6px;
    }

    .mn-m-flash-prices {
        min-width: 0;
    }

    .mn-m-flash-price {
        display: block;
        color: var(--mn-m-pink);
        font-weight: 700;
        font-size: 14px;
    }

    .mn-m-flash-old {
        color: var(--mn-m-muted);
        font-size: 11px;
        text-decoration: line-through;
    }

    .mn-m-flash-add {
        width: 32px;
        height: 32px;
        border-radius: 50%;
        background: var(--mn-m-blue);
        color: #fff;
        border: 0;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        flex-shrink: 0;
        font-size: 16px;
        text-decoration: none;
    }

    /* Trust features */
    .mn-m-trust {
        display: grid;
        grid-template-columns: repeat(4, 1fr);
        gap: 8px;
        text-align: center;
    }

    .mn-m-trust-item i {
        color: var(--mn-m-blue);
        font-size: 22px;
        margin-bottom: 6px;
        display: block;
    }

    .mn-m-trust-item strong {
        display: block;
        font-size: 11px;
        color: var(--mn-m-text);
        font-weight: 700;
        line-height: 1.25;
        margin-bottom: 2px;
    }

    .mn-m-trust-item span {
        display: block;
        font-size: 10px;
        color: var(--mn-m-muted);
        line-height: 1.3;
    }

    /* Bottom nav — 4 fixed columns, never scrolls */
    .mn-m-bottom-nav {
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        width: 100%;
        max-width: 100vw;
        box-sizing: border-box;
        z-index: 1040;
        background: #fff;
        border-top: 1px solid #eef0f5;
        padding: 6px 8px calc(6px + env(safe-area-inset-bottom, 0px));
        display: grid !important;
        grid-template-columns: repeat(4, minmax(0, 1fr));
        gap: 2px;
        overflow: hidden;
        box-shadow: 0 -6px 20px rgba(26, 26, 46, 0.06);
    }

    .mn-m-bottom-nav a {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 3px;
        text-decoration: none;
        color: var(--mn-m-muted);
        font-size: 10px;
        font-weight: 500;
        padding: 6px 2px;
        position: relative;
        min-width: 0;
        overflow: hidden;
    }

    .mn-m-bottom-nav a span {
        max-width: 100%;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .mn-m-bottom-nav a i {
        font-size: 20px;
        line-height: 1;
    }

    .mn-m-bottom-nav a.is-active {
        color: var(--mn-m-blue);
    }

    .mn-m-bottom-nav .mn-m-badge {
        position: absolute;
        top: 2px;
        right: calc(50% - 18px);
        min-width: 16px;
        height: 16px;
        padding: 0 4px;
        border-radius: 999px;
        background: var(--mn-m-blue);
        color: #fff;
        font-size: 9px;
        font-weight: 700;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }
}
