/* css/address-picker.css — peça única de endereço (cardápio e checkout). Visual do "Taxa e tempo de entrega". */
.ap { position: relative; text-align: left; }
.ap [hidden] { display: none !important; }

.ap-geo-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 14px;
  border-radius: 10px;
  border: 1px solid #e2e8f0;
  background: #f8fafc;
  font: inherit;
  font-size: 0.86rem;
  font-weight: 500;
  color: #334155;
  cursor: pointer;
  transition: all 0.18s ease;
}
.ap-geo-btn svg { width: 16px; height: 16px; color: #475569; flex-shrink: 0; }
.ap-geo-btn:hover { background: #f1f5f9; border-color: #cbd5e1; }
.ap-geo-btn.is-loading { opacity: 0.7; pointer-events: none; }
.ap-geo-btn-small { margin-bottom: 8px; background: #ffffff; }

.ap-divider {
  display: flex;
  align-items: center;
  margin: 14px 0 12px;
  color: #94a3b8;
  font-size: 0.75rem;
}
.ap-divider::before,
.ap-divider::after { content: ''; flex: 1; border-bottom: 1px solid #e2e8f0; }
.ap-divider span { padding: 0 10px; }

.ap-search-box { position: relative; }

.ap-field { display: grid; gap: 5px; margin: 0 0 10px; font-weight: normal; }
.ap-field > span { font-size: 0.81rem; font-weight: 500; color: #475569; letter-spacing: -0.01em; }
.ap-search-box .ap-field { margin-bottom: 0; }

.ap-input-wrap { position: relative; display: flex; align-items: center; margin-top: 3px; }
.ap-search-ico {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  width: 17px;
  height: 17px;
  color: #94a3b8;
  pointer-events: none;
  z-index: 2;
}

.ap .ap-input {
  width: 100%;
  height: 42px;
  min-height: 42px;
  padding: 0 12px;
  border-radius: 9px;
  border: 1px solid #cbd5e1;
  font: inherit;
  font-size: 16px; /* 16px evita o zoom automático do iPhone ao tocar no campo */
  font-weight: 400;
  color: #0f172a;
  background: #ffffff;
  outline: none;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.02);
  transition: border-color 0.2s, box-shadow 0.2s;
  box-sizing: border-box;
}
.ap .ap-input-search { height: 44px; min-height: 44px; padding: 0 38px 0 42px; border-radius: 10px; }
.ap .ap-input:focus { border-color: #0f172a; box-shadow: 0 0 0 3px rgba(15, 23, 42, 0.07); }
.ap .ap-input::placeholder { color: #94a3b8; font-size: 0.84rem; opacity: 1; }
.ap .ap-input.ap-input-error {
  border-color: #ef4444;
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.15);
  background: #fffafa;
}

.ap-spinner {
  position: absolute;
  right: 12px;
  top: 0;
  bottom: 0;
  margin: auto 0;
  width: 16px;
  height: 16px;
  border: 2px solid #e2e8f0;
  border-top-color: #0f172a;
  border-radius: 50%;
  animation: apSpin 0.7s linear infinite;
}
@keyframes apSpin { to { transform: rotate(360deg); } }

/* A lista empurra o conteúdo para baixo (não flutua): nunca fica cortada dentro da janela */
.ap-suggestions {
  position: relative;
  margin-top: 6px;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  box-shadow: 0 10px 25px -4px rgba(0, 0, 0, 0.12);
  z-index: 9999;
  max-height: 260px;
  overflow-y: auto;
}
.ap-sugg-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 14px;
  border-bottom: 1px solid #f1f5f9;
  cursor: pointer;
  transition: background 0.15s;
}
.ap-sugg-item:last-child { border-bottom: none; }
.ap-sugg-item:hover,
.ap-sugg-item:focus { background: #f1f5f9; outline: none; }
.ap-sugg-item > svg { margin-top: 2px; width: 17px; height: 17px; color: #64748b; flex-shrink: 0; }
.ap-sugg-title { font-weight: 600; font-size: 0.88rem; color: #1e293b; line-height: 1.3; }
.ap-sugg-sub { font-size: 0.78rem; color: #64748b; margin-top: 2px; line-height: 1.3; }
.ap-sugg-manual { background: #f8fafc; }
.ap-sugg-manual .ap-sugg-title { color: #2563eb; }
.ap-sugg-empty { padding: 10px 14px; color: #64748b; font-size: 0.86rem; text-align: center; }

.ap-link-wrap { margin: 10px 0 2px; text-align: center; }
.ap-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: none;
  background: none;
  color: #64748b;
  font: inherit;
  font-size: 0.82rem;
  cursor: pointer;
  padding: 5px 10px;
  border-radius: 6px;
  transition: all 0.15s;
}
.ap-link svg { width: 15px; height: 15px; }
.ap-link:hover { color: #0f172a; background: #f1f5f9; }

.ap-selected-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 12px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  margin-bottom: 10px;
  font-size: 0.85rem;
  font-weight: 500;
  color: #1e293b;
}
.ap-selected-bar svg { color: #0f172a; width: 15px; height: 15px; flex-shrink: 0; }
.ap-edit-btn {
  margin-left: auto;
  border: none;
  background: none;
  color: #2563eb;
  font: inherit;
  font-weight: 500;
  font-size: 0.8rem;
  cursor: pointer;
  padding: 3px 8px;
  border-radius: 6px;
  flex-shrink: 0;
}
.ap-edit-btn:hover { background: #eff6ff; text-decoration: underline; }


.ap-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 10px; }

/* isolation/z-index: o mapa (Leaflet usa z-index 400+) fica "dentro" da caixa e
   nunca passa por cima dos botões fixos da tela quando a página rola */
.ap-map-box {
  position: relative;
  z-index: 0;
  isolation: isolate;
  margin: 0 0 12px;
  padding: 10px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
}
.ap-map-title { margin: 0 0 8px; font-size: 0.86rem; font-weight: 600; color: #1e293b; }
.ap-map {
  position: relative;
  z-index: 0;
  height: 240px;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid #e2e8f0;
  background: #eef2f7;
}
/* Crédito do mapa (obrigatório pela licença do OpenStreetMap): bem pequeno e sem clique,
   para o cliente não tocar sem querer */
.ap .leaflet-control-attribution {
  font-size: 5px !important;
  line-height: 1.3;
  padding: 0 3px !important;
  margin: 0 !important;
  background: rgba(255, 255, 255, 0.6) !important;
  color: #64748b;
  pointer-events: none;
}
.ap .leaflet-control-attribution a { color: inherit; text-decoration: none; pointer-events: none; }
.ap .leaflet-control-attribution svg { width: 6px !important; height: 4px !important; }
/* Resultado do pino, logo abaixo do mapa */
.ap-pin-status {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 8px 0;
  padding: 8px 10px;
  border-radius: 8px;
  font-size: 0.82rem;
  line-height: 1.35;
  animation: apFadeIn 0.2s ease;
}
.ap-pin-status svg { width: 16px; height: 16px; flex-shrink: 0; }
.ap-pin-status.is-matched { background: #f0fdf4; border: 1px solid #bbf7d0; color: #166534; }
.ap-pin-status.is-outside { background: #fef2f2; border: 1px solid #fecaca; color: #991b1b; }
.ap-map-hint { margin: 8px 0; font-size: 0.8rem; color: #64748b; text-align: center; }
.ap-map-error { margin: 0; padding: 16px; font-size: 0.82rem; color: #64748b; }
.ap-geo-btn-small { margin: 0; }
.ap-back-wrap { text-align: center; }
.ap-back { margin: 2px auto 0; }

.ap-result {
  margin-top: 14px;
  padding: 14px 16px;
  border-radius: 12px;
  font-size: 0.92rem;
  line-height: 1.4;
  animation: apFadeIn 0.25s ease;
}
@keyframes apFadeIn { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: translateY(0); } }
.ap-result.is-matched { background: #f0fdf4; border: 1px solid #bbf7d0; color: #166534; }
.ap-result.is-warning { background: #fffbeb; border: 1px solid #fde68a; color: #92400e; }
.ap-result.is-outside { background: #fef2f2; border: 1px solid #fecaca; color: #991b1b; }
.ap-result-title { font-weight: 700; display: flex; align-items: center; gap: 6px; }
.ap-result-title svg { flex-shrink: 0; }
.ap-result-text { margin: 6px 0 0; font-size: 0.85rem; opacity: 0.95; }
.ap-result-grid {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px dashed rgba(0, 0, 0, 0.1);
}
.ap-result-grid > div { display: flex; flex-direction: column; }
.ap-result-grid span { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.5px; opacity: 0.8; }
.ap-result-grid strong { font-size: 1.05rem; }
