/* ================================================================================
   FILTERS.CSS - The Filters sheet
   Scoped to #venueFilterSheet

   One sheet for the results list and the map. It slides up from the bottom
   and sits between the top and bottom navigation. ModalManager shows and
   hides it (display) and sets its z-index.
   ================================================================================ */

#venueFilterSheet {
    position: fixed;
    top: calc(var(--nav-height) + env(safe-area-inset-top));
    bottom: calc(var(--nav-height) + env(safe-area-inset-bottom));
    left: 0;
    right: 0;
    z-index: var(--z-modal-backdrop);
    display: none;
    flex-direction: column;
    justify-content: flex-end;
}

#venueFilterSheet.active {
    display: flex;
}

/* Light on purpose: the screen underneath redraws as each control is
   tapped, and the strip of it above the sheet is how you see that happen. */
#venueFilterSheet .vfs-backdrop {
    position: absolute;
    inset: 0;
    background: var(--modal-backdrop);
    opacity: 0.5;
}

#venueFilterSheet .vfs-panel {
    position: relative;
    display: flex;
    flex-direction: column;
    max-height: 100%;
    padding: var(--space-sm) var(--space-lg) var(--space-lg);
    background: var(--bg-card);
    color: var(--text-primary);
    border-top: 1px solid var(--border-light);
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.25);
    animation: vfsSlideUp var(--transition);
}

@keyframes vfsSlideUp {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
}

@media (prefers-reduced-motion: reduce) {
    #venueFilterSheet .vfs-panel {
        animation: none;
    }
}

/* On a wide screen a full-width sheet is a letterbox. Phone-sized and
   centred, like the map's venue card. */
@media (min-width: 640px) {
    #venueFilterSheet {
        align-items: center;
    }

    #venueFilterSheet .vfs-panel {
        width: 420px;
        margin-bottom: var(--space-lg);
        border: 1px solid var(--border-light);
        border-radius: var(--radius-xl);
    }
}

#venueFilterSheet .vfs-handle {
    flex: none;
    align-self: center;
    width: 40px;
    height: 4px;
    margin: var(--space-xs) 0;
    border-radius: 2px;
    background: var(--border-medium);
}

#venueFilterSheet .vfs-header {
    flex: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

#venueFilterSheet .vfs-title {
    margin: 0;
    font-size: var(--text-lg);
    font-weight: 700;
    color: var(--text-primary);
}

#venueFilterSheet .vfs-reset {
    min-height: 44px;
    padding: 0 var(--space-sm);
    background: none;
    border: none;
    color: var(--text-purple);
    font-family: inherit;
    font-size: var(--text-sm);
    font-weight: 700;
    cursor: pointer;
}

/* The sections scroll; the header above and the button below stay put, so
   the count is always on screen however long the style list gets. */
#venueFilterSheet .vfs-scroll {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

#venueFilterSheet .vfs-heading {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: var(--space-sm);
    margin: 0;
    padding: var(--space-md) 0 var(--space-sm);
    font-size: var(--text-xs);
    font-weight: 700;
    letter-spacing: 0.4px;
    text-transform: uppercase;
    color: var(--text-muted);
}

#venueFilterSheet .vfs-note {
    font-weight: 400;
    letter-spacing: 0;
    text-transform: none;
}

/* A set of choices that wraps: as many to a line as fit. */
#venueFilterSheet .vfs-options {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-sm);
    color: var(--text-muted);
    font-size: var(--text-sm);
}

/* A short set of choices on one line, every one the same width. */
#venueFilterSheet .vfs-row {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: minmax(0, 1fr);
    gap: var(--space-sm);
}

#venueFilterSheet .vfs-option {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    min-height: 44px;
    padding: 0 14px;
    background: transparent;
    color: var(--text-muted);
    border: 1.5px solid var(--border-medium);
    border-radius: var(--radius-pill);
    font-family: inherit;
    font-size: var(--text-sm);
    font-weight: 600;
    white-space: nowrap;
    cursor: pointer;
    transition: border-color var(--transition-fast), background var(--transition-fast), color var(--transition-fast);
}

