/* ---------------------------------------------------------------------
   Mobile-first responsive layer (loaded after web.css)
   --------------------------------------------------------------------- */
:root {
    --dock-h: 60px;
    --safe-bottom: env(safe-area-inset-bottom, 0px);
    --whatsapp: #25d366;
}

/* Never let a stray element create sideways scroll (clip keeps sticky working) */
html,
body {
    max-width: 100%;
    overflow-x: clip;
}

img,
video {
    max-width: 100%;
}

.w-100 {
    width: 100% !important;
}

/* ---------- Floating quick actions (all sizes) ---------- */
.quick-actions {
    position: fixed;
    right: 16px;
    bottom: calc(16px + var(--safe-bottom));
    z-index: 1040;
    display: flex;
    flex-direction: column-reverse;
    align-items: center;
    gap: 10px;
}

.quick-action {
    width: 48px;
    height: 48px;
    border: 0;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 1.35rem;
    box-shadow: 0 6px 16px rgba(0, 0, 0, .22);
    transition: transform .15s, opacity .2s;
    -webkit-tap-highlight-color: transparent;
}

.quick-action:active {
    transform: scale(.92);
}

.quick-action-whatsapp {
    background: var(--whatsapp);
    color: #fff;
}

.quick-action-whatsapp:hover {
    color: #fff;
}

.quick-action-top {
    background: var(--xfix-primary-dark, #0b3d91);
    width: 40px;
    height: 40px;
    font-size: 1.1rem;
    opacity: 0;
    pointer-events: none;
    transform: translateY(8px);
}

.quick-action-top.visible {
    opacity: 1;
    pointer-events: auto;
    transform: none;
}

/* ---------- Mobile bottom navigation ---------- */
.mobile-dock {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1045;
    display: flex;
    height: calc(var(--dock-h) + var(--safe-bottom));
    padding-bottom: var(--safe-bottom);
    background: #fff;
    border-top: 1px solid rgba(0, 0, 0, .08);
    box-shadow: 0 -4px 14px rgba(0, 0, 0, .06);
}

.mobile-dock-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    color: var(--xfix-text-muted, #6b7280);
    font-size: .7rem;
    font-weight: 500;
    -webkit-tap-highlight-color: transparent;
}

.mobile-dock-item i {
    font-size: 1.35rem;
    line-height: 1;
}

.mobile-dock-item.active {
    color: var(--xfix-primary, #0170ff);
}

.mobile-dock-badge {
    position: absolute;
    top: -6px;
    right: -10px;
    min-width: 18px;
    padding: 0 5px;
    border-radius: 999px;
    background: #dc3545;
    color: #fff;
    font-size: .62rem;
    line-height: 18px;
    text-align: center;
}

/* ---------- Below lg: phones & tablets ---------- */
@media (max-width: 991.98px) {

    /* keep content and footer clear of the dock */
    body.bodyContainer {
        padding-bottom: calc(var(--dock-h) + var(--safe-bottom));
    }

    /* lift floating buttons above the dock */
    .quick-actions {
        bottom: calc(var(--dock-h) + var(--safe-bottom) + 14px);
    }

    /* account page is viewport-locked: leave room for the dock */
    html.account-locked #mainContent {
        height: calc(100vh - var(--account-top, 0px) - var(--dock-h) - var(--safe-bottom));
    }
}

/* ---------- Phones ---------- */
@media (max-width: 767.98px) {

    /* Utility bar: icons only, no wrapping */
    .top-util-navbar .container-fluid {
        padding-left: .75rem;
        padding-right: .75rem;
    }

    /* Hero carousel */
    #heroCarousel .carousel-item {
        padding-top: .5rem !important;
        padding-bottom: 2.5rem !important;
    }

    #heroCarousel .carousel-item .container {
        padding-top: 1.25rem !important;
        padding-bottom: 1rem !important;
    }

    #heroCarousel h1.display-5 {
        font-size: 1.5rem;
    }

    #heroCarousel .lead {
        font-size: .95rem;
    }

    #heroCarousel .btn-lg {
        padding: .5rem 1.25rem;
        font-size: .95rem;
    }

    #heroCarousel img {
        height: auto !important;
        max-height: 180px;
        width: 100%;
        object-fit: cover;
        margin-top: 1rem;
    }

    #heroCarousel .carousel-indicators {
        margin-bottom: .5rem;
    }

    #heroCarousel .carousel-control-prev,
    #heroCarousel .carousel-control-next {
        display: none;
    }

    /* Promotion sections: tighter rhythm, two cards per row */
    .promotion-section {
        margin-top: 1.5rem !important;
        margin-bottom: 1.5rem !important;
        padding-left: .75rem;
        padding-right: .75rem;
    }

    .promotion-section .product-container {
        --bs-gutter-x: .75rem;
        --bs-gutter-y: .75rem;
    }

    .promotion-section .product-container > [class*="col-"] {
        width: 50%;
    }

    /* Trust badges */
    .bg-xfix-light .col-6 h6 {
        font-size: .8rem;
    }

    /* Footer */
    footer .row.g-5 {
        --bs-gutter-y: 1.5rem;
    }

    footer {
        text-align: center;
    }

    footer .d-flex {
        justify-content: center;
    }

    /* Toasts and modals fit small screens */
    .modal-xl,
    .modal-xxl {
        max-width: 100% !important;
        margin: 0;
    }

    /* Comfortable touch targets */
    .btn,
    .form-control,
    .form-select {
        min-height: 44px;
    }
}


