/*
 * Delivery block of the buy-back form (public/js/buyback-shipping.js): courier chips, address fields,
 * picked locker, and the locker picker dialog with its map. Follows the --tb-* tokens (light and dark).
 */
/* Ways to hand the device over: side by side when there is room, one per row on a phone. */
.bb-choices--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.bb-choices--3 .bb-choice { flex-direction: column; align-items: flex-start; gap: 8px; min-height: 96px; padding: 14px; }
.bb-choices--3 .bb-choice > i { width: auto; font-size: 1.2rem; }
@media (max-width: 640px) {
    .bb-choices--3 { grid-template-columns: 1fr; }
    .bb-choices--3 .bb-choice { flex-direction: row; align-items: center; gap: var(--tb-s3, 12px); min-height: 64px; padding: var(--tb-s3, 12px) var(--tb-s4, 16px); }
    .bb-choices--3 .bb-choice > i { width: 20px; font-size: 1.1rem; }
}

/* What the chosen way needs: one framed block right under the choices. */
.bbs-panel {
    display: grid; gap: 14px; margin-top: 2px; padding: 16px;
    background: var(--tb-surface-2, rgba(127, 127, 127, .06)); border: 1px solid var(--tb-line); border-radius: var(--tb-r-md, 12px);
}
.bbs-block { display: grid; gap: 8px; }
.bbs-label { margin: 0; font-size: var(--tb-fs-sm); font-weight: 500; color: var(--tb-ink-2); }
.bbs-inline { margin: 0; font-size: var(--tb-fs-sm); color: var(--tb-ink-2); line-height: 1.45; }
.bbs-inline i { color: var(--tb-ink-3); margin-right: 4px; }
.bbs-inline--muted { color: var(--tb-ink-3); font-size: var(--tb-fs-xs); }
.bbs-hint { font-size: var(--tb-fs-xs); color: var(--tb-ok); line-height: 1.35; }
.bbs-hint:empty { display: none; }
.bbs-hint--muted { color: var(--tb-ink-3); }

