/* =====================================================================
 * La Bodeteka Delivery — Product Filter (shop sidebar + product grid)
 * ---------------------------------------------------------------------
 * Structure:
 *   .lbdpf-root        widget wrapper
 *   .lbdpf-layout     sidebar + content (flex row)
 *   .lbdpf-sidebar    the filter panel
 *   .lbdpf-group      one filter block (categories / price / attributes…)
 *   .lbdpf-content    the grid column (grid mode only)
 * ===================================================================== */

.lbdpf-root {
    --lbdpf-accent: #b08a56;
    --lbdpf-text: #171717;
    --lbdpf-muted: rgba(17, 17, 17, 0.55);
    --lbdpf-line: rgba(17, 17, 17, 0.1);
    --lbdpf-cols: 3;
    width: 100%;
}

.lbdpf-root *,
.lbdpf-root *::before,
.lbdpf-root *::after {
    box-sizing: border-box;
}

.lbdpf-layout {
    display: flex;
    align-items: flex-start;
    gap: 28px;
}

/* ---------------------------------------------------------------------
 * Sidebar
 * ------------------------------------------------------------------ */
.lbdpf-sidebar {
    width: 260px;
    flex: 0 0 260px;
    display: flex;
    flex-direction: column;
    gap: 22px;
    padding: 20px;
    background: #ffffff;
    border: 1px solid var(--lbdpf-line);
    border-radius: 14px;
}

/* ---------------------------------------------------------------------
 * Sticky filter panel (Style → Sidebar → Sticky Filter Panel)
 * ------------------------------------------------------------------
 * The .is-sticky* classes are printed by the widget. The distance from
 * the top of the screen is read from --lbdpf-sticky-top (the "Top
 * Offset" control), so one rule set works for any offset.
 * ------------------------------------------------------------------ */
.lbdpf-sidebar.is-sticky {
    position: -webkit-sticky;
    position: sticky;
    top: var(--lbdpf-sticky-top, 24px);
    /* Never taller than the screen: the panel scrolls inside itself
       instead of leaving its last rows out of reach. */
    max-height: calc(100vh - var(--lbdpf-sticky-top, 24px));
    max-height: calc(100dvh - var(--lbdpf-sticky-top, 24px));
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
}

/* "Full screen — 100vh": exactly one viewport tall with its own
   scrollbar. Desktop only: in the stacked (mobile) layout it would sit
   on top of every product — see the media query in Responsive. */
@media (min-width: 1025px) {
    .lbdpf-sidebar.is-sticky.is-sticky-viewport {
        height: calc(100vh - var(--lbdpf-sticky-top, 24px));
        height: calc(100dvh - var(--lbdpf-sticky-top, 24px));
        max-height: none;
    }
}

/* "Full page": the panel runs the entire height of the page column,
   background and border included. */
.lbdpf-sidebar.is-sticky.is-sticky-page {
    align-self: stretch;
    height: auto;
    max-height: none;
    overflow: visible;
}

.lbdpf-group {
    padding-bottom: 18px;
    border-bottom: 1px solid var(--lbdpf-line);
}

.lbdpf-group:last-of-type {
    padding-bottom: 0;
    border-bottom: 0;
}

