﻿/* =========================
   Core layout & behaviors
   ========================= */
.sticky-holder {
    position: sticky;
    top: var(--sticky-top);
    z-index: 1002;
    background: #fff;
    box-shadow: 0 2px 6px rgba(0,0,0,.06);
}

.sticky-subrow {
    position: relative;
    z-index: 1;
}

/* Page scroll / anchor behavior */
#grid, #gridhead {
    overflow: visible !important;
    height: auto !important;
}

.target-head, .grid-category-header {
    scroll-margin-top: var(--sticky-offset);
    margin-top: 0;
    padding-top: 2px;
}

/* Search + sections */
.search-container {
    padding: 10px 8px 2px;
}

/* Toggleable panel */
.section-panel[hidden] {
    display: block;
    max-height: 0;
    overflow: hidden;
    padding: 0;
    border: 0;
}

.section-panel {
    background: #fff;
    border-top: 1px dashed var(--brand-border);
    border-bottom: 1px dashed var(--brand-border);
    transition: max-height 240ms ease, padding 240ms ease, border-color 240ms ease;
    max-height: 0;
    overflow: hidden;
    padding: 0;
}

    .section-panel.open {
        padding: 6px 8px;
        max-height: 180px;
    }

/* Reduce motion for users who prefer it */
@media (prefers-reduced-motion: reduce) {
    .section-panel {
        transition: none;
    }
}

/* =========================
   Red theme (scoped)
   ========================= */
#stickyStack.theme-red {
    --brand-50: #ffe5e5;
    --brand-100: #ffc9c9;
    --brand-600: #b80000;
    --brand: #d40000;
    --brand-border: #e57373;
    --brand-ink: #7a0a0a;
}

/* CATEGORIES toggle button */
#btnToggleSections {
    background: var(--brand-50);
    color: var(--brand-600);
    border: 1px solid var(--brand-600);
    border-radius: 10px;
    box-shadow: 0 1px 0 rgba(0,0,0,.05);
}

    #btnToggleSections .fa {
        color: inherit;
    }

    #btnToggleSections:hover {
        background: var(--brand-100);
        border-color: var(--brand);
        box-shadow: 0 6px 14px rgba(212,0,0,.18);
    }

    #btnToggleSections:focus {
        outline: none;
        box-shadow: 0 0 0 3px rgba(212,0,0,.28), 0 6px 14px rgba(212,0,0,.18);
    }

    #btnToggleSections:active {
        transform: translateY(1px);
        box-shadow: 0 3px 8px rgba(212,0,0,.14);
    }

    #btnToggleSections[aria-expanded="true"] {
        background: linear-gradient(180deg, var(--brand-100), var(--brand-50));
        border-color: var(--brand);
        box-shadow: 0 8px 18px rgba(212,0,0,.16);
    }

    #btnToggleSections:disabled {
        opacity: .55;
        box-shadow: none;
        cursor: not-allowed;
    }

