/* Multi-branch picker: location-style trigger + native bottom-sheet (same on mobile + desktop) */

:root {
  --lm-branch-surface: var(--sf-card, #ffffff);
  --lm-branch-text: var(--sf-text, #1f2937);
  --lm-branch-muted: var(--sf-muted, #6b7280);
  --lm-branch-border: var(--sf-border, #e5e7eb);
  --lm-branch-accent: var(--sf-accent, var(--store-primary, #0f766e));
  --lm-branch-radius: 26px;
}

/* ---------- Trigger (rendered in the location slot) ---------- */
.lm-branch-trigger {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  margin: 0;
  padding: 2px 2px 2px 0;
  border: 0;
  background: none;
  font: inherit;
  font-size: 0.78rem;
  font-weight: 700;
  line-height: 1.2;
  color: var(--store-primary, var(--lm-branch-text));
  cursor: pointer;
  min-width: 0;
  max-width: 60vw;
  -webkit-tap-highlight-color: transparent;
}

.lm-branch-trigger__pin {
  display: inline-flex;
  flex: none;
  color: var(--store-primary, var(--lm-branch-accent));
}

.lm-branch-trigger__name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.lm-branch-trigger__caret {
  display: inline-flex;
  flex: none;
  color: var(--lm-branch-muted);
  transition: transform 0.2s ease;
}

.lm-branch-trigger:hover .lm-branch-trigger__caret,
.lm-branch-trigger:focus-visible .lm-branch-trigger__caret {
  transform: translateY(1px);
}

/* Trigger placed inside the standard storefront header */
.sf-header-actions .lm-branch-trigger {
  max-width: 38vw;
  font-size: 0.82rem;
}

/* ---------- Branch announcement ---------- */
.lm-branch-announce {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 0.5rem 0 0;
  color: var(--lm-branch-muted);
  font-size: 0.78rem;
}

.lm-branch-announce__icon {
  color: var(--lm-branch-accent);
  flex: none;
}

/* ---------- Overlay + scrim ---------- */
.lm-branch-overlay {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.lm-branch-overlay[hidden] {
  display: none;
}

.lm-branch-scrim {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.5);
  -webkit-backdrop-filter: blur(3px);
  backdrop-filter: blur(3px);
  opacity: 0;
  transition: opacity 0.4s ease;
}

.lm-branch-overlay.is-visible .lm-branch-scrim {
  opacity: 1;
}

/* ---------- Bottom sheet (identical on mobile + desktop) ---------- */
.lm-branch-sheet {
  position: relative;
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
  max-height: 86vh;
  overflow-y: auto;
  background: var(--lm-branch-surface);
  color: var(--lm-branch-text);
  border-radius: var(--lm-branch-radius) var(--lm-branch-radius) 0 0;
  padding: 10px 20px calc(20px + env(safe-area-inset-bottom));
  box-shadow: 0 -22px 60px rgba(15, 23, 42, 0.32);
  transform: translateY(100%);
  transition: transform 0.42s cubic-bezier(0.16, 1, 0.3, 1);
  will-change: transform;
}

.lm-branch-overlay.is-visible .lm-branch-sheet {
  transform: translateY(0);
}

.lm-branch-sheet__handle {
  display: block;
  width: 42px;
  height: 5px;
  margin: 4px auto 14px;
  border-radius: 999px;
  background: var(--lm-branch-border);
}

.lm-branch-sheet__head {
  margin-bottom: 16px;
  text-align: center;
}

.lm-branch-sheet__title {
  margin: 0;
  font-size: 1.22rem;
  font-weight: 800;
  letter-spacing: -0.01em;
}

.lm-branch-sheet__sub {
  margin: 5px 0 0;
  color: var(--lm-branch-muted);
  font-size: 0.9rem;
}

.lm-branch-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.lm-branch-option {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  min-height: 60px;
  padding: 12px 16px;
  border: 1.5px solid var(--lm-branch-border);
  border-radius: var(--radius-s);
  background: var(--lm-branch-surface);
  color: inherit;
  font: inherit;
  text-align: start;
  cursor: pointer;
  transition: transform 0.16s ease, background 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease;
  -webkit-tap-highlight-color: transparent;
}

.lm-branch-option:hover {
  border-color: color-mix(in srgb, var(--lm-branch-accent) 50%, var(--lm-branch-border));
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.08);
}

.lm-branch-option:active {
  transform: scale(0.99);
}

.lm-branch-option.is-active {
  border-color: var(--lm-branch-accent);
  background: color-mix(in srgb, var(--lm-branch-accent) 10%, var(--lm-branch-surface));
}

.lm-branch-option__pin {
  display: inline-flex;
  flex: none;
  width: 38px;
  height: 38px;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-xs);
  color: var(--lm-branch-accent);
  background: color-mix(in srgb, var(--lm-branch-accent) 12%, transparent);
}

.lm-branch-option__body {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  flex: 1 1 auto;
}

.lm-branch-option__name {
  font-weight: 700;
  font-size: 1rem;
}

.lm-branch-option__addr {
  color: var(--lm-branch-muted);
  font-size: 0.85rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.lm-branch-option__check {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 999px;
  color: #fff;
  background: var(--lm-branch-accent);
  opacity: 0;
  transform: scale(0.6);
  transition: opacity 0.16s ease, transform 0.16s ease;
}

.lm-branch-option.is-active .lm-branch-option__check {
  opacity: 1;
  transform: scale(1);
}

body.lm-branch-open {
  overflow: hidden;
}

@media (prefers-reduced-motion: reduce) {
  .lm-branch-sheet,
  .lm-branch-scrim,
  .lm-branch-option__check {
    transition: none;
  }
}
