::selection {
    background: #6c757d;
    color: #ffffff;
}
::-moz-selection { /* Code for Firefox */
    background: #6c757d;
    color: #ffffff;
}
.slow ,.accordion-button::after ,.hover ,.deal ,.select-deal {
    transition: .2s all;
}
.hover:hover, .active-filter{
    color: var(--bs-primary);
    font-weight: 500;
}
.clickable {
    padding-left: 5%;
}
.help {
    cursor: help;
}
.deal {
    right: 5px;
    margin-top: -9px;
    font-size: .8em;
    transform: rotate(6deg);
}
.deal:hover {
    margin-top: -10px;
    font-size: .9em;
    transform: rotate(0deg);
}
.select-deal:hover {
    background: #e5e5e55e;
}
/* .ofs {
    position: absolute;
    left: -2px;
    top: 11px;
    padding: 10px 0 10px 20px;
    background: #6c757dc7;
    color: #fff;
    border-bottom-left-radius: 3px;
    border-top-left-radius: 3px;
    font-weight: bolder;
}
.ofs:after {
    width: 0;
    height: 0;
    border: 22px solid #6c757dc7;
    position: absolute;
    content: "";
    right: -44px;
    top: 0px;
    border-right-color: transparent;
} */

/*****************/
.pm {
    position: absolute;
    right: 14px;
    top: 0px;
    padding: 10px;
    color: #6c757d;
}
.ofs, .sq {
    position: absolute;
    left: -2px;
    top: 11px;
    padding: 10px 0 10px 20px;
    color: #fff;
    border-bottom-left-radius: 3px;
    border-top-left-radius: 3px;
    font-weight: bolder;
}
.ofs:after, .sq:after {
    width: 0;
    height: 0;
    position: absolute;
    content: "";
    right: -44px;
    top: 0px;
}
.ofs {
    background: #6c757dc7;
}
.ofs:after {
    border: 22px solid #6c757dc7;
    border-right-color: transparent;
}
.regs{
    background: #dc3545;
}
.regs:after {
    border: 22px solid #dc3545;
    border-right-color: transparent;
}
.sq {
    background: #288d55c7;
    cursor: pointer;
}
.sq:after {
    border: 22px solid #288d55c7;
    border-right-color: transparent;
}
input#frequently {
    border-color: #aaa !important;
	background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='-4 -4 8 8'%3e%3ccircle r='3' fill='rgba%280, 0, 0, 0.25%29'/%3e%3c/svg%3e");
}
input#frequently:checked {
    background-color: #ccc;
}
.filter_warb {
    height: calc(100vh - 232px);
    top: 120px;
}

/* Desktop sticky filter */
@media (min-width: 768px) {
    .filter_warb {
        position: sticky;
        overflow-y: auto;
    }
}