/* ---------------------------------------------------------------------
   Shop / categorized / branded pages
   --------------------------------------------------------------------- */
.filters-fab {
    position: fixed;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    z-index: 1040;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 44px;
    padding: 0;
    border: 0;
    border-radius: 0 12px 12px 0;
    background: var(--xfix-primary, #0170ff);
    color: #fff;
    opacity: .85;
    box-shadow: 2px 2px 8px rgba(0, 0, 0, .2);
}

.filters-fab .filters-fab-label {
    display: none;
}

.filters-backdrop {
    position: fixed;
    inset: 0;
    z-index: 1049;
    background: rgba(0, 0, 0, .45);
    opacity: 0;
    pointer-events: none;
    transition: opacity .2s;
}

@media (max-width: 991.98px) {

    /* Filters become an off-canvas drawer */
    #shopSidebar.shop-sidebar {
        position: fixed !important;
        top: 0 !important;
        left: 0;
        bottom: 0;
        width: 88%;
        max-width: 340px;
        height: 100%;
        z-index: 1050;
        padding: 0;
        background: #fff;
        overflow-y: auto;
        transform: translateX(-105%);
        visibility: hidden;
        transition: transform .25s ease, visibility .25s;
        box-shadow: 4px 0 20px rgba(0, 0, 0, .2);
    }

    #shopSidebar .card-xfix {
        position: static !important;
        height: auto;
        padding-bottom: calc(1.5rem + var(--safe-bottom)) !important;
        border-radius: 0;
    }

    html.filters-open #shopSidebar.shop-sidebar {
        transform: none;
        visibility: visible;
    }

    html.filters-open .filters-backdrop {
        opacity: 1;
        pointer-events: auto;
    }

    html.filters-open,
    html.filters-open body {
        overflow: hidden;
    }

    /* hide floating buttons while the drawer is open */
    html.filters-open .filters-fab,
    html.filters-open .quick-actions {
        display: none;
    }

    .shop-page {
        padding-top: .75rem !important;
    }

    .shop-page .container-fluid {
        padding-left: .75rem;
        padding-right: .75rem;
    }
}

