/* ==========================================================================
   Altitude (France) - styles propres à l'outil

   Repris de ca-elevation-finder.css (même forme d'outil : recherche, clic sur
   la carte, géolocalisation, boîte de résultat), sans le sélecteur m/ft (unité
   métrique uniquement) et avec le sélecteur de désambiguïsation de
   fr-distance-between.css. La hauteur plafonnée est portée par .tool-sidebar
   (min-height: 0), pas par .tool-container - voir elevation-finder-au.css.
   ========================================================================== */

.tool-container {
  background-color: var(--bg);
}

.tool-sidebar {
  width: 380px;
  background-color: var(--card);
  border-right: 1px solid var(--border);
  box-shadow: var(--shadow);
  max-height: 626px;
  min-height: 0;
  overflow-y: auto;
}

.sidebar-content {
  padding: 20px;
}

.sidebar-content label {
  display: block;
  font-size: 13px;
  margin-bottom: 8px;
  margin-top: 12px;
  color: var(--text-muted);
  font-weight: 600;
}

.sidebar-content label:first-of-type {
  margin-top: 0;
}

.tool-section {
  margin-bottom: 28px;
}

.tool-section h3 {
  font-size: 15px;
  margin-bottom: 16px;
  color: var(--text);
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}

.input-section {
  background: linear-gradient(135deg, var(--bg-secondary) 0%, var(--card) 100%);
  margin: -20px -20px 0 -20px;
  padding: 20px;
  border-radius: 12px 12px 0 0;
}

.button-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 16px;
}

.btn-full {
  width: 100%;
  justify-content: center;
}

.btn.active {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

.click-hint {
  display: none;
  font-size: 0.82rem;
  color: var(--primary);
  background: var(--glass);
  border: 1px dashed var(--primary);
  border-radius: var(--radius);
  padding: 8px 10px;
  margin-top: 10px;
}

#map.click-armed {
  cursor: crosshair;
}

/* --------------------------------------------------------------------------
   Result display
   -------------------------------------------------------------------------- */
.result-box {
  background: var(--glass);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px;
  text-align: center;
}

.result-label {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 8px;
  font-weight: 600;
}

.result-elevation {
  font-size: 2.4rem;
  font-weight: 800;
  color: var(--primary);
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
}

.result-elevation.is-empty {
  color: var(--text-muted);
}

.result-elevation .unit {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-left: 4px;
}

.result-sub {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 6px;
}

.coverage-note {
  display: none;
  font-size: 0.82rem;
  color: var(--text-muted);
  background: var(--bg-secondary);
  border-radius: var(--radius);
  padding: 10px 12px;
  margin-top: 12px;
  line-height: 1.5;
  text-align: left;
}

.resolution-note {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 10px;
  line-height: 1.5;
  text-align: left;
}

/* --------------------------------------------------------------------------
   About / attribution + related tools
   -------------------------------------------------------------------------- */
.tool-info {
  background-color: var(--glass);
  border-radius: var(--radius-lg);
  padding: 14px;
  border: 1px solid var(--border);
}

.tool-info p {
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.5;
  margin: 0 0 8px;
}

.tool-info p:last-child {
  margin-bottom: 0;
}

.related-links {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.related-link {
  display: block;
  padding: 12px;
  background: var(--bg-secondary);
  border-radius: var(--radius-lg);
  text-decoration: none;
}

.related-link strong {
  display: block;
  color: var(--text);
  font-size: 13px;
  margin-bottom: 2px;
}

.related-link span {
  color: var(--text-muted);
  font-size: 12px;
}

/* --------------------------------------------------------------------------
   Map container + mobile FAB
   -------------------------------------------------------------------------- */
.map-container {
  position: relative;
  overflow: hidden;
  height: 626px;
  align-self: start;
}

.map {
  width: 100%;
  height: 100%;
  min-height: 500px;
}

#map .leaflet-container {
  width: 100% !important;
  height: 100% !important;
}

.fab {
  display: none;
  width: 56px;
  height: 56px;
  background-color: var(--primary);
  color: white;
  border: none;
  border-radius: 50%;
  font-size: 24px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
  cursor: pointer;
  z-index: 9999;
}