/* Mobile Filter Styles */
@media (max-width: 767.98px) {
    /* Floating Filter Toggle Button */
    .filter-toggle-btn {
        position: fixed;
        bottom: 20px;
        right: 20px;
        width: 56px;
        height: 56px;
        border-radius: 50%;
        z-index: 1040;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 1.2rem;
        border: none;
        transition: all 0.3s ease;
    }

    .filter-toggle-btn:hover {
        transform: scale(1.1);
        box-shadow: 0 6px 16px rgba(0, 0, 0, 0.3);
    }

    .filter-toggle-btn:active {
        transform: scale(0.95);
    }

    /* Dark Overlay */
    .filter-overlay {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0, 0, 0, 0.5);
        z-index: 1045;
        opacity: 0;
        visibility: hidden;
        transition: all 0.3s ease;
    }

    .filter-overlay.active {
        opacity: 1;
        visibility: visible;
    }

    /* Slide-out Filter Sidebar */
    .filter_warb {
        position: fixed;
        top: 0;
        left: -85%;
        width: 85%;
        max-width: 320px;
        height: 100vh;
        background: #fff;
        z-index: 1050;
        overflow-y: auto;
        box-shadow: 2px 0 12px rgba(0, 0, 0, 0.15);
        transition: left 0.3s ease;
        padding: 0;
    }

    .filter_warb.active {
        left: 0;
    }

    /* Filter Sidebar Header (Mobile Only) */
    .filter-sidebar-header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 1rem;
        border-bottom: 1px solid #dee2e6;
        background: #f8f9fa;
        position: sticky;
        top: 0;
        z-index: 10;
    }

    .filter-sidebar-header h5 {
        font-weight: 600;
        color: #212529;
    }

    .filter-sidebar-header .btn-close {
        padding: 0.5rem;
    }

    /* Filter Content in Sidebar */
    #filters {
        border: none;
        box-shadow: none;
        border-radius: 0;
        margin: 0;
    }

    #filters .accordion-item {
        border: none;
        border-bottom: 1px solid #e9ecef;
    }

    #filters .accordion-item:last-child {
        border-bottom: none;
    }

    #filters .accordion-button {
        padding: 0.875rem 1rem;
        font-size: 0.95rem;
        background: #fff;
    }

    #filters .accordion-button:not(.collapsed) {
        background: #f8f9fa;
        color: #0d6efd;
    }

    #filters .clickable {
        font-size: 0.9rem;
        padding: 0.75rem 1rem;
    }

    #filters .clickable:active {
        background: #e9ecef;
    }

    /* Show All button */
    #filters .clickable[data-val="all"] {
        font-weight: 500;
        background: #f8f9fa;
        border-bottom: 1px solid #dee2e6;
        margin: 0;
        padding: 1rem;
    }

    #filters .clickable[data-val="all"].active-filter {
        background: #e7f1ff;
        color: #0d6efd;
    }

    /* Scrollable accordion sections */
    #filters .accordion-collapse.show {
        max-height: 300px;
        overflow-y: auto;
    }

    /* Custom scrollbar for filter sidebar */
    .filter_warb::-webkit-scrollbar {
        width: 8px;
    }

    .filter_warb::-webkit-scrollbar-track {
        background: #f1f1f1;
    }

    .filter_warb::-webkit-scrollbar-thumb {
        background: #adb5bd;
        border-radius: 4px;
    }

    .filter_warb::-webkit-scrollbar-thumb:hover {
        background: #6c757d;
    }

    #filters .accordion-collapse.show::-webkit-scrollbar {
        width: 6px;
    }

    #filters .accordion-collapse.show::-webkit-scrollbar-track {
        background: #f8f9fa;
    }

    #filters .accordion-collapse.show::-webkit-scrollbar-thumb {
        background: #ced4da;
        border-radius: 3px;
    }

    /* Product row spacing */
    #products.row {
        row-gap: 0.5rem;
    }

    /* Ensure products container doesn't jump when filter opens */
    .col-md-9 {
        transition: margin-top 0.2s ease;
    }

    /* Reduce padding on mobile */
    .product {
        padding-left: 0.25rem !important;
        padding-right: 0.25rem !important;
    }

    .product .card {
        margin-bottom: 0 !important;
    }

    .product .card-img-top {
        padding: 0.5rem !important;
        padding-bottom: 0.25rem !important;
    }

    .product .card-body {
        padding: 0.5rem !important;
    }

    .product .card-title {
        font-size: 0.9rem;
    }

    .product .card-text {
        font-size: 0.85rem;
    }

    .product .card-text b,
    .product .card-text span,
    .product .card-text small {
        font-size: 0.75rem;
    }

    .product .btn {
        font-size: 0.85rem;
        padding: 0.375rem 0.5rem;
    }

    /* Adjust deal button for mobile */
    .deal {
        font-size: 0.65em !important;
        padding: 0.25rem 0.5rem !important;
    }

    /* Adjust badges for mobile */
    .ofs, .sq {
        font-size: 0.7rem;
        padding: 0.5rem 0 0.5rem 1rem !important;
    }

    .ofs:after, .sq:after, .regs:after {
        border-width: 18px !important;
        right: -36px !important;
    }

    /* Adjust info icon position for mobile */
    .pm {
        right: 8px;
        top: -5px;
        padding: 5px;
        font-size: 0.9em;
    }

    /* Improve section padding on mobile */
    section.p-4.p-lg-5 {
        padding: 1rem !important;
    }

    /* Input groups on mobile */
    .input-group {
        margin-bottom: 0.5rem !important;
    }


    /* Fix quantity input group on mobile */
    .qty_input {
        width: 100% !important;
    }

    .qty_input .form-control {
        font-size: 0.85rem;
    }

    .qty_input .btn {
        padding: 0.25rem 0.5rem;
    }
}


