/**
 * Mobile bottom navigation — fixed bottom bar, mobile only.
 *
 * Loaded site-wide except on cart/checkout (see tsc_show_bottom_nav).
 * Self-contained literal values — renders outside the .tsc-* design-token
 * scopes (it appears on theme pages too: home, shop, product).
 */

/* Hidden by default — only the mobile media query reveals it. */
.tsc-bottomnav {
    display: none;
}

.tsc-bottomnav__item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    height: 56px;
    color: #0f0f0f;
    text-decoration: none;
}
.tsc-bottomnav__item.is-active {
    color: rgb(138, 138, 138) !important;
}
.tsc-bottomnav__icon {
    width: 24px;
    height: 24px;
}
.tsc-bottomnav__label {
    font-size: 11px;
    font-weight: 500;
    line-height: 1;
}
.tsc-bottomnav__item.is-active .tsc-bottomnav__label {
    font-weight: 600;
}

@media (max-width: 767px) {
    .tsc-bottomnav {
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 9990;
        display: flex;
        background: #ffffff;
        border-top: 1px solid #ececef;
        padding-bottom: env(safe-area-inset-bottom);
    }
    /* Clear space so page content isn't hidden behind the fixed nav. */
    body {
        padding-bottom: calc(56px + env(safe-area-inset-bottom));
    }
}

/* ============================================================
   Listing page cart bar (Shop, categories, tags) — replaces the nav
   once the cart has items (see tsc_print_listing_bar). Same look as
   the cart page's bottom bar; cart.css doesn't load here, so the
   free-shipping strip is styled again below, reading the same
   --tsc-freeship-* colours (Settings → Icons → Free shipping bar).
   ============================================================ */
.tsc-listbar {
    display: none;
}

@media (max-width: 767px) {
    .tsc-listbar {
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 9990;
        display: flex;
        flex-direction: column;
        background: #ffffff;
        border-top: 1px solid #ececef;
        padding-bottom: env(safe-area-inset-bottom);
    }
    body:has(.tsc-listbar) {
        padding-bottom: calc(64px + env(safe-area-inset-bottom));
    }
    body:has(.tsc-listbar .tsc-cart__freeship) {
        padding-bottom: calc(122px + env(safe-area-inset-bottom));
    }
}

.tsc-listbar__row {
    display: flex;
    align-items: center;
    gap: 12px;
    height: 64px;
    padding: 0 16px 0 10px;
}
.tsc-listbar__cart,
.tsc-listbar__cart:hover,
.tsc-listbar__cart:focus {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    color: #0f0f0f;
    text-decoration: none;
}
.tsc-listbar__cart .tsc-bottomnav__icon {
    width: 26px;
    height: 26px;
}
.tsc-listbar__total {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
}
.tsc-listbar__amount {
    color: #0f0f0f;
    font-size: 20px;
    font-weight: 700;
    line-height: 1.15;
}
.tsc-listbar__saving {
    color: #dc2626;
    font-size: 14px;
    font-weight: 400;
    line-height: 1.25;
}
.tsc-listbar__amount .woocommerce-Price-amount,
.tsc-listbar__saving .woocommerce-Price-amount {
    color: inherit;
    font-size: inherit;
    font-weight: inherit;
}

/* Checkout button — pinned like the cart page's, because it is an <a> and
   themes (and Elementor's link typography) underline and restyle links. */
