/* Load after the storefront stylesheet. All rules belong to this dialog only. */
#modal.address-dialog {
  --av2-cream: #f6f3e9;
  --av2-green: #1d5a37;
  --av2-orange: #ed5c2b;
  --av2-ink: #233a30;
  --av2-line: #dce2d8;
  box-sizing: border-box;
  width: 100%;
  max-width: 620px;
  max-height: 96vh;
  max-height: 96dvh;
  margin: auto auto 0;
  padding: 0;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  border: 1px solid rgb(35 58 48 / 10%);
  border-radius: 26px 26px 0 0;
  background: var(--av2-cream);
  color: var(--av2-ink);
  box-shadow: 0 20px 80px rgb(18 45 29 / 24%);
  color-scheme: light;
  scroll-padding-top: 74px;
  scroll-padding-bottom: 120px;
}
#modal.address-dialog::backdrop { background: rgb(20 36 28 / 45%); }
#modal.address-dialog *,
#modal.address-dialog *::before,
#modal.address-dialog *::after { box-sizing: border-box; }
#modal.address-dialog [hidden],
#modal.address-dialog #geoStatus,
#modal.address-dialog input[type="hidden"],
#modal.address-dialog #map > p { display: none !important; }
#modal.address-dialog .modal-head {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 0;
  padding: 10px 16px 8px 22px;
  border-bottom: 1px solid var(--av2-line);
  background: var(--av2-cream);
}
#modal.address-dialog .modal-head h2 {
  margin: 0;
  color: var(--av2-green);
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.4;
}
#modal.address-dialog button,
#modal.address-dialog input { font-family: inherit; }
#modal.address-dialog button {
  min-width: 44px;
  min-height: 44px;
  cursor: pointer;
  touch-action: manipulation;
}
#modal.address-dialog .modal-head .icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  padding: 10px;
  border: 1px solid var(--av2-line);
  border-radius: 50%;
  background: #fffdf7;
  color: var(--av2-ink);
}
#modal.address-dialog :is(button,input,[tabindex]):focus-visible {
  outline: 3px solid var(--av2-orange);
  outline-offset: 3px;
}
#modal.address-dialog .av2-form {
  display: block;
  width: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
}
#modal.address-dialog .av2-progress {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin: 0;
  padding: 18px 22px 0;
  list-style: none;
}
#modal.address-dialog .av2-progress li {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-bottom: 12px;
  border-bottom: 2px solid var(--av2-line);
  color: #5c6b60;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.4;
}
#modal.address-dialog .av2-progress li span {
  display: inline-grid;
  flex-shrink: 0;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #e4e8df;
}
#modal.address-dialog .av2-progress [aria-current="step"] {
  border-color: var(--av2-orange);
  color: var(--av2-green);
}
#modal.address-dialog .av2-progress [aria-current="step"] span {
  background: var(--av2-green);
  color: white;
}
#modal.address-dialog .av2-heading { padding: 20px 22px 18px; }
#modal.address-dialog .av2-heading h3 {
  margin: 0 0 8px;
  color: var(--av2-ink);
  font-size: clamp(24px, 5.8vw, 30px);
  font-weight: 650;
  letter-spacing: -.035em;
  line-height: 1.15;
}
#modal.address-dialog .av2-heading p {
  max-width: 44ch;
  margin: 0;
  color: #58685d;
  font-size: 14px;
  line-height: 1.5;
}
#modal.address-dialog .av2-map-frame {
  position: relative;
  isolation: isolate;
  height: 45vh;
  height: 45dvh;
  min-height: 250px;
  max-height: 470px;
  margin: 0 12px;
  overflow: hidden;
  border: 1px solid #d7dfd2;
  border-radius: 20px;
  background: #e4eadd;
}
#modal.address-dialog #map {
  position: absolute;
  z-index: 0;
  inset: 0;
  width: 100%;
  height: 100%;
  min-height: 0;
  margin: 0;
  border: 0;
  border-radius: 0;
}
#modal.address-dialog .av2-search {
  position: absolute;
  z-index: 5;
  top: 12px;
  right: 12px;
  left: 12px;
  display: flex;
  align-items: center;
  gap: 2px;
  min-height: 52px;
  margin: 0;
  padding: 0 4px 0 14px;
  border: 1px solid rgb(35 58 48 / 12%);
  border-radius: 15px;
  background: #fffefa;
  box-shadow: 0 4px 20px rgb(35 58 48 / 13%);
}
#modal.address-dialog .map-search-icon {
  position: static;
  display: flex;
  flex-shrink: 0;
  align-items: center;
  color: var(--av2-green);
  transform: none;
}
#modal.address-dialog #mapSearchInput {
  flex: 1;
  width: 0;
  min-width: 0;
  min-height: 50px;
  margin: 0;
  padding: 10px 8px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--av2-ink);
  box-shadow: none;
  font-size: 16px;
}
#modal.address-dialog #mapSearchInput::-webkit-search-cancel-button { appearance: none; }
#modal.address-dialog #mapSearchClear {
  position: static;
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  padding: 10px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--av2-ink);
  transform: none;
}
#modal.address-dialog #mapSearchResults {
  position: absolute;
  z-index: 6;
  top: calc(100% + 8px);
  right: 0;
  left: 0;
  max-height: min(30vh, 260px);
  overflow-y: auto;
  overscroll-behavior: contain;
  border: 1px solid var(--av2-line);
  border-radius: 14px;
  background: #fffefa;
  box-shadow: 0 8px 28px rgb(35 58 48 / 16%);
}
#modal.address-dialog .map-search-item {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 52px;
  padding: 12px;
  border-bottom: 1px solid var(--av2-line);
  color: var(--av2-ink);
  font-size: 14px;
  line-height: 1.4;
  cursor: pointer;
}
#modal.address-dialog .map-search-item:last-child { border-bottom: 0; }
#modal.address-dialog .map-search-item:is(:hover,:focus-visible) { background: var(--av2-cream); }
#modal.address-dialog .search-item-info { min-width: 0; }
#modal.address-dialog .search-item-info :is(strong,small) { display: block; overflow-wrap: anywhere; }
#modal.address-dialog .search-item-info small { margin-top: 3px; color: #58685d; font-size: 12px; }
#modal.address-dialog .av2-zone {
  position: absolute;
  z-index: 2;
  top: 76px;
  left: 12px;
  max-width: calc(100% - 24px);
  padding: 8px 12px;
  border: 1px solid #d8e0d4;
  border-radius: 999px;
  background: #fffefa;
  color: var(--av2-ink);
  box-shadow: 0 2px 8px rgb(35 58 48 / 8%);
  font-size: 12px;
  font-weight: 650;
  line-height: 1.3;
  pointer-events: none;
}
#modal.address-dialog .av2-zone[data-zone="inside"] { background: #edf5e9; color: var(--av2-green); }
#modal.address-dialog .av2-zone[data-zone="outside"] { border-color: #f2bd9f; background: #fff0e7; color: #9b3615; }
#modal.address-dialog .av2-locate {
  position: absolute;
  z-index: 3;
  right: 14px;
  bottom: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  max-width: calc(100% - 28px);
  margin: 0;
  padding: 10px 16px;
  border: 1px solid rgb(29 90 55 / 16%);
  border-radius: 999px;
  background: #fffefa;
  color: var(--av2-green);
  box-shadow: 0 4px 18px rgb(35 58 48 / 18%);
  font-size: 14px;
  font-weight: 650;
  line-height: 1.4;
}
#modal.address-dialog .av2-locate:disabled { opacity: .75; cursor: wait; }
#modal.address-dialog .av2-map-unavailable {
  position: absolute;
  top: 45%;
  right: 24px;
  left: 24px;
  margin: 0;
  color: var(--av2-ink);
  font-size: 14px;
  line-height: 1.5;
  text-align: center;
}
/* Keep provider controls and attribution usable beneath our floating controls. */
#modal.address-dialog .leaflet-top { top: 118px; }
#modal.address-dialog .leaflet-control-zoom a { width: 44px; height: 44px; line-height: 44px; }
#modal.address-dialog .av2-details-step,
#modal.address-dialog .av2-details-actions { display: none; }
#modal.address-dialog.address-step-details .av2-map-step,
#modal.address-dialog.address-step-details .av2-map-actions { display: none; }
#modal.address-dialog.address-step-details .av2-details-step { display: block; }
#modal.address-dialog.address-step-details .av2-details-actions { display: flex; }
#modal.address-dialog .av2-fields { display: grid; gap: 18px; padding: 0 22px 24px; }
#modal.address-dialog .av2-fields label,
#modal.address-dialog .av2-address-type { display: grid; gap: 8px; margin: 0; color: var(--av2-ink); font-size: 13px; font-weight: 600; }
#modal.address-dialog .av2-field-row { display: grid; grid-template-columns: minmax(0,1fr); gap: 18px; }
#modal.address-dialog .av2-city-row { grid-template-columns: minmax(0,1.4fr) minmax(0,1fr); gap: 12px; }
#modal.address-dialog .av2-fields input:not([type="hidden"]) {
  width: 100%;
  min-width: 0;
  min-height: 50px;
  margin: 0;
  padding: 12px 14px;
  border: 1px solid #cbd5c7;
  border-radius: 12px;
  background: #fffefa;
  color: var(--av2-ink);
  box-shadow: none;
  font-size: 16px;
  font-weight: 400;
  line-height: 1.4;
}
#modal.address-dialog input::placeholder { color: #67746a; opacity: 1; }
#modal.address-dialog .av2-tags { display: flex; flex-wrap: wrap; gap: 8px; }
#modal.address-dialog .addr-pill {
  flex: 1;
  padding: 10px 16px;
  border: 1px solid #cbd5c7;
  border-radius: 999px;
  background: #fffefa;
  color: var(--av2-ink);
  box-shadow: none;
  font-size: 14px;
  font-weight: 600;
}
#modal.address-dialog .addr-pill.active { border-color: var(--av2-green); background: var(--av2-green); color: white; }
#modal.address-dialog .av2-action-bar {
  position: sticky;
  z-index: 10;
  bottom: 0;
  display: grid;
  gap: 12px;
  padding: 14px 22px max(16px, env(safe-area-inset-bottom));
  border-top: 1px solid var(--av2-line);
  background: var(--av2-cream);
  box-shadow: 0 -6px 18px rgb(35 58 48 / 4%);
}
#modal.address-dialog .av2-status { margin: 0; color: #58685d; font-size: 13px; line-height: 1.45; }
#modal.address-dialog .av2-status[data-zone="outside"] { color: #9b3615; font-weight: 600; }
#modal.address-dialog .av2-details-actions { align-items: center; gap: 12px; }
#modal.address-dialog .av2-action-bar .primary {
  display: inline-flex;
  flex: 1;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  min-height: 50px;
  margin: 0;
  padding: 12px 16px;
  border: 1px solid var(--av2-green);
  border-radius: 14px;
  background: var(--av2-green);
  color: white;
  box-shadow: none;
  font-size: 15px;
  font-weight: 650;
  line-height: 1.4;
}
#modal.address-dialog .av2-action-bar .primary:hover:not(:disabled) { background: #16462b; }
#modal.address-dialog .av2-action-bar .primary:disabled { border-color: #dde3d9; background: #dde3d9; color: #5b685d; cursor: not-allowed; }
#modal.address-dialog .av2-back {
  flex-shrink: 0;
  padding: 10px 0;
  border: 0;
  background: transparent;
  color: var(--av2-green);
  font-size: 13px;
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 4px;
}
#modal.address-dialog .av2-guest {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 4px 16px;
  margin: 0;
  padding: 0 22px max(8px, env(safe-area-inset-bottom));
  color: #58685d;
  font-size: 12px;
}
#modal.address-dialog .av2-guest button { padding: 10px 4px; border: 0; background: transparent; color: var(--av2-green); font-size: 13px; font-weight: 650; }
#modal.address-dialog :is(.av2-map-step,.av2-details-step) { animation: av2-enter 180ms ease-out both; }
@keyframes av2-enter { from { opacity: 0; transform: translateY(7px); } to { opacity: 1; transform: translateY(0); } }
@media (min-width: 640px) {
  #modal.address-dialog { width: calc(100% - 48px); max-height: 92vh; max-height: 92dvh; margin: auto; border-radius: 26px; }
  #modal.address-dialog .av2-field-row { grid-template-columns: minmax(0,1fr) minmax(0,1fr); }
  #modal.address-dialog .av2-map-frame { margin-inline: 22px; }
  #modal.address-dialog.address-step-details .av2-map-step { display: block; margin-top: 18px; }
  #modal.address-dialog.address-step-details .av2-map-step .av2-heading { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  #modal.address-dialog,
  #modal.address-dialog *,
  #modal.address-dialog *::before,
  #modal.address-dialog *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}

/* Full-screen sheet on phones: fixes the collapsed/clipped dialog the bottom-sheet
   max-height caused when the visual viewport shrank under the keyboard. */
@media (max-width:760px){
  #modal.address-dialog{
    width:100%;max-width:none;height:100vh;height:100dvh;max-height:100vh;max-height:100dvh;
    margin:0;border:0;border-radius:0;
    display:flex;flex-direction:column;overflow:hidden;
  }
  #modal.address-dialog .modal-head{flex:0 0 auto;position:relative;padding-top:calc(10px + env(safe-area-inset-top))}
  #modal.address-dialog .av2-form{flex:1 1 auto;min-height:0;overflow-y:auto;overscroll-behavior:contain;display:block}
  #modal.address-dialog .av2-map-step,
  #modal.address-dialog .av2-details-step{min-height:0}
  #modal.address-dialog .av2-map-frame{height:min(42vh,360px);min-height:200px}
  #modal.address-dialog .av2-map-actions,
  #modal.address-dialog .av2-details-actions{
    position:sticky;bottom:0;z-index:5;background:var(--av2-cream);
    padding-bottom:calc(10px + env(safe-area-inset-bottom));
  }
}