/* Extra small devices (phones in portrait mode, less than 400px) */
@media (max-width: 399.98px) {
    .product .card-title b {
        font-size: 0.85rem;
    }

    .product .card-title small {
        font-size: 0.65rem !important;
    }

    .product .card-text {
        font-size: 0.8rem;
    }

    .product .card-text b,
    .product .card-text span {
        font-size: 0.7rem;
    }

    .product .card-text small {
        font-size: 0.65rem !important;
    }

    .deal {
        font-size: 0.6em !important;
        padding: 0.2rem 0.4rem !important;
    }

    .ofs, .sq {
        font-size: 0.65rem;
        padding: 0.4rem 0 0.4rem 0.8rem !important;
    }

    .ofs:after, .sq:after, .regs:after {
        border-width: 16px !important;
        right: -32px !important;
    }
}

/* ==========================================================================
   Interactive faceted catalog sidebar (opt-in; see interactive-filters.js)
   ========================================================================== */
.if-hidden { display: none !important; }

#interactiveFilters { font-size: .9rem; }

#interactiveFilters .if-count { padding: 0 .25rem; }

#interactiveFilters .if-group {
    border: 1px solid #e9ecef;
    border-radius: 6px;
    margin-bottom: .5rem;
    background: #fff;
    overflow: hidden;
}
#interactiveFilters .if-group[data-key="__toggles"] { border-style: dashed; }

#interactiveFilters .if-group-hd {
    width: 100%;
    display: flex;
    align-items: center;
    gap: .5rem;
    border: 0;
    background: #f8f9fa;
    padding: .55rem .75rem;
    font-weight: 600;
    color: #212529;
    cursor: pointer;
}
#interactiveFilters .if-group-hd:hover { background: #f1f3f5; }
#interactiveFilters .if-group-title { flex: 1; text-align: left; }
#interactiveFilters .if-group-sel {
    background: #0d6efd;
    color: #fff;
    border-radius: 10px;
    font-size: .7rem;
    padding: 0 .45rem;
    line-height: 1.4;
}
#interactiveFilters .if-caret { color: #adb5bd; font-size: .75rem; }

#interactiveFilters .if-group-body {
    max-height: 320px;
    overflow-y: auto;
    padding: .35rem .25rem;
}

#interactiveFilters .if-row {
    display: flex;
    align-items: center;
    gap: .5rem;
    margin: 0;
    padding: .3rem .5rem;
    border-radius: 4px;
    cursor: pointer;
}
#interactiveFilters .if-row:hover { background: #f1f3f5; }
#interactiveFilters .if-row .if-row-label {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
#interactiveFilters .if-row .if-row-count {
    color: #adb5bd;
    font-size: .75rem;
    flex-shrink: 0;
}
#interactiveFilters .if-toggle-row .form-switch { flex-shrink: 0; }

#interactiveFilters .if-more,
#interactiveFilters .if-less {
    border: 0;
    background: none;
    color: #0d6efd;
    font-size: .8rem;
    padding: .35rem .5rem;
    cursor: pointer;
}
#interactiveFilters .if-more:hover,
#interactiveFilters .if-less:hover { text-decoration: underline; }

#interactiveFilters .if-chip {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    background: #e7f1ff;
    color: #0d6efd;
    border: 1px solid #cfe2ff;
    border-radius: 14px;
    padding: .15rem .6rem;
    font-size: .78rem;
    max-width: 100%;
}
#interactiveFilters .if-chip .if-chip-x {
    cursor: pointer;
    font-size: .7rem;
    opacity: .7;
}
#interactiveFilters .if-chip .if-chip-x:hover { opacity: 1; }

/* =========================================================================
 * Purchase history — the "Last bought …" chip and its modal
 * =========================================================================
 * A returning buyer's first question about a familiar product is when they
 * last took it, and the second is how much and at what price. The chip
 * answers the first on the shelf; the modal answers the other two without
 * sending them to the History page and back.
 *
 * Deliberately quiet in indigo rather than another coloured pill: the tile
 * already spends green on money saved and amber on money still on the table
 * (see promotions.css), and a third loud colour competing with those would
 * cost more attention than a date is worth.
 * ========================================================================= */

