/* Catalogue toolbar and modal filters. Scoped away from product/checkout forms. */
#gg-catalog-filters {
    --gg-filter-wine: #881337;
    margin: 0 0 24px;
    clear: both;
    scroll-margin-top: 24px;
}

#gg-catalog-filters .gg-filter-toolbar {
    display: flex;
    min-height: 66px;
    align-items: center;
    gap: 18px;
    border-bottom: 1px solid #e9e6e4;
}

#gg-catalog-filters .gg-filter-trigger {
    display: inline-flex;
    align-items: center;
    justify-content: flex-start;
    gap: 10px;
    min-height: 48px;
    margin: 0;
    padding: 8px 0;
    background: transparent;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    color: #222;
    font: inherit;
    font-size: 16px;
    font-weight: 500;
    line-height: 1.4;
    letter-spacing: 0;
    text-transform: none;
    cursor: pointer;
}

#gg-catalog-filters .gg-filter-trigger:hover { color: var(--gg-filter-wine); }
#gg-catalog-filters .gg-filter-trigger svg { width: 21px; height: 21px; flex: 0 0 21px; }
#gg-catalog-filters .gg-filter-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 22px;
    height: 22px;
    padding: 0 5px;
    border-radius: 50%;
    background: #881337;
    color: #fff;
    font-size: 11px;
    font-weight: 600;
}

#gg-catalog-filters .gg-filter-total {
    margin-left: auto;
    color: #777;
    font-size: 13px;
    white-space: nowrap;
}


#gg-catalog-filters .gg-filter-applied {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin: 14px 0 0;
}

#gg-catalog-filters .gg-filter-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 34px;
    padding: 6px 11px;
    border: 1px solid #ddd5d8;
    border-radius: 4px;
    background: #fff;
    color: #5b303e;
    font-size: 12px;
    line-height: 1.5;
    text-decoration: none;
}

#gg-catalog-filters .gg-filter-chip:hover { border-color: #881337; background: #fcf6f8; }
#gg-catalog-filters .gg-filter-clear {
    display: inline-flex;
    min-height: 36px;
    align-items: center;
    padding: 4px 7px;
    color: #666;
    font-size: 12px;
    text-decoration: underline;
    text-underline-offset: 3px;
}

#gg-filter-drawer {
    --gg-filter-wine: #881337;
    box-sizing: border-box;
    position: fixed;
    inset: 0 0 0 auto;
    width: 420px;
    max-width: 100%;
    height: 100vh;
    height: 100dvh;
    max-height: 100vh;
    max-height: 100dvh;
    margin: 0 0 0 auto;
    padding: 0;
    overflow: hidden;
    border: 0;
    border-radius: 0;
    background: #fff;
    color: #292727;
    box-shadow: -8px 0 40px rgb(0 0 0 / 8%);
    font-family: inherit;
    font-size: 15px;
}

#gg-filter-drawer:not([open]) { display: none; }
#gg-filter-drawer[open] { display: flex; flex-direction: column; }
#gg-filter-drawer::backdrop { background: rgb(0 0 0 / 46%); }
#gg-filter-drawer.gg-filter-fallback { z-index: 2147483000; box-shadow: 0 0 0 100vmax rgb(0 0 0 / 46%); }
#gg-filter-drawer *, #gg-filter-drawer *::before, #gg-filter-drawer *::after { box-sizing: border-box; }

#gg-filter-drawer .gg-filter-header {
    position: relative;
    flex: 0 0 auto;
    padding: 22px 58px 18px;
    border-bottom: 1px solid #eceaea;
    text-align: center;
}

#gg-filter-drawer .gg-filter-header h2 {
    margin: 0 0 5px;
    font-size: 17px;
    font-weight: 600;
    line-height: 1.4;
    color: #222;
    letter-spacing: 0;
    text-transform: none;
}

#gg-filter-drawer .gg-filter-preview-count { margin: 0; color: #767171; font-size: 13px; line-height: 1.5; }
#gg-filter-drawer .gg-filter-close {
    position: absolute;
    right: 12px;
    top: 13px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    min-height: 44px;
    margin: 0;
    padding: 10px;
    border: 0;
    border-radius: 0;
    background: transparent;
    color: #555;
    box-shadow: none;
    cursor: pointer;
}
#gg-filter-drawer .gg-filter-close:hover { color: #881337; background: #faf7f8; }
#gg-filter-drawer .gg-filter-close svg { width: 22px; height: 22px; }

#gg-filter-drawer .gg-filter-form {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    min-height: 0;
    margin: 0;
}