/* --------------------------------------------------------------------------
   Responsive
   -------------------------------------------------------------------------- */
@media (max-width: 900px) {
  .tool-sidebar {
    width: 100%;
    border-right: none;
    border-bottom: 1px solid var(--border);
    max-height: none;
    overflow-y: visible;
  }

  .tool-sidebar.collapsed {
    max-height: 0;
    overflow: hidden;
  }

  .map-container {
    height: 400px;
  }

  .fab {
    display: flex;
    align-items: center;
    justify-content: center;
    position: absolute;
    top: 12px;
    right: 12px;
    z-index: 1000;
  }

  .result-elevation {
    font-size: 1.8rem;
  }
}

@media (max-width: 600px) {
  .input-section {
    margin: -16px -16px 0 -16px;
    padding: 16px;
  }
}

.field-status {
  margin-top: 6px;
  font-size: 13px;
}

.field-error {
  color: #dc2626;
  margin: 0;
}

/* Desambiguisation - repris de ca-distance-between.css tel quel */
.ambiguous-picker p {
  color: var(--text-muted);
  font-size: 13px;
  margin: 0 0 6px;
}

.ambiguous-picker ul {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.candidate-btn {
  width: 100%;
  text-align: left;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--text);
  font-size: 13px;
  cursor: pointer;
}

.candidate-btn:hover {
  background: var(--hover-bg);
}

/* Meme famille visuelle que .result-group-expander sur
   fr-nearest-postcodes.css - "il y a plus a voir", cliquable. */
.candidate-expand {
  display: block;
  width: 100%;
  margin-top: 6px;
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 600;
  color: #92400e;
  background: #fef3c7;
  border: 1px dashed #d97706;
  border-radius: var(--radius);
  cursor: pointer;
  text-align: center;
}

.candidate-expand:hover {
  background: #fde68a;
}

html[data-theme='dark'] .candidate-expand {
  background: rgba(217, 119, 6, 0.15);
  color: #fbbf24;
  border-color: #d97706;
}

.precision-hint {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 400;
}

/* Result panel */
.pair-summary {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.pair-summary-item {
  font-size: 0.9rem;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
}

.pair-letter {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  flex-shrink: 0;
}

.pair-letter.pair-a {
  background: #22c55e;
}

.pair-letter.pair-b {
  background: #ef4444;
}

#resultPanel h3 {
  margin: 0 0 6px;
  color: var(--text);
  font-size: 1.3rem;
}

#resultPanel p {
  margin: 0 0 8px;
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.5;
}

.bearing-line {
  font-size: 0.85rem !important;
  color: var(--text-muted);
}

.pair-failed {
  font-size: 0.9rem;
  color: #dc2626;
  background: rgba(220, 38, 38, 0.08);
  border: 1px solid rgba(220, 38, 38, 0.3);
  border-radius: var(--radius);
  padding: 8px 10px;
  margin: 0 0 8px;
}

.tool-info {
  background-color: var(--glass);
  border-radius: var(--radius-lg);
  padding: 14px;
  border: 1px solid var(--border);
}

.tool-item {
  font-size: 13px;
  color: var(--text);
  padding: 6px 0;
}

.button-row {
  display: flex;
  gap: 8px;
  margin-top: 16px;
}

.button-row .btn {
  flex: 1;
}

.btn-full {
  width: 100%;
  justify-content: center;
}

.tool-distinction {
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.5;
}

.tool-distinction a {
  color: var(--primary);
}

@media (max-width: 600px) {
  .input-section {
    margin: -16px -16px 0 -16px;
    padding: 16px;
  }
}

/* Map legend: same visual language as the other French tools' own. */
.np-map-legend {
  background: var(--card);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 8px 10px;
  font-size: 12px;
  line-height: 1.4;
  max-width: 240px;
}

.np-legend-row {
  display: flex;
  align-items: center;
  gap: 7px;
  margin: 3px 0;
}

.np-legend-dot {
  flex-shrink: 0;
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  box-sizing: border-box;
  border: 2px solid;
}

.np-legend-note {
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 11px;
  line-height: 1.4;
}