@media (max-width: 767.98px) {

    /* Sort bar: count on its own line, sort select full width */
    .shop-page .d-flex.justify-content-between.flex-wrap {
        flex-direction: column;
        align-items: stretch !important;
        margin-bottom: 1rem !important;
    }

    .shop-page .d-flex.justify-content-between.flex-wrap > .d-flex {
        justify-content: space-between;
    }

    .shop-page #sort-select {
        flex: 1;
        max-width: 65%;
    }

    /* Two products per row */
    .shop-page .product-container {
        --bs-gutter-x: .75rem;
        --bs-gutter-y: .75rem;
    }

    .shop-page .product-container > [class*="col-"] {
        width: 50%;
    }
}


/* ---------------------------------------------------------------------
   Navbar side menu (mobile): the toggler opens an offcanvas drawer
   --------------------------------------------------------------------- */
@media (max-width: 991.98px) {
    .navbar-offcanvas {
        width: 86%;
        max-width: 360px;
        z-index: 1060;
    }

    /* The drawer lives inside the sticky navbar's stacking context, so lift the navbar above the top utility bar while it is open */
    html:has(.navbar-offcanvas.show) .navbar-main,
    html:has(.navbar-offcanvas.showing) .navbar-main {
        z-index: 1100 !important;
    }

    .navbar-main .navbar-toggler {
        padding: .2rem .45rem;
        font-size: .95rem;
    }

    .navbar-main .navbar-toggler-icon {
        width: 1.2em;
        height: 1.2em;
    }

    .navbar-offcanvas .offcanvas-body {
        overflow-y: auto;
        padding-bottom: calc(1.5rem + var(--safe-bottom));
    }

    .navbar-offcanvas .navbar-nav {
        margin-left: 0 !important;
    }

    /* Menu links read as tappable rows */
    .navbar-offcanvas .nav-link {
        padding: .75rem 0;
        border-bottom: 1px solid rgba(0, 0, 0, .06);
    }

    .navbar-offcanvas .dropdown-menu {
        box-shadow: none !important;
        background: #f8f9fb;
        padding: .5rem;
        margin-top: .25rem;
        max-height: 320px;
    }

    /* Search + cart sit nicely inside the drawer */
    .navbar-offcanvas form[role="search"] {
        margin-top: 0 !important;
    }

    .navbar-offcanvas .search-results-dropdown {
        max-height: 260px;
    }

    html:has(.navbar-offcanvas.show) .quick-actions,
    html:has(.navbar-offcanvas.show) .mobile-dock {
        display: none;
    }
}

@media (min-width: 992px) {
    .navbar-offcanvas .offcanvas-body {
        padding: 0;
        overflow: visible;
    }
}

/* Checkout: summary card sticks on desktop but scrolls internally instead of clipping */
@media (min-width: 992px) {
  .checkout-summary-card { position: sticky; top: 20px; max-height: calc(100vh - 40px); overflow-y: auto; }
}


/* Navbar search: fluid on small screens, wide on large screens */
.navbar-search .form-control { min-height: 44px; font-size: 1rem; }
@media (min-width: 992px) {
  .navbar-search { flex: 1 1 320px; width: auto !important; min-width: 260px; max-width: 520px; }
  .navbar-search .form-control { min-height: 46px; padding-left: 1.25rem; }
}
@media (min-width: 1400px) {
  .navbar-search { flex-basis: 480px; max-width: 640px; }
}


/* Navbar: let the menu area fill the bar so the search is not clipped */
@media (min-width: 992px) {
  .navbar-offcanvas { flex-grow: 1; min-width: 0; }
  .navbar-offcanvas .offcanvas-body { min-width: 0; }
  .navbar-search { flex: 1 1 auto; min-width: 0; max-width: 720px; }
}


/* Large screens: center the search between the brand and the nav links */
@media (min-width: 992px) {
  .navbar-offcanvas .navbar-nav { margin-left: 0 !important; }
  .navbar-search { margin-left: auto !important; margin-right: auto !important; width: 100%; }
}


/* Product card add-to-cart: compact label that never wraps */
.add-to-cart-btn {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

@media (max-width: 767.98px) {
    .add-to-cart-btn {
        padding: .3rem .5rem;
        font-size: .8rem;
        line-height: 1.2;
    }
}