#gg-filter-drawer .gg-filter-body {
    flex: 1 1 auto;
    min-height: 0;
    padding: 10px 26px 30px;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
}

#gg-filter-drawer .gg-filter-group {
    margin: 0;
    padding: 0;
    border: 0;
    border-bottom: 1px solid #edeaea;
    border-radius: 0;
    background: transparent;
}

#gg-filter-drawer .gg-filter-group > summary {
    display: flex;
    min-height: 66px;
    align-items: center;
    gap: 12px;
    margin: 0;
    padding: 17px 2px;
    color: #353232;
    font-size: 15px;
    font-weight: 500;
    line-height: 1.6;
    list-style: none;
    cursor: pointer;
}
#gg-filter-drawer summary::-webkit-details-marker { display: none; }
#gg-filter-drawer .gg-filter-group > summary::after {
    content: '';
    flex: 0 0 7px;
    width: 7px;
    height: 7px;
    margin: -4px 4px 0 auto;
    border-right: 1px solid #676060;
    border-bottom: 1px solid #676060;
    transform: rotate(45deg);
}
#gg-filter-drawer .gg-filter-group[open] > summary::after { margin-top: 3px; transform: rotate(225deg); }
#gg-filter-drawer .gg-filter-selection {
    max-width: 165px;
    margin-left: auto;
    overflow: hidden;
    color: #881337;
    font-size: 12px;
    font-weight: 400;
    text-overflow: ellipsis;
    white-space: nowrap;
}
#gg-filter-drawer .gg-filter-selection:empty { display: none; }
#gg-filter-drawer .gg-filter-selection:not(:empty) + * { margin-left: 0; }
#gg-filter-drawer .gg-filter-options { padding: 0 2px 14px; }
#gg-filter-drawer .gg-filter-option {
    display: flex;
    min-height: 47px;
    align-items: center;
    gap: 12px;
    margin: 0;
    padding: 9px 0;
    color: #4c4747;
    font-size: 14px;
    font-weight: 400;
    line-height: 1.5;
    cursor: pointer;
}
#gg-filter-drawer .gg-filter-option input[type=checkbox] {
    appearance: auto;
    flex: 0 0 18px;
    width: 18px;
    height: 18px;
    margin: 0;
    accent-color: #881337;
    cursor: pointer;
}
#gg-filter-drawer .gg-filter-option:has(input:checked) { color: #881337; }

#gg-filter-drawer .gg-filter-price-fields { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 14px; padding: 0 2px 24px; }
#gg-filter-drawer .gg-filter-price-fields label { display: flex; flex-direction: column; gap: 7px; margin: 0; color: #777; font-size: 12px; font-weight: 400; }
#gg-filter-drawer .gg-filter-price-fields input {
    width: 100%;
    min-width: 0;
    height: 48px;
    padding: 10px 12px;
    border: 1px solid #d7d2d2;
    border-radius: 4px;
    background: #fff;
    box-shadow: none;
    color: #292727;
    font: inherit;
    font-size: 16px;
}

