/* GPX viewer (/gpx-viewer/). Loaded only there. */

:root {
  --gv-line: rgba(12, 59, 46, 0.1);
  --gv-sub: #1B5847;
  --gv-fg: #0C3B2E;
  --gv-tile: #F4F7F3;
}
.dark {
  --gv-line: rgba(255, 255, 255, 0.1);
  --gv-sub: #B0B0B0;
  --gv-fg: #E0E0E0;
  --gv-tile: rgba(255, 255, 255, 0.05);
}

[hidden] { display: none !important; }

/* ---------- Drop zone ---------- */
.drop-zone {
  border: 2px dashed rgba(10, 191, 104, 0.45);
  transition: border-color 150ms ease, background-color 150ms ease;
}
.drop-zone.is-over {
  border-color: #0ABF68;
  background-color: rgba(10, 191, 104, 0.06);
}
.drop-overlay {
  position: fixed;
  inset: 0;
  z-index: 80;
  background: rgba(12, 59, 46, 0.6);
  padding: 24px;
  display: flex;
  pointer-events: none;
}
.drop-overlay-inner {
  flex: 1;
  border: 3px dashed #8FD9B3;
  border-radius: 28px;
  color: #fff;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  text-align: center;
}

/* ---------- Loading / error card ---------- */
.status-card { display: flex; border: 2px solid var(--gv-line); }
.status-card.is-error { border-color: #F0C9C2; }
.dark .status-card.is-error { border-color: rgba(240, 120, 100, 0.4); }
.status-icon {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}
.status-card.is-error .status-icon { background: #FBE9E6; color: #B3261E; }
.status-card.is-loading .status-icon {
  border: 6px solid rgba(10, 191, 104, 0.18);
  border-top-color: #0ABF68;
  animation: gv-spin 0.9s linear infinite;
}
@keyframes gv-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
  .status-card.is-loading .status-icon { animation-duration: 3s; }
}

/* ---------- Map ---------- */
.map-wrap { height: 300px; }
@media (min-width: 640px) { .map-wrap { height: 440px; } }
@media (min-width: 1024px) { .map-wrap { height: 520px; } }
/* mapbox-gl.css loads later and sets .mapboxgl-map { position: relative },
   which would collapse the map to zero height: the id keeps this rule ahead. */
#gpx-map.gpx-map { position: absolute; inset: 0; width: 100%; height: 100%; }
.map-fallback {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 0 24px;
  text-align: center;
  font-weight: 700;
  font-size: 14px;
  color: var(--gv-sub);
  background: var(--gv-tile);
}
.map-fallback button {
  border: 1px solid var(--gv-line);
  background: #fff;
  color: #0C3B2E;
  border-radius: 12px;
  padding: 8px 16px;
  font-weight: 800;
}
.km-marker {
  min-width: 20px;
  height: 20px;
  padding: 0 4px;
  border-radius: 10px;
  background: #fff;
  border: 2px solid #0ABF68;
  color: #0C3B2E;
  font: 800 10px/16px Nunito, sans-serif;
  text-align: center;
  box-sizing: border-box;
  pointer-events: none;
}
.end-marker {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 3px solid #fff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
  box-sizing: border-box;
  pointer-events: none;
}
.end-marker.start { background: #0C3B2E; }
.end-marker.finish { background: #fff; border-color: #0C3B2E; border-radius: 4px; }
.elev-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #0C3B2E;
  border: 3px solid #fff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
  pointer-events: none;
}

/* ---------- Stats ---------- */
.stat-tile {
  background: var(--gv-tile);
  border-radius: 16px;
  padding: 12px 14px;
}
.stat-tile dt { font-size: 12px; font-weight: 700; color: var(--gv-sub); }
.stat-tile dd { margin: 0; font-size: 22px; font-weight: 800; font-variant-numeric: tabular-nums; }
@media (min-width: 640px) { .stat-tile dd { font-size: 24px; } }

.unit-switch {
  display: inline-flex;
  background: var(--gv-tile);
  border-radius: 10px;
  padding: 3px;
}
.unit-btn {
  min-width: 44px;
  padding: 6px 12px;
  border-radius: 8px;
  font-weight: 700;
  font-size: 14px;
  color: var(--gv-sub);
}
.unit-btn[aria-pressed='true'] { background: #0ABF68; color: #fff; font-weight: 800; }
.unit-btn:focus-visible { outline: 2px solid #0ABF68; outline-offset: 1px; }

/* ---------- Elevation chart (markup from js/planner/chart.js) ---------- */
.elev-wrap { position: relative; margin-top: 0.5rem; }
#elevation-chart { display: block; width: 100%; height: 8rem; touch-action: pan-y; }
#elevation-chart:empty { display: none; }
#elevation-chart path.profile { fill: none; stroke: #0ABF68; stroke-width: 2.5; vector-effect: non-scaling-stroke; }
#elevation-chart .profile-fill { fill: rgba(10, 191, 104, 0.15); stroke: none; }
#elevation-chart .grid { stroke: var(--gv-line); stroke-width: 1; vector-effect: non-scaling-stroke; }
#elevation-chart .cursor { stroke: var(--gv-fg); stroke-width: 1; vector-effect: non-scaling-stroke; opacity: 0.5; }
.elev-axis {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--gv-sub);
  font-variant-numeric: tabular-nums;
}
.elev-tip {
  position: absolute;
  top: -0.25rem;
  transform: translate(-50%, -100%);
  background: #0C3B2E;
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 6px;
  white-space: nowrap;
  pointer-events: none;
}

/* ---------- Side actions and details ---------- */
.action-row {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 48px;
  padding: 10px 14px;
  border: 1px solid var(--gv-line);
  border-radius: 14px;
  font-weight: 800;
  font-size: 15px;
  text-align: left;
  color: inherit;
  transition: border-color 150ms ease;
}
.action-row:hover { border-color: #0ABF68; }
.details-list { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 6px 12px; }
.details-list dt { color: var(--gv-sub); }
.details-list dd { margin: 0; font-weight: 700; text-align: right; overflow-wrap: anywhere; }

/* ---------- Article text below the tool ---------- */
.article-text { color: var(--gv-sub); line-height: 1.65; }
.article-text section + section { margin-top: 2.5rem; }
.article-text h2 { font-size: 1.5rem; font-weight: 800; color: var(--gv-fg); margin-bottom: 0.75rem; line-height: 1.25; }
.dark .article-text h2 { color: #fff; }
.article-text p + p { margin-top: 0.75rem; }
.article-text ol, .article-text ul { padding-left: 1.25rem; display: grid; gap: 0.5rem; margin-bottom: 0.75rem; }
.article-text ol { list-style: decimal; }
.article-text ul { list-style: disc; }
.article-text strong { color: var(--gv-fg); }
.dark .article-text strong { color: #fff; }
.article-text a { color: #089b54; font-weight: 700; }
.dark .article-text a { color: #0ABF68; }
.article-text a:hover { text-decoration: underline; }
.faq details { border-bottom: 1px solid var(--gv-line); padding: 0.85rem 0; }
.faq summary { cursor: pointer; font-weight: 800; color: var(--gv-fg); }
.dark .faq summary { color: #fff; }
.faq details p { margin-top: 0.5rem; }

/* ---------- Dialog ---------- */
.app-dialog {
  width: min(30rem, calc(100vw - 32px));
  max-height: calc(100dvh - 4rem);
  border: 0;
  border-radius: 24px;
  padding: 20px 24px 24px;
  background: #fff;
  color: #0C3B2E;
}
.dark .app-dialog { background: #1E1E1E; color: #E0E0E0; }
.app-dialog::backdrop { background: rgba(12, 59, 46, 0.55); }
.icon-close {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--gv-sub);
}
.icon-close:hover { background: var(--gv-tile); }
.dialog-title { font-size: 1.4rem; font-weight: 800; line-height: 1.2; }
.dialog-text { margin-top: 0.5rem; font-size: 15px; line-height: 1.55; color: var(--gv-sub); }
.consent-list { margin-top: 0.75rem; display: grid; gap: 6px; font-size: 14px; }
.consent-list li { display: flex; align-items: center; gap: 8px; }
.choice {
  margin-top: 12px;
  display: flex;
  gap: 14px;
  width: 100%;
  text-align: left;
  padding: 16px;
  border-radius: 18px;
  border: 1px solid var(--gv-line);
  color: inherit;
}
.choice > span { display: grid; gap: 3px; }
.choice strong { font-size: 16px; }
.choice span span { font-size: 13px; line-height: 1.45; color: var(--gv-sub); }
.choice em { font-style: normal; font-size: 12px; font-weight: 800; color: #089b54; }
.choice-primary { border: 2px solid #0ABF68; background: rgba(10, 191, 104, 0.1); }
.choice > svg { color: #089b54; }
.qr-box { width: 180px; height: 180px; flex-shrink: 0; background: #fff; border-radius: 12px; padding: 6px; }
.qr-box svg { width: 100%; height: 100%; }
.dialog-steps { list-style: decimal; padding-left: 1.2rem; display: grid; gap: 8px; font-size: 14px; line-height: 1.5; color: var(--gv-sub); }
.link-row {
  margin-top: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--gv-tile);
  border-radius: 12px;
  padding: 6px 6px 6px 14px;
  font-weight: 700;
}
.link-row a { flex: 1; min-width: 0; color: inherit; }
.link-row button {
  border: 1px solid var(--gv-line);
  background: #fff;
  color: #0C3B2E;
  border-radius: 10px;
  padding: 8px 14px;
  font-weight: 800;
  font-size: 14px;
}

.gpx-toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  z-index: 90;
  max-width: calc(100vw - 32px);
  background: #0C3B2E;
  color: #fff;
  font-weight: 700;
  font-size: 14px;
  padding: 10px 16px;
  border-radius: 12px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
}