/* hard override: the storefront dialog rules use margin:auto and an !important
   radius, so the phone sheet has to win explicitly. */
@media (max-width:760px){
  #modal.address-dialog{
    inset:0!important;top:0!important;left:0!important;right:0!important;bottom:0!important;
    width:100vw!important;max-width:none!important;
    height:100dvh!important;max-height:100dvh!important;
    margin:0!important;padding:0!important;border:0!important;border-radius:0!important;
    display:flex!important;flex-direction:column!important;overflow:hidden!important;
    transform:none!important;
  }
}

/* some Android WebViews paint fixed headers above a modal dialog */
#modal.address-dialog{z-index:2147483000!important}

/* a closed dialog must never be painted: the forced display above would
   otherwise keep the sheet on screen after it closes */
#modal.address-dialog:not([open]){display:none!important;visibility:hidden!important;pointer-events:none!important}

/* full-screen map: no marketing copy, just the map, the pin and one action */
@media (max-width:760px){
 #modal.address-dialog .av2-progress{display:none!important}
 #modal.address-dialog .av2-heading,
 #modal.address-dialog .av2-status,
 #modal.address-dialog .av2-zone{display:none!important}
 #modal.address-dialog .av2-map-step{padding-bottom:0!important}
 #modal.address-dialog .av2-map-frame{height:calc(100dvh - 150px)!important;min-height:0!important;border-radius:0!important;margin:0!important;box-shadow:none!important}
 #modal.address-dialog .av2-search{top:10px!important;left:10px!important;right:10px!important}
 #modal.address-dialog .av2-locate{bottom:96px!important;right:14px!important;min-height:46px!important;padding:0 18px!important;border-radius:999px!important;box-shadow:0 12px 28px rgb(31 58 43 / 22%)!important}
 #modal.address-dialog .av2-map-actions{padding:10px 12px calc(12px + env(safe-area-inset-bottom))!important;background:rgb(251 248 241 / 96%)!important;backdrop-filter:blur(14px)!important}
 #modal.address-dialog .av2-map-actions button{height:52px!important;border-radius:16px!important;font-size:15px!important;font-weight:800!important}
}
/* a bigger, more legible pin */
.av2-pin,.leaflet-marker-icon.av2-pin{filter:drop-shadow(0 8px 14px rgb(31 58 43 / 35%))}