.tsc-listbar .tsc-listbar__checkout,
.tsc-listbar .tsc-listbar__checkout:link,
.tsc-listbar .tsc-listbar__checkout:visited,
.tsc-listbar .tsc-listbar__checkout:hover,
.tsc-listbar .tsc-listbar__checkout:focus,
.tsc-listbar .tsc-listbar__checkout:active {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 110px;
    min-height: 44px;
    padding: 10px 24px;
    border: 0;
    border-radius: 999px;
    box-shadow: none;
    background: var(--global-palette-btn-bg, #000000) !important;
    color: var(--global-palette-btn, #ffffff) !important;
    font-size: 14px;
    font-weight: 600;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    text-decoration: none !important;
}

.tsc-listbar .tsc-cart__freeship {
    padding: 9px 16px 10px;
    border-bottom: 1px solid #ececef;
    background: var(--tsc-freeship-bg, #f4f4f5);
    color: var(--tsc-freeship-fg, #3f3f46);
}
.tsc-listbar .tsc-cart__freeship-text {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 7px;
    color: inherit;
    font-size: 14px;
    font-weight: 500;
    line-height: 1.3;
}
.tsc-listbar .tsc-cart__freeship-icon {
    flex: 0 0 auto;
}
.tsc-listbar .tsc-cart__freeship-text .woocommerce-Price-amount {
    color: inherit;
    font-weight: 600;
}
.tsc-listbar .tsc-cart__freeship-bar {
    height: 4px;
    overflow: hidden;
    border-radius: 999px;
    background: var(--tsc-freeship-track, #dedee2);
}
.tsc-listbar .tsc-cart__freeship-fill {
    display: block;
    height: 100%;
    border-radius: 999px;
    background: var(--tsc-freeship-fg, #3f3f46);
}
.tsc-listbar .tsc-cart__freeship.is-qualified .tsc-cart__freeship-fill {
    width: 100% !important;
}

/* ============================================================
   Product page bar (includes/product-bar.php): Home · Cart ·
   quantity · Add to cart. Replaces the nav on phones; the form's
   own quantity box and button hide while it shows.
   ============================================================ */
.tsc-pbar {
    display: none;
}

@media (max-width: 767px) {
    .tsc-pbar {
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 9990;
        display: flex;
        align-items: center;
        gap: 6px;
        box-sizing: border-box;
        padding: 8px 10px calc(8px + env(safe-area-inset-bottom));
        background: #ffffff;
        border-top: 1px solid #ececef;
    }
    body.tsc-has-pbar {
        padding-bottom: calc(64px + env(safe-area-inset-bottom));
    }
    body.tsc-has-pbar form.cart .quantity,
    body.tsc-has-pbar form.cart .single_add_to_cart_button {
        display: none !important;
    }
}

.tsc-pbar .tsc-pbar__link {
    flex: 0 0 44px;
    height: 48px;
}

/* Quantity pill: − 1 +. Themes style every <button> (Hello Commerce paints
   them grey/black with big padding), so these rules are locked with
   !important to keep the pill the same on every site. */
.tsc-pbar .tsc-pbar__qty {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    box-sizing: border-box;
    height: 40px;
    margin: 0;
    padding: 0 !important;
    border: 1px solid #ddd5c8 !important;
    border-radius: 999px !important;
    background: transparent !important;
    overflow: hidden;
}
.tsc-pbar .tsc-pbar__qty .tsc-pbar__step,
.tsc-pbar .tsc-pbar__qty .tsc-pbar__step:hover,
.tsc-pbar .tsc-pbar__qty .tsc-pbar__step:focus,
.tsc-pbar .tsc-pbar__qty .tsc-pbar__step:active {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    flex: 0 0 auto !important;
    box-sizing: border-box !important;
    width: 32px !important;
    min-width: 0 !important;
    height: 100% !important;
    min-height: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    border-radius: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
    color: #1e1a15 !important;
    font-family: inherit !important;
    font-size: 20px !important;
    font-weight: 700 !important;
    letter-spacing: 0 !important;
    line-height: 1 !important;
    text-transform: none !important;
    opacity: 1 !important;
    cursor: pointer;
}
.tsc-pbar .tsc-pbar__qty .tsc-pbar__step:disabled {
    color: #c4c0b8 !important;
    cursor: default;
}
.tsc-pbar .tsc-pbar__qty .tsc-pbar__qty-input,
.tsc-pbar .tsc-pbar__qty .tsc-pbar__qty-input:focus {
    box-sizing: border-box !important;
    width: 32px !important;
    min-width: 0 !important;
    height: 100% !important;
    min-height: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    border-radius: 0 !important;
    outline: none;
    background: transparent !important;
    box-shadow: none !important;
    color: #1e1a15 !important;
    font-family: inherit !important;
    font-size: 17px !important; /* 16px+ stops iPhone Safari zooming in on tap. */
    font-weight: 700 !important;
    line-height: 1 !important;
    text-align: center !important;
    -moz-appearance: textfield;
    appearance: textfield;
}
.tsc-pbar__qty-input::-webkit-outer-spin-button,
.tsc-pbar__qty-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

/* Add to cart: same look as the cart page's Checkout button: pill, TSC's
   button colours (Settings > Icons > Checkout buttons), uppercase. Locked
   with !important because themes restyle every button. */
.tsc-pbar .tsc-pbar__buy,
.tsc-pbar .tsc-pbar__buy:hover,
.tsc-pbar .tsc-pbar__buy:focus,
.tsc-pbar .tsc-pbar__buy:active {
    flex: 1;
    min-width: 0 !important;
    height: 44px !important;
    min-height: 0 !important;
    margin: 0 !important;
    padding: 0 14px !important;
    border: 0 !important;
    border-radius: 999px !important;
    background: var(--global-palette-btn-bg, #000000) !important;
    box-shadow: none !important;
    color: var(--global-palette-btn, #ffffff) !important;
    font-family: inherit !important;
    font-size: 14px !important;
    font-weight: 600 !important;
    letter-spacing: 0.02em !important;
    line-height: 1 !important;
    text-transform: uppercase !important;
    text-decoration: none !important;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    cursor: pointer;
}
.tsc-pbar .tsc-pbar__buy:disabled {
    border-color: transparent !important;
    background: #e5e1da !important;
    color: #8a8478 !important;
    cursor: default;
}
.tsc-pbar .tsc-pbar__buy.is-loading,
form.cart .single_add_to_cart_button.is-loading {
    opacity: 0.7;
    cursor: progress;
}

/* "Please choose your size first": the option pickers flash. */
.tsc-flash {
    animation: tsc-flash 1.5s ease-out;
    border-radius: 8px;
}
@keyframes tsc-flash {
    0%, 40% { box-shadow: 0 0 0 3px rgba(244, 118, 40, 0.55); }
    100% { box-shadow: 0 0 0 3px rgba(244, 118, 40, 0); }
}
