/* ── Reset ── */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

/* White background fills the Safari top bar area on iPhone */
html {
  background-color: #ffffff;
}

/* ── Base ── */
body {
  font-family: 'Geist', sans-serif;
  background: #7c7c7c;
}

/* ── Map fills the whole screen ── */
#map {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  z-index: 0;
}

/* ── Floating panel — bottom right (desktop) ── */
#panel {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 1000;
  width: 296px;
  background: #ffffff;
  border-radius: 24px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 24px;
  box-shadow:
    0px 10px 15px 0px rgba(0, 0, 0, 0.10),
    0px 4px  6px  0px rgba(0, 0, 0, 0.10);
}

/* ── Row 1: Controls ── */
#panel-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* Round icon buttons */
.icon-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 8px;
  background: #f5f5f5;
  border: none;
  border-radius: 9999px;
  cursor: pointer;
  color: #0a0a0a;
  transition: background 0.15s;
}

.icon-btn:hover {
  background: #e5e5e5;
}

/* ── Mode toggle: Snap / Manual ── */
#mode-toggle {
  display: flex;
  background: #f5f5f5;
  border-radius: 9999px;
  padding: 3px;
  gap: 2px;
}

.mode-btn {
  font-family: 'Geist', sans-serif;
  font-size: 12px;
  font-weight: 500;
  padding: 4px 10px;
  border: none;
  border-radius: 9999px;
  cursor: pointer;
  background: transparent;
  color: #737373;
  transition: background 0.15s, color 0.15s;
}

/* Active state — white pill with dark text */
.mode-btn.active {
  background: #ffffff;
  color: #0a0a0a;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

/* ── Row 2: Distance (desktop — stacked) ── */
#panel-distance {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  color: #0a0a0a;
  text-align: center;
}

#distance-display {
  font-size: 48px;
  font-weight: 600;
  line-height: 48px;
  letter-spacing: -1.5px;
}

.unit {
  font-size: 20px;
  font-weight: 600;
  line-height: 24px;
}

/* ── Row 3: Elevation ── */
#panel-elevation {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: center;
}

.elev-item {
  display: flex;
  align-items: center;
  gap: 4px;
  color: #0a0a0a;
}

.elev-item span:not(.elev-unit) {
  font-size: 24px;
  font-weight: 600;
  line-height: 28.8px;
  letter-spacing: -1px;
}

.elev-unit {
  font-size: 20px;
  font-weight: 600;
  line-height: 24px;
}

/* ── Row 4: CTA ── */
#panel-cta {
  display: flex;
  padding: 12px;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  align-self: stretch;
}

#btn-export {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  min-height: 36px;
  padding: 8px 16px;
  background: #171717;
  color: #fafafa;
  font-family: 'Geist', sans-serif;
  font-size: 14px;
  font-weight: 500;
  line-height: 20px;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s;
}

#btn-export:hover {
  background: #2a2a2a;
}

#btn-export:disabled {
  background: #d4d4d4;
  color: #a3a3a3;
  cursor: not-allowed;
}

#btn-export:disabled svg {
  opacity: 0.4;
}

#link-message {
  font-size: 12px;
  font-weight: 500;
  line-height: 16px;
  color: #0a0a0a;
  text-decoration: none;
  padding: 4px 8px;
  border-radius: 4px;
  transition: opacity 0.15s;
}

#link-message:hover {
  opacity: 0.6;
}


/* ─────────────────────────────────────────
   MOBILE — screens narrower than 768px
───────────────────────────────────────── */
@media (max-width: 768px) {

  #panel {
    left: 0;
    right: 0;
    bottom: 0;
    width: auto;
    gap: 12px;
    border-radius: 24px 24px 0 0;
    /* Push content up above the iPhone home indicator */
    padding-bottom: calc(12px + env(safe-area-inset-bottom));
  }

  #panel-distance {
    flex-direction: row;
    justify-content: center;
    align-items: baseline;
    gap: 8px;
  }

  #distance-display {
    font-size: 30px;
    line-height: 30px;
    letter-spacing: -1px;
  }

  .unit {
    font-size: 20px;
  }

  .icon-btn {
    width: 44px;
    height: 44px;
  }

  #btn-export {
    min-height: 44px;
  }
}

/* ── Leaflet zoom controls (+/-) — styled to match Figma ── */

/* Hide Leaflet's default outer container border/shadow */
.leaflet-control-zoom {
  border: none !important;
  box-shadow: none !important;
  border-radius: 8px !important;
  overflow: hidden;
  display: inline-flex !important;
}

/* Each button — + and - */
.leaflet-control-zoom-in,
.leaflet-control-zoom-out {
  width: 36px !important;
  height: 36px !important;
  line-height: 36px !important;
  font-size: 16px !important;
  font-family: 'Geist', sans-serif !important;
  font-weight: 400 !important;
  color: #404040 !important;
  background: #ffffff !important;
  border: 1px solid #e5e5e5 !important;
  border-radius: 0 !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  text-decoration: none !important;
  transition: background 0.15s !important;
}

/* Left button (+) gets left-rounded corners */
.leaflet-control-zoom-in {
  border-radius: 8px 0 0 8px !important;
}

/* Right button (-) gets right-rounded corners */
.leaflet-control-zoom-out {
  border-radius: 0 8px 8px 0 !important;
  border-left: none !important;
}

.leaflet-control-zoom-in:hover,
.leaflet-control-zoom-out:hover {
  background: #f5f5f5 !important;
  color: #0a0a0a !important;
}

/* ── iPhone safe area — prevents content hiding behind home indicator ── */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
  #panel {
    padding-bottom: calc(12px + env(safe-area-inset-bottom));
  }
}