:root {
  --bg: #f5f7fa;
  --card: #ffffff;
  --text: #1a1a1a;
  --muted: #5f6368;
  --primary: #1a73e8;
  --primary-strong: #1557b0;
  --submit-fill: #ffffff;
  --submit-fill-hover: #e8f0fe;
  --submit-border: #c6d7eb;
  --submit-border-hover: #7eb3f5;
  --green: #0f9d58;
  --warn-bg: #fff8e1;
  --warn-border: #ffc107;
  --error-bg: #fdecea;
  --error-border: #ea4335;
  --border: #dadce0;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100%;
  overflow-x: hidden;
}

main {
  max-width: 640px;
  margin: 0 auto;
  padding: 1rem 1rem 1.25rem;
}

h1.app-title {
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 0 0.75rem;
  line-height: 1.2;
}

.app-logo {
  display: block;
  height: calc(28px * 0.65);
  width: auto;
  max-width: min(130px, 36vw);
}

.address-input-wrap {
  position: relative;
  display: block;
}

#address-input {
  width: 100%;
  min-height: 48px;
  font-size: 16px;
  padding: 0.65rem 0.75rem;
  padding-right: 3rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--card);
}

#address-input:focus {
  outline: 2px solid var(--primary);
  outline-offset: 1px;
}

.address-submit-btn {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  width: 34px;
  height: 34px;
  padding: 0;
  border: 1.5px solid var(--submit-border);
  border-radius: 50%;
  background: var(--submit-fill);
  color: var(--primary-strong);
  box-shadow: 0 1px 2px rgba(32, 33, 36, 0.06);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition:
    background 0.15s ease,
    border-color 0.15s ease,
    color 0.15s ease,
    box-shadow 0.15s ease;
}

.address-submit-btn:hover:not(:disabled) {
  background: var(--submit-fill-hover);
  border-color: var(--submit-border-hover);
  color: var(--primary);
  box-shadow: 0 1px 3px rgba(26, 115, 232, 0.18);
}

.address-submit-btn:active:not(:disabled) {
  background: #dbe8fd;
  box-shadow: 0 0 0 1px rgba(26, 115, 232, 0.25);
}

.address-submit-btn:disabled {
  background: #f8f9fa;
  border-color: var(--border);
  color: #9aa0a6;
  box-shadow: none;
  cursor: not-allowed;
}

.address-submit-btn.is-listening {
  background: #fdecea;
  border-color: #ea4335;
  color: #ea4335;
  animation: pulse-listening 1.5s ease-in-out infinite;
}

@keyframes pulse-listening {
  0%, 100% {
    box-shadow: 0 0 0 0 rgba(234, 67, 53, 0.35);
  }
  50% {
    box-shadow: 0 0 0 4px rgba(234, 67, 53, 0.15);
  }
}

.address-submit-btn:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.address-submit-icon {
  display: block;
  margin-top: 0.5px;
}

.autocomplete-wrap {
  position: relative;
}

/* Marketing copy below the address field (hidden when results card is visible) */
.home-hero-copy {
  text-align: center;
  margin-top: 2.75rem;
  padding: 0 0.25rem;
  opacity: 1;
  transition: opacity 0.2s ease;
}

.home-hero-copy.is-dimmed {
  opacity: 0.1;
}

.home-hero-heading {
  margin: 0 0 1rem;
  font-size: clamp(1.25rem, 4.2vw, 1.5rem);
  font-weight: 700;
  line-height: 1.28;
  letter-spacing: -0.02em;
  color: #1f1f1f;
}

.home-hero-body {
  margin: 0 auto;
  max-width: 22.5rem;
  font-size: 0.9375rem;
  font-weight: 400;
  line-height: 1.55;
  color: #6b7280;
}

main:has(#results:not(.hidden)) .home-hero-copy {
  display: none;
}

/* position: fixed so it is never clipped by overflow:hidden on body or a stacking context */
#suggestions {
  list-style: none;
  margin: 0;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--card);
  max-height: 50vh;
  overflow-y: auto;
  display: none;
  position: fixed;
  z-index: 9999;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

#suggestions.is-open {
  display: block;
}

#suggestions li {
  padding: 0.75rem 0.85rem;
  min-height: 48px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  font-size: 16px;
}

#suggestions li:last-child {
  border-bottom: none;
}

#suggestions li:active,
#suggestions li:focus {
  background: #e8f0fe;
}

.banner {
  padding: 0.75rem 1rem;
  border-radius: 8px;
  margin: 1rem 0;
  font-size: 0.95rem;
  line-height: 1.4;
}

.banner.warn {
  background: var(--warn-bg);
  border: 1px solid var(--warn-border);
}

.banner.error {
  background: var(--error-bg);
  border: 1px solid var(--error-border);
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.85rem 1rem;
  margin-top: 1rem;
  overflow: hidden;
}

#smarty-block {
  margin-bottom: 0.35rem;
}

.smarty-address-block {
  margin-bottom: 0.35rem;
}

.smarty-address-block .smarty-line {
  font-weight: 700;
  font-size: 1.05rem;
  margin: 0;
  line-height: 1.28;
  word-break: break-word;
}

.smarty-address-block .smarty-line + .smarty-line {
  margin-top: 0.22rem;
}

.meta-row {
  font-size: 0.9rem;
  color: var(--muted);
  margin: 0;
}

.dpv-line {
  margin-top: 0.25rem;
  line-height: 1.35;
}

/* Full width inside the card (counteract .card horizontal padding) */
#map {
  width: calc(100% + 2rem);
  max-width: none;
  margin-left: -1rem;
  margin-right: -1rem;
  height: 34vh;
  min-height: 180px;
  max-height: 360px;
  margin-top: 0.4rem;
  border-radius: 0;
  border: solid var(--border);
  border-width: 1px 0;
  z-index: 1;
}

.actions {
  margin-top: 0.55rem;
  display: flex;
  flex-direction: column;
  gap: 0;
}

/* Extra space above the button when the map is hidden (delta ≤ 100 ft). */
#map.hidden ~ .actions {
  margin-top: 0.85rem;
}

button.btn {
  width: 100%;
  min-height: 48px;
  font-size: 16px;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  font-weight: 600;
}

button.btn-primary {
  background: var(--green);
  color: #fff;
}

button.btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

button.btn-secondary {
  background: var(--card);
  color: var(--text);
  border: 1px solid var(--border);
}

.hidden {
  display: none !important;
}

/* Leaflet: Smarty = blue teardrop pin; Google = same shape, red + white "G" */
.map-pin-icon {
  border: none;
  background: transparent;
}

.map-pin-wrap {
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.35));
}

.map-google-pin .map-pin-wrap svg text {
  user-select: none;
  pointer-events: none;
}

.map-popup-inner {
  font-family: Arial, Helvetica, sans-serif;
  padding: 10px;
  font-size: 14px;
  line-height: 1.35;
  max-width: 280px;
}

.distance-mid-icon {
  border: none;
  background: transparent;
}

.distance-mid-inner {
  font-weight: bold;
  color: #e53935;
  text-shadow:
    2px 2px 2px #fff,
    -2px -2px 2px #fff,
    2px -2px 2px #fff,
    -2px 2px 2px #fff;
  text-align: center;
  white-space: nowrap;
  font-size: 18px;
  font-family: Arial, Helvetica, sans-serif;
}