/* Section buttons container */
.section-buttons {
    --btn-row-height: 36px;
    --btn-max-rows: 3;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 8px;
    background: #fff;
    border-top: 1px dashed var(--brand-border);
    border-bottom: 1px dashed var(--brand-border);
    max-height: calc(var(--btn-row-height) * var(--btn-max-rows) + 16px);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

    .section-buttons::-webkit-scrollbar {
        width: 8px;
    }

    .section-buttons::-webkit-scrollbar-thumb {
        background: rgba(0,0,0,.2);
        border-radius: 8px;
    }

/* Section button pill */
.sec-btn {
    border: 1px solid rgba(0,0,0,.12);
    border-radius: 999px;
    padding: 6px 12px;
    background: #fff5f5;
    cursor: pointer;
    white-space: nowrap;
    font: 600 13px/1 system-ui, Arial;
    color: #b80000;
}

    .sec-btn:hover {
        background: #ffeaea;
        border-color: var(--brand-border);
    }

    .sec-btn:focus {
        outline: 2px solid var(--brand);
        outline-offset: 2px;
    }

/* Optional: product section heading in red */
.productsheading .Search_text {
    background: #d40000 !important;
    color: #fff !important;
}

/* =========================
   Totals bar + variants
   ========================= */
.totals-bar {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: 1fr;
    gap: 10px;
    padding: 10px;
    background: var(--brand-50);
    border-top: 1px solid var(--brand);
    border-bottom: 1px solid var(--brand);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

    .totals-bar::-webkit-scrollbar {
        height: 6px;
    }

    .totals-bar::-webkit-scrollbar-thumb {
        border-radius: 8px;
        background: rgba(0,0,0,.15);
    }

.total-item {
    display: grid;
    justify-items: center;
    align-content: center;
    padding: 10px;
    border-radius: 12px;
    background: #fff;
    border: 1px dashed var(--brand-border);
    transition: transform .15s ease, box-shadow .15s ease;
}

    .total-item:hover {
        transform: translateY(-2px);
    }

.total-label {
    font: 700 12px/1 system-ui, Arial;
    color: var(--brand-ink);
    text-transform: uppercase;
    letter-spacing: .2px;
}

.total-value {
    font: 800 22px/1.1 system-ui, Arial;
    color: #102a43;
    margin-top: 4px;
}

/* Solid */
.totals--solid {
    background: #fff;
    border-top: 1px solid var(--brand);
    border-bottom: 1px solid var(--brand);
}

    .totals--solid .total-item {
        background: linear-gradient(180deg, var(--brand) 0%, var(--brand-600) 100%);
        border: none;
        color: #fff;
        box-shadow: 0 6px 14px rgba(212,0,0,.25);
    }

    .totals--solid .total-label {
        color: #ffecec;
        opacity: .95;
    }

    .totals--solid .total-value {
        color: #fff;
        text-shadow: 0 1px 0 rgba(0,0,0,.15);
    }

/* Outline */
.totals--outline .total-item {
    background: #fff;
    border: 1px dashed var(--brand-border);
}

.totals--outline .total-label {
    color: var(--brand-ink);
}

.totals--outline .total-value {
    color: #102a43;
}

/* Glass (red translucency) */
.totals--glass {
    background: linear-gradient(180deg, rgba(212,0,0,.08), rgba(212,0,0,.04));
    border-top: 1px solid rgba(212,0,0,.25);
    border-bottom: 1px solid rgba(212,0,0,.25);
}

    .totals--glass .total-item {
        background: rgba(255,255,255,.6);
        border: 1px solid rgba(255,255,255,.7);
        backdrop-filter: blur(6px);
        -webkit-backdrop-filter: blur(6px);
        box-shadow: 0 4px 16px rgba(0,0,0,.08);
    }

/* Neo (neutral soft) */
.totals--neo {
    background: #faf7f7;
    border-color: transparent;
}

    .totals--neo .total-item {
        background: #faf7f7;
        border: none;
        box-shadow: 6px 6px 14px rgba(0,0,0,.08), -6px -6px 14px #ffffff;
    }

/* Pill */
.totals--pill .total-item {
    background: #fff;
    border: 1px solid rgba(0,0,0,.08);
    border-radius: 999px;
    padding: 10px 16px;
}

.totals--pill .total-value {
    color: var(--brand-ink);
    background: var(--brand-100);
    border-radius: 999px;
    padding: 4px 10px;
    margin-top: 6px;
}

/* Split accent */
.totals--split .total-item {
    background: #fff;
    border: 1px solid rgba(0,0,0,.08);
    position: relative;
    padding-left: 14px;
}

    .totals--split .total-item::before {
        content: "";
        position: absolute;
        left: 0;
        top: 8px;
        bottom: 8px;
        width: 6px;
        background: linear-gradient(180deg, var(--brand), var(--brand-600));
        border-radius: 6px;
    }

/* Mobile trims for totals */
@media (max-width:640px) {
    .total-item {
        padding: 8px;
    }

    .total-value {
        font-size: 18px;
    }

    .total-label {
        font-size: 11px;
    }
}

/* =========================
   Scoped control tweaks
   ========================= */
#stickyStack.theme-red #searchbox:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(212,0,0,.25);
    border-color: var(--brand);
}

#stickyStack.theme-red .btn-dark {
    background: var(--brand-600);
    border-color: var(--brand-600);
}

    #stickyStack.theme-red .btn-dark:hover {
        background: var(--brand);
        border-color: var(--brand);
        box-shadow: 0 6px 14px rgba(212,0,0,.18);
    }

    #stickyStack.theme-red .btn-dark:focus {
        box-shadow: 0 0 0 3px rgba(212,0,0,.28);
    }