/* Address grid: 12 columns, every row adds up to 12, labels and inputs start on the same lines. */
.bbs-grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 12px; align-items: start; }
.bbs-col { grid-column: span 12; min-width: 0; align-content: start; }
.bbs-col--8 { grid-column: span 8; }
.bbs-col--6 { grid-column: span 6; }
.bbs-col--4 { grid-column: span 4; }
.bbs-col--3 { grid-column: span 3; }
.bbs-caption { margin: 2px 0 -4px; font-size: var(--tb-fs-sm); font-weight: 500; color: var(--tb-ink-2); }
.bbs-caption span { color: var(--tb-ink-3); font-weight: 400; }
.bbs-grid .bbs-col--3 label { font-size: var(--tb-fs-xs); color: var(--tb-ink-3); }
@media (max-width: 480px) {
    .bbs-panel { padding: 12px; }
    .bbs-grid { gap: 10px; }
    .bbs-col--8, .bbs-col--6 { grid-column: span 12; }
    .bbs-col--4 { grid-column: span 12; }
    /* Street and number stay on one row: the number is short. */
    .bbs-grid .bbs-col--8:has(#shipStreet) { grid-column: span 8; }
    .bbs-grid .bbs-col--4:has(#shipNumber) { grid-column: span 4; }
}

.bbs-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.bbs-chip {
    display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 0 14px; cursor: pointer;
    font: inherit; font-size: var(--tb-fs-sm); font-weight: 600; color: var(--tb-ink-2);
    background: var(--tb-surface); border: 1px solid var(--tb-line-strong); border-radius: 999px;
    transition: border-color .15s ease, background .15s ease, color .15s ease;
}
.bbs-chip:hover { border-color: var(--tb-ink-3); color: var(--tb-ink); }
.bbs-chip:focus-visible { outline: 2px solid var(--tb-brand); outline-offset: 2px; }
.bbs-chip.selected { border-color: var(--tb-brand); background: var(--tb-brand-soft); color: var(--tb-ink); }
.bbs-chip__dot { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.bbs-chips--filter .bbs-chip:not(.selected) { opacity: .55; }

/* Courier visit: day cards, then the hours of the chosen day, then what will happen in one line. */
.bbs-pickup { gap: 10px; padding-top: 14px; border-top: 1px solid var(--tb-line); }
.bbs-pickup__body { display: grid; gap: 10px; }
.bbs-days { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; }
.bbs-day {
    display: grid; justify-items: center; align-content: center; gap: 1px; min-height: 72px; padding: 8px 4px; cursor: pointer;
    font: inherit; color: var(--tb-ink-2); background: var(--tb-surface);
    border: 1px solid var(--tb-line-strong); border-radius: var(--tb-r-md, 12px);
    transition: border-color .15s ease, background .15s ease, box-shadow .15s ease;
}
.bbs-day:hover { border-color: var(--tb-ink-3); }
.bbs-day:focus-visible { outline: 2px solid var(--tb-brand); outline-offset: 2px; }
.bbs-day__name { font-size: var(--tb-fs-xs); font-weight: 600; color: var(--tb-ink-3); }
.bbs-day strong { font-size: 1.3rem; line-height: 1.15; font-weight: 700; color: var(--tb-ink); font-variant-numeric: tabular-nums; }
.bbs-day__month { font-size: var(--tb-fs-xs); color: var(--tb-ink-3); }
.bbs-day.selected { border-color: var(--tb-brand); background: var(--tb-brand-soft); box-shadow: inset 0 0 0 1px var(--tb-brand); }
.bbs-day.selected .bbs-day__name, .bbs-day.selected .bbs-day__month { color: var(--tb-ink-2); }
.bbs-hours .bbs-chip { min-width: 74px; justify-content: center; font-variant-numeric: tabular-nums; }
.bbs-pickup__sum {
    display: flex; align-items: flex-start; gap: 10px; margin: 0; padding: 10px 12px;
    font-size: var(--tb-fs-sm); line-height: 1.45; color: var(--tb-ink-2);
    background: var(--tb-ok-soft); border-radius: var(--tb-r-md, 12px);
}
.bbs-pickup__sum i { margin-top: 3px; color: var(--tb-ok); flex: none; }
.bbs-pickup__sum strong { color: var(--tb-ink); font-weight: 600; }
@media (max-width: 480px) {
    .bbs-days { gap: 6px; }
    .bbs-day { min-height: 66px; padding: 6px 2px; }
    .bbs-day strong { font-size: 1.15rem; }
    .bbs-hours .bbs-chip { flex: 1 1 0; min-width: 62px; padding: 0 8px; }
}

.bbs-open { width: 100%; min-height: 48px; justify-content: center; gap: 8px; border: 1px dashed var(--tb-line-strong); background: var(--tb-surface); color: var(--tb-ink); font-weight: 600; }
.bbs-open:hover { border-color: var(--tb-brand); }
.bbs-picked, .bbs-point {
    display: flex; align-items: flex-start; gap: 10px; width: 100%; text-align: left; font: inherit; color: var(--tb-ink);
    background: var(--tb-surface); border: 1px solid var(--tb-line-strong); border-radius: var(--tb-r-md, 12px); padding: 10px 12px;
}
.bbs-picked { border-color: var(--tb-brand); background: var(--tb-brand-soft); align-items: center; }
.bbs-picked .bb-link { margin-left: auto; flex: none; }
.bbs-point__dot { width: 12px; height: 12px; border-radius: 50%; margin-top: 4px; flex: none; }
.bbs-point__text { display: grid; gap: 2px; min-width: 0; }
.bbs-point__text strong { font-size: var(--tb-fs-sm); font-weight: 600; line-height: 1.3; }
.bbs-point__text small { font-size: var(--tb-fs-xs); color: var(--tb-ink-3); line-height: 1.35; }
.bbs-point__tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 2px; }
.bbs-point__tags span { font-size: 11px; font-weight: 600; padding: 1px 7px; border-radius: 999px; background: var(--tb-surface-2, rgba(127, 127, 127, .14)); color: var(--tb-ink-2); }

/* ---------- Locker picker ---------- */
.bbs-dialog {
    position: fixed; inset: 0; margin: auto;
    width: min(1040px, calc(100vw - 24px)); height: min(720px, calc(100dvh - 24px)); max-width: none; max-height: none; padding: 0;
    border: 1px solid var(--tb-line-strong); border-radius: var(--tb-r-xl, 24px); overflow: hidden;
    background: var(--tb-canvas, #fff); color: var(--tb-ink, #0f172a); box-shadow: 0 30px 80px rgba(4, 8, 22, .5);
}
.bbs-dialog[open] { display: grid; grid-template-rows: auto auto minmax(0, 1fr) auto; }
.bbs-dialog::backdrop { background: rgba(6, 9, 20, .62); backdrop-filter: blur(3px); }
.bbs-dialog__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 18px 6px; }
.bbs-dialog__head h2 { margin: 0; font-family: var(--tb-font-display); font-size: var(--tb-fs-xl); font-weight: 700; letter-spacing: -0.01em; }
.bbs-dialog__close {
    width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--tb-line-strong); background: var(--tb-surface); color: var(--tb-ink);
    display: grid; place-items: center; cursor: pointer; font-size: 1rem;
}
.bbs-dialog__close:focus-visible { outline: 2px solid var(--tb-brand); outline-offset: 2px; }
.bbs-dialog__tools { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr) auto; gap: 10px 12px; align-items: end; padding: 8px 18px 12px; }
.bbs-field { display: grid; gap: 4px; min-width: 0; }
.bbs-field label { font-size: var(--tb-fs-xs); font-weight: 600; color: var(--tb-ink-3); }
.bbs-field input {
    width: 100%; min-height: 44px; padding: 10px 12px; font: inherit; font-size: var(--tb-fs-md); color: var(--tb-ink);
    background: var(--tb-surface); border: 1px solid var(--tb-line-strong); border-radius: var(--tb-r-sm, 8px);
}
.bbs-field input:focus { outline: none; border-color: var(--tb-brand); box-shadow: 0 0 0 3px var(--tb-brand-soft); }
.bbs-field input::placeholder { color: var(--tb-ink-3); opacity: .8; }
.bbs-dialog__body { display: grid; grid-template-columns: minmax(280px, 360px) minmax(0, 1fr); min-height: 0; border-top: 1px solid var(--tb-line); border-bottom: 1px solid var(--tb-line); }
.bbs-list { overflow-y: auto; overscroll-behavior: contain; padding: 10px; display: grid; gap: 8px; align-content: start; background: var(--tb-canvas); }
.bbs-list:focus-visible { outline: 2px solid var(--tb-brand); outline-offset: -2px; }
.bbs-point { cursor: pointer; transition: border-color .15s ease, background .15s ease; }
.bbs-point:hover { border-color: var(--tb-ink-3); }
.bbs-point:focus-visible { outline: 2px solid var(--tb-brand); outline-offset: 2px; }
.bbs-point.selected { border-color: var(--tb-brand); box-shadow: inset 0 0 0 1px var(--tb-brand); background: var(--tb-brand-soft); }
.bbs-empty { margin: 0; padding: 22px 12px; text-align: center; font-size: var(--tb-fs-sm); color: var(--tb-ink-3); line-height: 1.5; }
.bbs-empty--bad { color: var(--tb-bad); }
.bbs-map { min-height: 0; background: var(--tb-stage, #e9edf3); position: relative; z-index: 0; }
.bbs-map .leaflet-container { height: 100%; font: inherit; }
/* store.css caps every element at max-width:100% on phones; Leaflet's panes are 0 wide, so the pins would vanish. */
.bbs-dialog .leaflet-pane, .bbs-dialog .leaflet-pane * { max-width: none; }
.bbs-pin { background: none; border: 0; }
.bbs-pin svg { display: block; overflow: visible; filter: drop-shadow(0 2px 3px rgba(15, 23, 42, .35)); transform-origin: 50% 100%; transition: transform .16s ease; }
.bbs-pin__body { stroke: #fff; stroke-width: 1.6; }
.bbs-pin:hover svg { transform: scale(1.12); }
.bbs-pin.is-selected { z-index: 1000 !important; }
.bbs-pin.is-selected svg { transform: scale(1.35); filter: drop-shadow(0 4px 6px rgba(15, 23, 42, .5)); }
.bbs-pin.is-selected .bbs-pin__body { stroke: #0f172a; stroke-width: 2; }
.bbs-dialog__foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 18px; background: var(--tb-surface); }
.bbs-dialog__sel { margin: 0; font-size: var(--tb-fs-sm); color: var(--tb-ink-2); min-width: 0; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.bbs-dialog__foot .tb-btn { flex: none; min-height: 46px; }

@media (max-width: 760px) {
    .bbs-dialog { width: 100vw; height: 100dvh; border-radius: 0; border: 0; }
    .bbs-dialog__tools { grid-template-columns: 1fr; padding: 6px 14px 10px; }
    .bbs-field--filter { display: none; }
    .bbs-dialog__body { grid-template-columns: 1fr; grid-template-rows: minmax(210px, 44%) minmax(0, 1fr); }
    .bbs-map { grid-row: 1; }
    .bbs-list { grid-row: 2; }
    .bbs-dialog__foot { flex-direction: column; align-items: stretch; padding: 10px 14px calc(10px + env(safe-area-inset-bottom)); }
    .bbs-dialog__foot .tb-btn { width: 100%; justify-content: center; }
}
@media (prefers-reduced-motion: reduce) {
    .bbs-chip, .bbs-day, .bbs-point, .bbs-pin svg { transition: none; }
}