/* Four or more to a line on a phone: the words need the room the padding
   was taking. */
#venueFilterSheet .vfs-row .vfs-option {
    padding: 0 var(--space-xs);
}

#venueFilterSheet .vfs-option.is-on {
    background: var(--bg-purple);
    color: var(--text-primary);
    border-color: var(--purple);
}

/* A choice that would find nothing: there, so the row doesn't reshuffle,
   but plainly not on offer. */
#venueFilterSheet .vfs-option:disabled {
    opacity: 0.4;
    cursor: default;
}

/* How many venues a style or trait finds. Context, not the label - quieter
   so the name reads first. */
#venueFilterSheet .vfs-count {
    font-size: var(--text-xs);
    font-weight: 400;
    opacity: 0.75;
}

/* Off = hollow ring in the text colour, on = the marker's own colour. The
   difference is fill, not just hue, so it reads without colour vision.
   The colours are the ones the map draws its markers in. */
#venueFilterSheet .vfs-dot {
    flex: none;
    width: 12px;
    height: 12px;
    border-radius: var(--radius-circle);
    border: 2px solid currentColor;
    background: transparent;
}

#venueFilterSheet .vfs-dot.kind-brewery {
    border-radius: 4px;
}

#venueFilterSheet .vfs-option.is-on .vfs-dot.tier-diamond {
    background: #4dd0e1;
    border-color: #006064;
}

#venueFilterSheet .vfs-option.is-on .vfs-dot.tier-gold {
    background: #ffc61a;
    border-color: #b8860b;
}

#venueFilterSheet .vfs-option.is-on .vfs-dot.tier-silver {
    background: #e0e0e0;
    border-color: #616161;
}

#venueFilterSheet .vfs-option.is-on .vfs-dot.tier-bronze {
    background: #cd7f32;
    border-color: #5d3a1a;
}

#venueFilterSheet .vfs-option.is-on .vfs-dot.kind-brewery {
    background: #047857;
    border-color: #047857;
}

#venueFilterSheet .vfs-switch {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    width: 100%;
    min-height: 56px;
    padding: var(--space-sm) 0;
    background: none;
    border: none;
    border-top: 1px solid var(--border-light);
    color: var(--text-primary);
    font-family: inherit;
    text-align: left;
    cursor: pointer;
}

/* The hidden attribute loses to display:flex above without this. */
#venueFilterSheet .vfs-switch[hidden] {
    display: none;
}

#venueFilterSheet .vfs-switch-text {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

#venueFilterSheet .vfs-switch-label {
    font-size: var(--text-sm);
    font-weight: 600;
    color: var(--text-primary);
}

#venueFilterSheet .vfs-switch-sub {
    font-size: var(--text-xs);
    color: var(--text-muted);
}

#venueFilterSheet .vfs-switch-track {
    flex: none;
    display: flex;
    width: 44px;
    height: 26px;
    padding: 3px;
    border-radius: 13px;
    background: var(--border-medium);
    transition: background var(--transition-fast);
}

#venueFilterSheet .vfs-switch-knob {
    width: 20px;
    height: 20px;
    border-radius: var(--radius-circle);
    background: var(--text-white);
    box-shadow: var(--shadow-sm);
    transition: transform var(--transition-fast);
}

#venueFilterSheet .vfs-switch.is-on .vfs-switch-track {
    background: var(--purple);
}

#venueFilterSheet .vfs-switch.is-on .vfs-switch-knob {
    transform: translateX(18px);
}

#venueFilterSheet .vfs-done {
    flex: none;
    min-height: 48px;
    margin-top: var(--space-md);
    background: var(--primary-gradient-simple);
    color: var(--text-white);
    border: none;
    border-radius: var(--radius);
    font-family: inherit;
    font-size: var(--text-sm);
    font-weight: 700;
    cursor: pointer;
}