#gg-filter-drawer .gg-price-slider { margin: -6px 2px 24px; }
#gg-filter-drawer .gg-price-slider[hidden] { display: none; }
#gg-filter-drawer .gg-price-track { position: relative; height: 44px; margin: 0 12px; cursor: pointer; touch-action: none; }
#gg-filter-drawer .gg-price-track::before,
#gg-filter-drawer .gg-price-fill { position: absolute; top: 20px; height: 4px; border-radius: 2px; pointer-events: none; }
#gg-filter-drawer .gg-price-track::before { content: ''; left: 0; right: 0; background: #e5dfdf; }
#gg-filter-drawer .gg-price-fill { left: var(--gg-price-low, 0%); right: calc(100% - var(--gg-price-high, 100%)); background: #881337; }
#gg-filter-drawer .gg-price-slider input[type=range] {
    position: absolute;
    top: 0;
    left: -12px;
    width: calc(100% + 24px);
    max-width: none;
    height: 44px;
    min-height: 0;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    appearance: none;
    -webkit-appearance: none;
    pointer-events: none;
    touch-action: pan-y;
}
#gg-filter-drawer .gg-price-slider input[type=range]::-webkit-slider-runnable-track { height: 4px; background: transparent; border: 0; }
#gg-filter-drawer .gg-price-slider input[type=range]::-moz-range-track { height: 4px; background: transparent; border: 0; }
#gg-filter-drawer .gg-price-slider input[type=range]::-webkit-slider-thumb {
    width: 24px;
    height: 24px;
    margin-top: -10px;
    border: 2px solid #881337;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 1px 4px #0002;
    -webkit-appearance: none;
    appearance: none;
    cursor: grab;
    pointer-events: auto;
    touch-action: none;
}
#gg-filter-drawer .gg-price-slider input[type=range]::-moz-range-thumb {
    width: 24px;
    height: 24px;
    border: 2px solid #881337;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 1px 4px #0002;
    cursor: grab;
    pointer-events: auto;
    touch-action: none;
}
#gg-filter-drawer .gg-price-slider input[type=range]:active::-webkit-slider-thumb { cursor: grabbing; background: #fbf2f5; }
#gg-filter-drawer .gg-price-slider input[type=range]:active::-moz-range-thumb { cursor: grabbing; background: #fbf2f5; }
#gg-filter-drawer .gg-price-slider input[type=range]:focus-visible { outline: none; z-index: 2; }
#gg-filter-drawer .gg-price-slider input[type=range]:focus-visible::-webkit-slider-thumb { outline: 2px solid #881337; outline-offset: 3px; }
#gg-filter-drawer .gg-price-slider input[type=range]:focus-visible::-moz-range-thumb { outline: 2px solid #881337; outline-offset: 3px; }
#gg-filter-drawer .gg-price-bounds { display: flex; justify-content: space-between; gap: 12px; color: #777; font-size: 12px; line-height: 1.5; }

#gg-filter-drawer .gg-filter-footer {
    display: flex;
    flex: 0 0 auto;
    align-items: center;
    gap: 18px;
    margin: 0;
    padding: 20px 24px max(20px, env(safe-area-inset-bottom));
    border-top: 1px solid #e9e6e6;
    background: #fff;
}
#gg-filter-drawer .gg-filter-reset {
    flex: 0 0 auto;
    min-height: 48px;
    margin: 0;
    padding: 8px 2px;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    color: #5e5858;
    font: inherit;
    font-size: 14px;
    font-weight: 400;
    line-height: 1.4;
    letter-spacing: 0;
    text-decoration: underline;
    text-underline-offset: 4px;
    text-transform: none;
    cursor: pointer;
}
#gg-filter-drawer .gg-filter-submit {
    flex: 1 1 auto;
    min-width: 0;
    min-height: 50px;
    margin: 0;
    padding: 13px 12px;
    border: 1px solid #881337;
    border-radius: 5px;
    background: #881337;
    box-shadow: none;
    color: #fff;
    font: inherit;
    font-size: 14px;
    font-weight: 500;
    line-height: 1.4;
    letter-spacing: 0;
    text-transform: none;
    cursor: pointer;
}
#gg-filter-drawer .gg-filter-submit:hover { border-color: #69102b; background: #69102b; }
#gg-filter-drawer .gg-filter-submit:disabled { opacity: .65; cursor: wait; }
#gg-filter-drawer :is(a,button,input,select,summary):focus-visible,
#gg-catalog-filters :is(a,button,select):focus-visible { outline: 2px solid #881337; outline-offset: 4px; }
#gg-catalog-filters .gg-filter-empty { margin: 16px 0; color: #635858; font-size: 14px; }

@media (max-width: 767px) {
    #gg-catalog-filters { margin-bottom: 18px; scroll-margin-top: 15px; }
    #gg-catalog-filters .gg-filter-toolbar { gap: 10px; min-height: 60px; }
    #gg-catalog-filters .gg-filter-trigger { gap: 8px; font-size: 14px; }
    #gg-catalog-filters .gg-filter-total { font-size: 11px; }
    /* Keep part of the page visible beside the mobile drawer. */
    #gg-filter-drawer { width: calc(100% - 48px); max-width: 420px; }
    #gg-filter-drawer .gg-filter-header { padding-top: 20px; }
    #gg-filter-drawer .gg-filter-body { padding: 0 22px 24px; }
    #gg-filter-drawer .gg-filter-footer { padding-left: 22px; padding-right: 22px; }
}

@media (prefers-reduced-motion: no-preference) {
    #gg-filter-drawer[open] { animation: gg-filter-enter .2s ease-out; }
    #gg-filter-drawer[open]::backdrop { animation: gg-filter-backdrop .2s ease-out; }
    @keyframes gg-filter-enter { from { transform: translateX(100%); } to { transform: translateX(0); } }
    @keyframes gg-filter-backdrop { from { opacity: 0; } to { opacity: 1; } }
}