.lbdpf-group-title {
    margin: 0 0 14px;
    font-size: 14px;
    font-weight: 700;
    line-height: 1.3;
    color: var(--lbdpf-text);
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.lbdpf-note {
    margin: 0;
    font-size: 13px;
    color: var(--lbdpf-muted);
}

.lbdpf-screen-reader-text {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
    border: 0;
}

/* ---------------------------------------------------------------------
 * Checkbox lists (categories / tags)
 * ------------------------------------------------------------------ */
.lbdpf-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.lbdpf-check {
    display: flex;
    align-items: center;
    gap: 9px;
    cursor: pointer;
    margin: 0;
    line-height: 1.35;
}

.lbdpf-check input,
.lbdpf-swatch input,
.lbdpf-chip input {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
}

.lbdpf-box {
    flex: 0 0 auto;
    width: 17px;
    height: 17px;
    border: 1px solid rgba(17, 17, 17, 0.25);
    border-radius: 3px;
    background: #ffffff;
    position: relative;
    transition: background-color 0.18s ease, border-color 0.18s ease;
}

.lbdpf-check input:checked + .lbdpf-box {
    background-color: var(--lbdpf-accent);
    border-color: var(--lbdpf-accent);
}

.lbdpf-check input:checked + .lbdpf-box::after {
    content: '';
    position: absolute;
    left: 5px;
    top: 1px;
    width: 5px;
    height: 10px;
    border: solid #ffffff;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.lbdpf-check input:focus-visible + .lbdpf-box,
.lbdpf-swatch input:focus-visible + .lbdpf-swatch-dot,
.lbdpf-chip input:focus-visible + .lbdpf-chip-label {
    outline: 2px solid var(--lbdpf-accent);
    outline-offset: 2px;
}

.lbdpf-label {
    font-size: 14px;
    color: var(--lbdpf-text);
    transition: color 0.18s ease;
}

.lbdpf-count {
    margin-left: auto;
    font-size: 12px;
    color: var(--lbdpf-muted);
    font-variant-numeric: tabular-nums;
}

/* ---------------------------------------------------------------------
 * Price range
 * ------------------------------------------------------------------ */
/* Sidebar price block (values + slider + numeric inputs). */
.lbdpf-price-block {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.lbdpf-price-values {
    display: flex;
    align-items: baseline;
    gap: 6px;
    margin-bottom: 10px;
}

.lbdpf-price-value {
    font-size: 14px;
    font-weight: 700;
    color: var(--lbdpf-text);
    font-variant-numeric: tabular-nums;
}

.lbdpf-price-sep {
    color: var(--lbdpf-muted);
}

.lbdpf-range {
    position: relative;
    width: 100%;
    height: 18px;
    margin: 0 2px 12px;
}

.lbdpf-range-track,
.lbdpf-range-fill {
    position: absolute;
    top: 50%;
    height: 4px;
    border-radius: 999px;
    transform: translateY(-50%);
    pointer-events: none;
}

.lbdpf-range-track {
    left: 0;
    right: 0;
    background: rgba(17, 17, 17, 0.12);
}

.lbdpf-range-fill {
    left: 0;
    width: 100%;
    background: var(--lbdpf-accent);
}

.lbdpf-range-input {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 18px;
    margin: 0;
    padding: 0;
    background: transparent;
    -webkit-appearance: none;
    appearance: none;
    pointer-events: none;
}

.lbdpf-range-input::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 15px;
    height: 15px;
    border-radius: 50%;
    background: var(--lbdpf-accent);
    border: 2px solid #ffffff;
    box-shadow: 0 1px 4px rgba(17, 17, 17, 0.28);
    cursor: pointer;
    pointer-events: auto;
}

.lbdpf-range-input::-moz-range-thumb {
    width: 15px;
    height: 15px;
    border-radius: 50%;
    background: var(--lbdpf-accent);
    border: 2px solid #ffffff;
    box-shadow: 0 1px 4px rgba(17, 17, 17, 0.28);
    cursor: pointer;
    pointer-events: auto;
}

.lbdpf-price-inputs {
    display: flex;
    align-items: center;
    gap: 8px;
}

.lbdpf-price-input {
    width: 100%;
    min-width: 0;
    padding: 7px 9px;
    border: 1px solid rgba(17, 17, 17, 0.16);
    border-radius: 8px;
    background: #ffffff;
    color: var(--lbdpf-text);
    font-size: 13px;
    font-family: inherit;
    -moz-appearance: textfield;
    appearance: textfield;
}

.lbdpf-price-input::-webkit-outer-spin-button,
.lbdpf-price-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.lbdpf-price-input:focus {
    outline: none;
    border-color: var(--lbdpf-accent);
}

.lbdpf-price-input:focus-visible {
    outline: 2px solid var(--lbdpf-accent);
    outline-offset: 2px;
}

/* ---------------------------------------------------------------------
 * Swatches & chips
 * ------------------------------------------------------------------ */
.lbdpf-attr + .lbdpf-attr {
    margin-top: 16px;
}

.lbdpf-attr-name {
    display: block;
    margin-bottom: 9px;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--lbdpf-muted);
}

.lbdpf-swatches {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.lbdpf-swatch {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    cursor: pointer;
    margin: 0;
}

.lbdpf-swatch-dot {
    display: inline-block;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    border: 1px solid rgba(17, 17, 17, 0.18);
    background: #ffffff;
    transition: box-shadow 0.18s ease, transform 0.18s ease;
}

.lbdpf-swatch-dot.is-blank {
    background: repeating-linear-gradient(45deg, #f1f1f1 0 5px, #ffffff 5px 10px);
}

.lbdpf-swatch:hover .lbdpf-swatch-dot {
    transform: scale(1.06);
}

.lbdpf-swatch input:checked + .lbdpf-swatch-dot {
    box-shadow: 0 0 0 2px var(--lbdpf-accent);
}

.lbdpf-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.lbdpf-chip {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    cursor: pointer;
    margin: 0;
}

.lbdpf-chip-label {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 11px;
    border: 1px solid rgba(17, 17, 17, 0.14);
    border-radius: 999px;
    background: rgba(17, 17, 17, 0.04);
    color: var(--lbdpf-text);
    font-size: 12.5px;
    line-height: 1.3;
    transition: background-color 0.18s ease, color 0.18s ease, border-color 0.18s ease;
}

.lbdpf-chip:hover .lbdpf-chip-label {
    border-color: var(--lbdpf-accent);
}

.lbdpf-chip input:checked + .lbdpf-chip-label {
    background: var(--lbdpf-accent);
    border-color: var(--lbdpf-accent);
    color: #ffffff;
}

.lbdpf-chip input:checked + .lbdpf-chip-label .lbdpf-count {
    color: rgba(255, 255, 255, 0.85);
}

/* ---------------------------------------------------------------------
 * Actions (apply / clear)
 * ------------------------------------------------------------------ */
.lbdpf-actions-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.lbdpf-clear,
.lbdpf-apply {
    flex: 1 1 auto;
    padding: 9px 14px;
    border: 1px solid rgba(17, 17, 17, 0.16);
    border-radius: 9px;
    background: transparent;
    color: var(--lbdpf-text);
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.lbdpf-clear:hover {
    background: rgba(17, 17, 17, 0.05);
}

.lbdpf-apply {
    background: var(--lbdpf-accent);
    border-color: var(--lbdpf-accent);
    color: #ffffff;
}

.lbdpf-apply:hover {
    filter: brightness(0.94);
}

/* ---------------------------------------------------------------------
 * Content column (grid mode)
 * ------------------------------------------------------------------ */
.lbdpf-content {
    flex: 1 1 auto;
    min-width: 0;
}

.lbdpf-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    flex-wrap: wrap;
    margin-bottom: 18px;
    padding: 10px 14px;
    border: 1px solid var(--lbdpf-line);
    border-radius: 10px;
    background: #ffffff;
}

.lbdpf-results {
    font-size: 13.5px;
    color: var(--lbdpf-muted);
}

.lbdpf-sort {
    padding: 8px 12px;
    border: 1px solid rgba(17, 17, 17, 0.14);
    border-radius: 8px;
    background: #ffffff;
    color: var(--lbdpf-text);
    font-family: inherit;
    font-size: 13px;
    cursor: pointer;
}

/* ---------------------------------------------------------------------
 * Grid
 * ------------------------------------------------------------------ */
.lbdpf-grid {
    display: grid;
    grid-template-columns: repeat(var(--lbdpf-cols, 3), minmax(0, 1fr));
    gap: 20px;
}

.lbdpf-empty {
    grid-column: 1 / -1;
    margin: 0;
    padding: 40px 20px;
    text-align: center;
    font-size: 15px;
    color: var(--lbdpf-muted);
}

.lbdpf-card {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: #ffffff;
    border: 1px solid var(--lbdpf-line);
    border-radius: 14px;
    transition: box-shadow 0.25s ease, transform 0.25s ease;
}

.lbdpf-card:hover {
    box-shadow: 0 10px 28px rgba(17, 17, 17, 0.1);
    transform: translateY(-2px);
}

.lbdpf-card.is-out-of-stock {
    opacity: 0.62;
}

.lbdpf-thumb {
    position: relative;
    display: block;
    aspect-ratio: 1 / 1;
    background: #f6f4f1;
    overflow: hidden;
}

.lbdpf-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.4s ease;
}

.lbdpf-card:hover .lbdpf-thumb img {
    transform: scale(1.04);
}

.lbdpf-badge {
    position: absolute;
    top: 10px;
    left: 10px;
    padding: 4px 9px;
    border-radius: 999px;
    background: var(--lbdpf-accent);
    color: #ffffff;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.02em;
}

.lbdpf-badge.is-sale {
    background: #dc2626;
}

.lbdpf-stock-tag {
    position: absolute;
    bottom: 10px;
    left: 10px;
    padding: 4px 9px;
    border-radius: 999px;
    background: rgba(17, 17, 17, 0.78);
    color: #ffffff;
    font-size: 11px;
    font-weight: 600;
}

.lbdpf-card-body {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 14px;
    flex: 1 1 auto;
}

.lbdpf-title {
    margin: 0;
    font-size: 15px;
    font-weight: 700;
    line-height: 1.35;
    color: var(--lbdpf-text);
}

.lbdpf-title a {
    color: inherit;
    text-decoration: none;
}

.lbdpf-title a:hover {
    color: var(--lbdpf-accent);
}

/* Price row of a product card (the sidebar block uses .lbdpf-price-block). */
.lbdpf-price {
    display: flex;
    align-items: baseline;
    gap: 8px;
}

.lbdpf-price-now {
    font-size: 17px;
    font-weight: 800;
    color: var(--lbdpf-text);
    font-variant-numeric: tabular-nums;
}

.lbdpf-price-old {
    font-size: 13px;
    color: var(--lbdpf-muted);
    text-decoration: line-through;
}

.lbdpf-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: auto;
    padding-top: 6px;
}

.lbdpf-view,
.lbdpf-add {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 1 1 auto;
    padding: 9px 12px;
    border: 1px solid transparent;
    border-radius: 9px;
    font-size: 13px;
    font-weight: 700;
    line-height: 1.2;
    text-align: center;
    text-decoration: none;
    cursor: pointer;
    transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.lbdpf-view {
    background: transparent;
    border-color: rgba(17, 17, 17, 0.18);
    color: var(--lbdpf-text);
}

.lbdpf-view:hover {
    background: rgba(17, 17, 17, 0.05);
}

.lbdpf-add {
    background: var(--lbdpf-accent);
    color: #ffffff;
}

.lbdpf-add:hover {
    filter: brightness(0.94);
}

.lbdpf-add.is-loading {
    opacity: 0.6;
    pointer-events: none;
}

.lbdpf-add.is-added {
    background: #16a34a;
}

/* ---------------------------------------------------------------------
 * Pagination
 * ------------------------------------------------------------------ */
.lbdpf-pagination-wrap {
    margin-top: 26px;
}

.lbdpf-pagination {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    justify-content: center;
}

.lbdpf-page {
    min-width: 36px;
    padding: 8px 12px;
    border: 1px solid rgba(17, 17, 17, 0.14);
    border-radius: 8px;
    background: #ffffff;
    color: var(--lbdpf-text);
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.lbdpf-page:hover {
    border-color: var(--lbdpf-accent);
}

.lbdpf-page.is-current {
    background: var(--lbdpf-accent);
    border-color: var(--lbdpf-accent);
    color: #ffffff;
}

/* ---------------------------------------------------------------------
 * Loading state
 * ------------------------------------------------------------------ */
.lbdpf-grid-wrap.is-loading {
    opacity: 0.55;
    pointer-events: none;
}

/* Cards hidden by the filter (external mode). */
.lbdpf-filtered-out {
    display: none !important;
}

/* ---------------------------------------------------------------------
 * Responsive
 * ------------------------------------------------------------------ */
@media (max-width: 1024px) {
    .lbdpf-layout {
        flex-direction: column;
        gap: 20px;
    }

    .lbdpf-sidebar {
        width: 100%;
        flex: 1 1 auto;
    }

    /* Stacked layout: the filter sits above the products, so it must not
       float over them unless "Also on Tablet & Mobile" is enabled. */
    .lbdpf-sidebar.is-sticky {
        position: static;
        height: auto;
        max-height: none;
        overflow: visible;
    }

    /* Even then the panel is limited to half the screen: it sits ABOVE
       the products, so a taller block would hide every one of them. */
    .lbdpf-sidebar.is-sticky.is-sticky-all,
    .lbdpf-sidebar.is-sticky.is-sticky-all.is-sticky-viewport,
    .lbdpf-sidebar.is-sticky.is-sticky-all.is-sticky-page {
        position: sticky;
        top: var(--lbdpf-sticky-top, 24px);
        height: auto;
        max-height: 50vh;
        max-height: 50dvh;
        overflow-x: hidden;
        overflow-y: auto;
        overscroll-behavior: contain;
        -webkit-overflow-scrolling: touch;
    }
}

@media (max-width: 480px) {
    .lbdpf-toolbar {
        flex-direction: column;
        align-items: flex-start;
    }
}

/* ---------------------------------------------------------------------
 * Motion preferences
 * ------------------------------------------------------------------ */
@media (prefers-reduced-motion: reduce) {
    .lbdpf-card,
    .lbdpf-thumb img,
    .lbdpf-box,
    .lbdpf-label,
    .lbdpf-chip-label,
    .lbdpf-page,
    .lbdpf-view,
    .lbdpf-add {
        transition: none !important;
    }

    .lbdpf-card:hover {
        transform: none;
    }

    .lbdpf-card:hover .lbdpf-thumb img {
        transform: none;
    }
}
