/* Trường Thịnh Child v3.9.3 — compact mobile header + app bottom nav */
:root {
    --tt-mobile-header-h: 46px;
    --tt-mobile-nav-h: 62px;
}

.tt-mobile-app-header,
.tt-mobile-bottom-nav {
    display: none;
}

/* v3.11.12 — desktop guard: mobile UI markup is rendered server-side,
 * therefore the base hide rules must also apply when desktop CSS is evaluated. */
@media (min-width: 850px) {
    html body .tt-mobile-app-header,
    html body .tt-mobile-bottom-nav {
        display: none !important;
        visibility: hidden !important;
        opacity: 0 !important;
        pointer-events: none !important;
        width: 0 !important;
        height: 0 !important;
        min-height: 0 !important;
        max-height: 0 !important;
        margin: 0 !important;
        padding: 0 !important;
        overflow: hidden !important;
    }
}


@media (max-width: 849px) {
    /* Replace the oversized Flatsome mobile header with the compact toolbar. */
    body #header,
    body #top-bar,
    body .header-wrapper,
    body .header-main,
    body #wide-nav {
        display: none !important;
    }

    body {
        padding-bottom: calc(var(--tt-mobile-nav-h) + env(safe-area-inset-bottom, 0px));
    }

    .tt-mobile-app-header {
        position: sticky;
        top: 0;
        z-index: 9997;
        display: flex;
        align-items: center;
        gap: 7px;
        width: 100%;
        min-height: var(--tt-mobile-header-h);
        padding: 5px 9px;
        background: var(--tt-primary, var(--primary-color, #d9232e));
        box-shadow: 0 2px 10px rgba(15, 23, 42, .08);
    }

    body.admin-bar .tt-mobile-app-header { top: 46px; }

    .tt-mobile-app-search {
        position: relative;
        display: flex !important;
        flex: 1 1 auto;
        align-items: center;
        height: 36px !important;
        min-height: 36px !important;
        margin: 0 !important;
        padding: 0 !important;
        overflow: hidden;
        border: 1px solid rgba(15, 23, 42, .12) !important;
        border-radius: 10px !important;
        background: #fff !important;
        box-shadow: none !important;
    }

    .tt-mobile-app-search input[type="search"] {
        flex: 1 1 auto;
        width: 100%;
        min-width: 0;
        height: 34px !important;
        min-height: 34px !important;
        margin: 0 !important;
        padding: 0 9px !important;
        border: 0 !important;
        border-radius: 0 !important;
        background: transparent !important;
        box-shadow: none !important;
        color: #273142 !important;
        font-size: 14px !important;
        line-height: 34px !important;
    }

    .tt-mobile-app-search input[type="search"]::placeholder {
        color: #8791a3;
        opacity: 1;
    }

    body .tt-mobile-app-header .tt-mobile-app-search button.tt-mobile-search-submit[type="submit"] {
        display: inline-flex !important;
        flex: 0 0 36px !important;
        align-items: center !important;
        justify-content: center !important;
        width: 36px !important;
        min-width: 36px !important;
        height: 34px !important;
        min-height: 34px !important;
        margin: 0 !important;
        padding: 0 !important;
        border: 0 !important;
        border-radius: 0 !important;
        background: transparent !important;
        box-shadow: none !important;
        color: #1f2937 !important;
        outline: 0 !important;
        appearance: none !important;
        -webkit-appearance: none !important;
        text-shadow: none !important;
        filter: none !important;
        transform: none !important;
        -webkit-tap-highlight-color: transparent;
    }

    body .tt-mobile-app-header .tt-mobile-app-search button.tt-mobile-search-submit[type="submit"]:hover,
    body .tt-mobile-app-header .tt-mobile-app-search button.tt-mobile-search-submit[type="submit"]:focus,
    body .tt-mobile-app-header .tt-mobile-app-search button.tt-mobile-search-submit[type="submit"]:active {
        border: 0 !important;
        border-radius: 0 !important;
        background: transparent !important;
        box-shadow: none !important;
        outline: 0 !important;
        color: #1f2937 !important;
        transform: none !important;
    }

    body .tt-mobile-app-header .tt-mobile-app-search button.tt-mobile-search-submit[type="submit"]::before,
    body .tt-mobile-app-header .tt-mobile-app-search button.tt-mobile-search-submit[type="submit"]::after { display: none !important; }

    .tt-mobile-app-search svg,
    .tt-mobile-app-header__cart svg,
    .tt-mobile-bottom-nav svg {
        display: block;
        width: 21px;
        height: 21px;
        fill: none;
        stroke: currentColor;
        stroke-width: 1.9;
        stroke-linecap: round;
        stroke-linejoin: round;
    }

    .tt-mobile-app-search svg { width: 19px; height: 19px; }

    .tt-mobile-app-header__cart {
        position: relative;
        display: inline-flex;
        flex: 0 0 38px;
        align-items: center;
        justify-content: center;
        width: 38px;
        height: 36px;
        border: 0 !important;
        border-radius: 9px;
        background: transparent !important;
        color: #fff !important;
        box-shadow: none !important;
        text-decoration: none !important;
    }

    .tt-mobile-app-header__cart svg { width: 23px; height: 23px; }

    .tt-mobile-app-header__cart-count {
        position: absolute;
        top: -2px;
        right: -1px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        min-width: 17px;
        height: 17px;
        padding: 0 4px;
        border: 2px solid var(--tt-primary, var(--primary-color, #d9232e));
        border-radius: 999px;
        background: #fff;
        color: var(--tt-primary, var(--primary-color, #d9232e));
        font-size: 11px !important;
        font-weight: 800;
        line-height: 1;
    }

    .tt-mobile-app-header__cart-count.is-empty { display: none; }

    .tt-mobile-bottom-nav {
        position: fixed;
        right: 0;
        bottom: 0;
        left: 0;
        z-index: 9998;
        display: grid;
        grid-template-columns: repeat(5, minmax(0, 1fr));
        min-height: calc(var(--tt-mobile-nav-h) + env(safe-area-inset-bottom, 0px));
        padding: 5px 4px env(safe-area-inset-bottom, 0px);
        border-top: 1px solid #e8ebf0;
        border-radius: 16px 16px 0 0;
        background: rgba(255,255,255,.98);
        box-shadow: 0 -5px 22px rgba(15,23,42,.11);
        backdrop-filter: blur(12px);
        -webkit-backdrop-filter: blur(12px);
    }

    .tt-mobile-bottom-nav__item {
        position: relative;
        display: flex;
        min-width: 0;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 2px;
        padding: 2px 1px;
        border: 0 !important;
        background: transparent !important;
        color: #667085 !important;
        box-shadow: none !important;
        font-size: 13px !important;
        line-height: 1.1;
        text-align: center;
        text-decoration: none !important;
        transform: none !important;
    }

    .tt-mobile-bottom-nav__item:hover,
    .tt-mobile-bottom-nav__item:focus,
    .tt-mobile-bottom-nav__item.is-active {
        color: var(--tt-primary, var(--primary-color, #d9232e)) !important;
        background: transparent !important;
    }

    .tt-mobile-bottom-nav__icon {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 27px;
        height: 27px;
    }

    .tt-mobile-bottom-nav__item.is-active .tt-mobile-bottom-nav__icon {
        border-radius: 999px;
        background: var(--tt-primary-softer, rgba(217,35,46,.08));
    }

    .tt-mobile-bottom-nav__label {
        display: block;
        max-width: 100%;
        overflow: hidden;
        white-space: nowrap;
        text-overflow: ellipsis;
        font-size: 12px !important;
        font-weight: 650;
    }

    /* Product sticky CTA sits above the global app navigation instead of covering it. */
    body.single-product .tt-mobile-product-bar {
        bottom: calc(var(--tt-mobile-nav-h) + env(safe-area-inset-bottom, 0px)) !important;
        z-index: 9996 !important;
    }

    body.single-product {
        padding-bottom: calc(var(--tt-mobile-nav-h) + 70px + env(safe-area-inset-bottom, 0px));
    }
}

@media (max-width: 380px) {
    :root { --tt-mobile-nav-h: 58px; }
    .tt-mobile-app-header { padding-inline: 7px; }
    .tt-mobile-app-search input[type="search"] { font-size: 13px !important; }
    .tt-mobile-bottom-nav__label { font-size: 11px !important; }
    .tt-mobile-bottom-nav__icon { width: 25px; height: 25px; }
    .tt-mobile-bottom-nav svg { width: 20px; height: 20px; }
}

/* v3.9.4 — remove WordPress/Flatsome reserved top space on mobile. */
@media (max-width: 849px) {
    html,
    html.wp-toolbar,
    html:has(body.admin-bar) {
        margin-top: 0 !important;
        padding-top: 0 !important;
    }

    body,
    body.admin-bar {
        margin-top: 0 !important;
        padding-top: 0 !important;
    }

    /* On the app-style mobile frontend the WP toolbar only wastes vertical space. */
    body #wpadminbar {
        display: none !important;
        width: 0 !important;
        height: 0 !important;
        min-height: 0 !important;
        overflow: hidden !important;
    }

    /* Remove any height still reserved by Flatsome's original header placeholders. */
    body #header,
    body #top-bar,
    body .header-wrapper,
    body .header-main,
    body #wide-nav,
    body .header-bg-container,
    body .header-shadow,
    body .header-block,
    body .stuck-placeholder,
    body .header-placeholder {
        display: none !important;
        width: 0 !important;
        height: 0 !important;
        min-height: 0 !important;
        max-height: 0 !important;
        margin: 0 !important;
        padding: 0 !important;
        border: 0 !important;
    }

    body.admin-bar .tt-mobile-app-header,
    .tt-mobile-app-header {
        top: 0 !important;
        margin-top: 0 !important;
    }
}

/* v3.12.0: final compact sale/stock labels on mobile product cards. */
@media (max-width: 549px) {
    body .tt-card__badges {
        inset: 6px 6px auto 6px !important;
        gap: 4px !important;
    }
    body .tt-card__badge,
    body .tt-card__stock,
    body .tt-card__eyebrow,
    body .product-small .badge-container .badge,
    body .product-small .badge-container .badge-inner,
    body .product-small .onsale,
    body .products .product .onsale,
    body .tt-loop-stock-label {
        min-width: 0 !important;
        min-height: 19px !important;
        height: auto !important;
        padding: 2px 6px !important;
        border-width: 1px !important;
        border-radius: 5px !important;
        font-size: 9.5px !important;
        line-height: 1.05 !important;
        letter-spacing: 0 !important;
        white-space: nowrap !important;
        box-shadow: none !important;
    }
    body .product-small .badge-container,
    body .products .product .badge-container {
        top: 6px !important;
        left: 6px !important;
        margin: 0 !important;
    }
}
