/* ==========================================================================
   Bottom sheet (native <dialog>), e.g. Sort / Brand / Price on the category page
   Behaviour: js/storefront/sheets.js
   ========================================================================== */

.sheet {
    width: 100%;
    max-width: 520px;
    max-height: 80vh;
    /* The screen actually visible (a phone's browser bars may cover part of 80vh) */
    max-height: 80dvh;
    margin: auto auto 0;
    padding: 0;
    border: 0;
    border-radius: 22px 22px 0 0;
    background: var(--color-surface);
    color: var(--color-text);
    box-shadow: 0 -10px 30px rgba(28, 21, 48, 0.18);
}

.sheet::backdrop {
    background: rgba(28, 21, 48, 0.45);
}

.sheet[open] {
    animation: sheet-up 0.2s ease-out;
}

@keyframes sheet-up {
    from { transform: translateY(40px); opacity: 0; }
    to   { transform: translateY(0); opacity: 1; }
}

.sheet__panel {
    max-height: 80vh;
    max-height: 80dvh;
    padding: var(--space-4) var(--space-4) calc(var(--space-4) + env(safe-area-inset-bottom));
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
}

.sheet__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-3);
}

.sheet__title {
    font-size: 18px;
    font-weight: 800;
    color: var(--color-ink);
}

.sheet__close {
    width: 44px;
    height: 44px;
    margin: -8px -8px -8px 0;
    border: 0;
    border-radius: var(--radius-pill);
    background: transparent;
    color: var(--color-ink);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.sheet__close:hover {
    background: var(--color-soft);
}

.sheet__options {
    margin: 0;
    padding: 0;
    list-style: none;
    display: flex;
    flex-direction: column;
}

.sheet__options--scroll {
    min-height: 0;
    overflow-y: auto;
}

.sheet__option {
    min-height: 48px;
    padding: 0 var(--space-1);
    border-bottom: 1px solid #F1ECF7;
    font-size: 15px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-3);
}

.sheet__option.is-selected {
    color: var(--color-primary-dark);
    font-weight: 800;
}

.sheet__mark {
    width: 24px;
    height: 24px;
    border-radius: var(--radius-pill);
    border: 2px solid #D8CCEB;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sheet__mark .icon {
    width: 14px;
    height: 14px;
    stroke-width: 3;
    visibility: hidden;
}

.sheet__option.is-selected .sheet__mark {
    border-color: var(--color-primary);
    background: var(--color-primary);
    color: var(--color-on-primary);
}

.sheet__option.is-selected .sheet__mark .icon {
    visibility: visible;
}

/* Tick boxes (Brand) */
.sheet__check {
    min-height: 48px;
    padding: 0 var(--space-1);
    border-bottom: 1px solid #F1ECF7;
    display: flex;
    align-items: center;
    gap: var(--space-3);
    cursor: pointer;
}

.sheet__check input {
    width: 20px;
    height: 20px;
    margin: 0;
    flex-shrink: 0;
    accent-color: var(--color-primary);
}

.sheet__check-name {
    flex: 1 1 auto;
    font-size: 15px;
    font-weight: 600;
}

.sheet__check-count {
    font-size: 13px;
    color: var(--color-text-muted);
}

.sheet__foot {
    padding-top: var(--space-2);
    display: flex;
    gap: var(--space-3);
}

/*
 * The main button of a long sheet: stays at the bottom on a white strip while the sheet scrolls,
 * never cut off (it takes the panel's bottom padding)
 */
.sheet__sticky-foot {
    position: sticky;
    bottom: 0;
    z-index: 1;
    margin: 0 calc(-1 * var(--space-4)) calc(-1 * (var(--space-4) + env(safe-area-inset-bottom)));
    padding: var(--space-3) var(--space-4) calc(var(--space-4) + env(safe-area-inset-bottom));
    border-top: 1px solid #EEE8F7;
    background: var(--color-surface);
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

.sheet__clear,
.sheet__apply {
    flex: 1 1 0;
    height: 46px;
    justify-content: center;
    font-size: 15px;
}

.sheet__note {
    font-size: 12px;
    color: var(--color-text-muted);
}

/* ---------- Brand filter: A–Z, a product photo per brand, the A–Z bar (js/storefront/brand-sheet.js) ----------
   Letter heading #6B5B8C on #F7F4FC · photo box #F3EEFA / letter #6B21A8 · bar #6B21A8 */

.brand-sheet {
    position: relative;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

.brand-sheet--letters .brand-sheet__list {
    padding-right: 28px;
}

.brand-sheet__letter {
    position: sticky;
    top: 0;
    z-index: 1;
    padding: 4px 8px;
    background: #F7F4FC;
    color: #6B5B8C;
    font-size: 13px;
    font-weight: 800;
}

.brand-sheet__row {
    gap: 12px;
}

.brand-sheet__photo {
    flex: none;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: #F3EEFA;
    object-fit: contain;
}

.brand-sheet__photo--letter {
    display: flex;
    align-items: center;
    justify-content: center;
    color: #6B21A8;
    font-size: 16px;
    font-weight: 800;
}

.brand-sheet__bar {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    width: 26px;
    display: flex;
    flex-direction: column;
    justify-content: space-around;
    touch-action: none;
}

.brand-sheet__jump {
    flex: 1 1 auto;
    min-height: 0;
    padding: 0;
    border: 0;
    background: transparent;
    color: #6B21A8;
    font: inherit;
    font-size: 11px;
    font-weight: 800;
    cursor: pointer;
}