@media (max-width:760px){
 #modal.address-dialog .av2-map-frame{height:calc(100dvh - 148px)!important;max-height:none!important;min-height:0!important}
 #modal.address-dialog .av2-map-step{height:100%!important}
}

/* phones: the address sheet is a fixed screen - map fills it, nothing scrolls away */
@media (max-width:760px){
 #modal.address-dialog{overflow:hidden!important}
 #modal.address-dialog .av2-form{
  display:flex!important;flex-direction:column!important;
  height:calc(100dvh - 62px)!important;max-height:calc(100dvh - 62px)!important;
  overflow:hidden!important;position:relative!important;
 }
 #modal.address-dialog .av2-map-step{
  position:relative!important;flex:1 1 auto!important;min-height:0!important;
  display:flex!important;flex-direction:column!important;padding:0!important;
 }
 #modal.address-dialog .av2-map-frame{
  position:absolute!important;inset:0!important;
  height:auto!important;max-height:none!important;min-height:0!important;
  margin:0!important;border-radius:0!important;
 }
 #modal.address-dialog .av2-search{
  position:absolute!important;top:10px!important;left:10px!important;right:10px!important;z-index:6!important;
 }
 #modal.address-dialog .av2-locate{
  position:absolute!important;right:14px!important;bottom:88px!important;z-index:6!important;
 }
 #modal.address-dialog .av2-map-actions{
  position:absolute!important;left:0!important;right:0!important;bottom:0!important;z-index:7!important;margin:0!important;
 }
 #modal.address-dialog .av2-zone{position:absolute!important;left:12px!important;bottom:88px!important;z-index:6!important}
}
