/* ==========================================================================
   Rayon sur Carte (France) - Styles specifiques a l'outil
   ========================================================================== */

.sidebar-content label {
  font-size: 13px;
  margin-bottom: 8px;
  color: var(--text-muted);
}

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

/* --------------------------------------------------------------------------
   Suggestions de recherche
   -------------------------------------------------------------------------- */
.suggestions {
  position: relative;
  background-color: var(--card);
  border: 1px solid var(--border);
  margin-top: 4px;
  max-height: 200px;
  overflow-y: auto;
  border-radius: var(--radius-lg);
  display: none;
  box-shadow: var(--shadow);
}

.suggestions.show {
  display: block;
}

.suggestions .item {
  padding: 12px 14px;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  transition: background-color 0.2s ease;
}

.suggestions .item:last-child {
  border-bottom: none;
}

.suggestions .item:hover {
  background-color: var(--hover-bg);
}

/* --------------------------------------------------------------------------
   Rayon : curseur + champ numerique synchronises
   -------------------------------------------------------------------------- */
.radius-display {
  text-align: center;
  padding: 20px;
  margin: 16px 0;
  background-color: var(--glass);
  border-radius: var(--radius-xl);
  border: 1px solid var(--border);
}

.radius-display span:first-child {
  font-size: 36px;
  font-weight: 700;
  color: var(--text);
}

.radius-display span:last-child {
  font-size: 16px;
  color: var(--text-muted);
  margin-left: 8px;
}

.radius-input-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
}

.radius-input-row input[type="number"] {
  width: 80px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background-color: var(--bg);
  color: var(--text);
  font-size: 14px;
  text-align: center;
}

.radius-max-note {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 6px;
  text-align: center;
}

/* --------------------------------------------------------------------------
   Encadre d'info
   -------------------------------------------------------------------------- */
.tool-info {
  background-color: var(--glass);
  border-radius: var(--radius-lg);
  padding: 14px;
  margin: 12px 0;
  border: 1px solid var(--border);
}

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

/* --------------------------------------------------------------------------
   Groupes de boutons
   -------------------------------------------------------------------------- */
.button-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 12px;
}

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

/* --------------------------------------------------------------------------
   Resume (nombre de communes + population)
   -------------------------------------------------------------------------- */
.commune-summary {
  background-color: var(--glass);
  border-radius: var(--radius-lg);
  padding: 14px;
  margin: 12px 0;
  border: 1px solid var(--border);
  text-align: center;
}

.commune-summary .summary-count {
  font-size: 22px;
  font-weight: 700;
  color: var(--primary);
}

.commune-summary .summary-label {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

.commune-summary .summary-pop {
  margin-top: 8px;
  font-size: 14px;
  color: var(--text);
}

.commune-loading {
  text-align: center;
  padding: 16px;
  color: var(--text-muted);
  font-size: 13px;
}

.commune-skip-warning {
  background-color: rgba(217, 119, 6, 0.12);
  border: 1px solid var(--warning, #d97706);
  border-radius: var(--radius-md);
  color: var(--warning, #d97706);
  font-size: 12px;
  font-weight: 600;
  padding: 8px 10px;
  margin-bottom: 8px;
  text-align: left;
}

/* --------------------------------------------------------------------------
   Liste des communes
   -------------------------------------------------------------------------- */
.commune-list {
  max-height: 340px;
  overflow-y: auto;
  margin-top: 8px;
}

.commune-item {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}

.commune-item:last-child {
  border-bottom: none;
}

.commune-item .commune-name {
  font-weight: 600;
  color: var(--text);
}

.commune-item .commune-partial {
  font-size: 11px;
  font-weight: 600;
  color: var(--warning, #d97706);
  margin-left: 6px;
}

.commune-item .commune-meta {
  color: var(--text-muted);
  font-size: 12px;
  white-space: nowrap;
}

/* --------------------------------------------------------------------------
   Import & export
   -------------------------------------------------------------------------- */
.file-upload-label {
  display: block;
  cursor: pointer;
  margin-bottom: 12px;
}

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

.coordinates-control {
  background: var(--glass) !important;
  backdrop-filter: blur(12px);
  padding: 8px 14px;
  border-radius: 8px;
  box-shadow: var(--shadow);
  font-size: 12px;
  font-family: monospace;
  color: var(--text-muted);
  pointer-events: none;
}

.map-fullscreen-btn {
  right: auto;
  left: 50px;
}

/* --------------------------------------------------------------------------
   FAB mobile
   -------------------------------------------------------------------------- */
.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-container {
    flex-direction: column;
    height: calc(100vh - 250px);
  }

  .tool-sidebar {
    width: 100%;
    max-height: 60vh;
    overflow-y: auto;
    border-right: none;
    border-bottom: 1px solid var(--border);
    transition: max-height 0.3s ease;
  }

  .map-container {
    max-height: calc(100vh - 120px);
    flex: 1;
  }

  .fab {
    display: flex;
    align-items: center;
    justify-content: center;
    position: fixed;
    bottom: 20px;
    right: 20px;
  }
}

@media (max-width: 600px) {
  .sidebar-content {
    padding: 16px;
  }

  .tool-section {
    margin-bottom: 20px;
    padding-bottom: 20px;
  }

  .radius-display span:first-child {
    font-size: 28px;
  }

  .radius-display span:last-child {
    font-size: 14px;
  }

  .map-container {
    max-height: calc(100vh - 120px);
    min-height: 400px;
  }

  .commune-list {
    max-height: 240px;
  }
}