.lp-chip {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    /* .card-body is a flex COLUMN, which blockifies this button and stretches
       it edge to edge — a pill the width of the card reads as a banner. Hug the
       text instead, which is what makes it look like a chip. */
    align-self: flex-start;
    margin-top: .4rem;
    padding: .2rem .6rem .2rem .5rem;
    border: 1px solid #e0e3f0;
    border-radius: 999px;
    background: #f6f7fc;
    color: #55608a;
    font-size: .75rem;
    line-height: 1.4;
    max-width: 100%;
    cursor: pointer;
    transition: background .15s ease, border-color .15s ease, color .15s ease, box-shadow .15s ease;
}
.lp-chip:hover,
.lp-chip:focus-visible {
    background: #eef0fa;
    border-color: #c7cdea;
    color: #3b4573;
    box-shadow: 0 1px 4px rgba(60, 70, 120, .12);
}
.lp-chip:focus-visible { outline: 2px solid #8a94c8; outline-offset: 1px; }
.lp-chip-icon { font-size: .75rem; opacity: .75; flex-shrink: 0; }
.lp-chip-text {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.lp-chip-text b { font-weight: 600; }

/* ── The modal ─────────────────────────────────────────────────────────── */
.ph-dialog { max-width: 480px; }

.ph-modal {
    border: 0;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 18px 50px rgba(23, 28, 54, .22);
}

.ph-header {
    align-items: flex-start;
    gap: .75rem;
    padding: 1.1rem 1.25rem .9rem;
    border-bottom: 1px solid #eceef5;
    background: linear-gradient(135deg, #f7f8fd 0%, #eef0fa 100%);
}
.ph-header-text { min-width: 0; }
.ph-header .modal-title { font-size: 1.05rem; font-weight: 600; color: #2f3765; }
/* The product name. Clamped rather than wrapped: a two-line title pushes the
   first purchase below the fold on a phone, which is the row that matters. */
.ph-subtitle {
    margin-top: .15rem;
    font-size: .8125rem;
    color: #6b7391;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.ph-header .btn-close { margin: 0; flex-shrink: 0; }

.ph-body { padding: .85rem 1.25rem; background: #fff; }

.ph-item {
    display: flex;
    align-items: center;
    gap: .85rem;
    padding: .7rem .85rem;
    border: 1px solid #eceef5;
    border-radius: 12px;
    background: #fff;
    transition: border-color .15s ease, box-shadow .15s ease;
}
.ph-item + .ph-item { margin-top: .55rem; }
.ph-item:hover { border-color: #d9dded; box-shadow: 0 2px 10px rgba(60, 70, 120, .07); }
/* The most recent purchase is the one they came to check. */
.ph-item-latest { border-color: #c9d0ee; background: #fbfcff; }

/* Calendar chip — a date reads faster stacked than as a slash-separated line. */
.ph-cal {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 52px;
    padding: .35rem 0;
    border-radius: 10px;
    background: #eef0fa;
    color: #3b4573;
    line-height: 1;
}
.ph-item-latest .ph-cal { background: #3b4573; color: #fff; }
.ph-cal-mon { font-size: .625rem; font-weight: 700; letter-spacing: .06em; opacity: .85; }
.ph-cal-day { font-size: 1.25rem; font-weight: 700; margin: .1rem 0; }
.ph-cal-yr  { font-size: .625rem; opacity: .7; }

.ph-meta { flex: 1; min-width: 0; }
.ph-when {
    display: flex;
    align-items: center;
    gap: .4rem;
    flex-wrap: wrap;
    font-size: .875rem;
    font-weight: 600;
    color: #343a52;
}
.ph-tag {
    padding: .05rem .4rem;
    border-radius: 999px;
    background: #e4e8f8;
    color: #4a5487;
    font-size: .625rem;
    font-weight: 600;
    letter-spacing: .02em;
    text-transform: uppercase;
}
.ph-inv { margin-top: .15rem; font-size: .75rem; color: #8a90a8; }

.ph-stats { display: flex; gap: 1rem; flex-shrink: 0; text-align: right; }
.ph-stat { display: flex; flex-direction: column; }
.ph-stat-lbl {
    font-size: .625rem;
    font-weight: 600;
    letter-spacing: .05em;
    text-transform: uppercase;
    color: #a2a8bf;
}
.ph-stat-val { font-size: .95rem; font-weight: 600; color: #2f3765; }

.ph-empty-icon { font-size: 2rem; color: #c4c9db; }
.ph-empty p { color: #8a90a8; font-size: .875rem; }

.ph-footer {
    padding: .65rem 1.25rem;
    border-top: 1px solid #eceef5;
    background: #fafbfe;
    justify-content: center;
}
.ph-footer small { font-size: .75rem; }

/* On a narrow screen the qty/price pair drops under the date rather than
   squeezing the product's own row down to a couple of characters. */
@media (max-width: 400px) {
    .ph-item { flex-wrap: wrap; row-gap: .5rem; }
    .ph-stats { width: 100%; justify-content: flex-start; gap: 1.5rem; text-align: left; }
}
