/* ==========================================================================
   Calculateur de Surface (France) - Styles specifiques a l'outil
   ========================================================================== */

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

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

/* --------------------------------------------------------------------------
   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;
}

/* --------------------------------------------------------------------------
   Encadre de resultats
   -------------------------------------------------------------------------- */
.results-box {
  background-color: var(--glass);
  border-radius: var(--radius-lg);
  padding: 14px;
  border: 1px solid var(--border);
  min-height: 60px;
  font-size: 13px;
  line-height: 1.6;
}

.results-box:empty::before {
  content: "Dessinez une forme sur la carte pour calculer sa surface...";
  color: var(--text-muted);
  font-style: italic;
}

.results-box strong {
  color: var(--primary);
}

/* --------------------------------------------------------------------------
   Affichage des resultats de surface
   -------------------------------------------------------------------------- */
.area-result {
  margin-bottom: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.area-result:last-child {
  margin-bottom: 0;
  padding-bottom: 0;
  border-bottom: none;
}

.area-result .unit-label {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 2px;
}

.area-result .unit-value {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
}

.area-result.primary .unit-value {
  font-size: 24px;
  color: var(--primary);
}

/* --------------------------------------------------------------------------
   Perimetre
   -------------------------------------------------------------------------- */
.perimeter-result {
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.perimeter-result .unit-label {
  font-size: 12px;
  color: var(--text-muted);
}

.perimeter-result .unit-value {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}

/* --------------------------------------------------------------------------
   Bascule de vue (carte / photo aerienne)
   -------------------------------------------------------------------------- */
.unit-toggle {
  display: flex;
  gap: 4px;
  margin-top: 8px;
}

.unit-toggle button {
  flex: 1;
  padding: 8px 12px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.unit-toggle button:first-child {
  border-radius: var(--radius-lg) 0 0 var(--radius-lg);
}

.unit-toggle button:last-child {
  border-radius: 0 var(--radius-lg) var(--radius-lg) 0;
}

.unit-toggle button.active {
  background: var(--primary);
  border-color: var(--primary);
  color: white;
}

.unit-toggle button:hover:not(.active) {
  background: var(--hover-bg);
}

/* --------------------------------------------------------------------------
   Calque des parcelles cadastrales (case a cocher)
   -------------------------------------------------------------------------- */
.overlay-controls {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 8px;
}

.overlay-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text);
  cursor: pointer;
}

.overlay-toggle input[type="checkbox"] {
  accent-color: var(--primary);
  width: 16px;
  height: 16px;
  cursor: pointer;
}

/* --------------------------------------------------------------------------
   Liste des formes
   -------------------------------------------------------------------------- */
.shape-list {
  margin-top: 12px;
}

.shape-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  margin-bottom: 8px;
}

.shape-item:last-child {
  margin-bottom: 0;
}

.shape-item .shape-info {
  display: flex;
  align-items: center;
  gap: 10px;
}

.shape-item .shape-icon {
  font-size: 18px;
}

.shape-item .shape-details {
  font-size: 13px;
}

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

.shape-item .shape-area {
  color: var(--text-muted);
  font-size: 12px;
}

.shape-item .btn-delete {
  padding: 4px 8px;
  font-size: 12px;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: all 0.2s ease;
}

.shape-item .btn-delete:hover {
  background: var(--danger);
  border-color: var(--danger);
  color: white;
}

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

/* --------------------------------------------------------------------------
   Surcharges Leaflet Draw
   -------------------------------------------------------------------------- */
.leaflet-draw-toolbar a {
  background-color: var(--card) !important;
  border-color: var(--border) !important;
  color: var(--text) !important;
}

.leaflet-draw-toolbar a:hover {
  background-color: var(--hover-bg) !important;
}

.leaflet-draw-actions {
  background-color: var(--card) !important;
  border-color: var(--border) !important;
}

.leaflet-draw-actions a {
  background-color: var(--card) !important;
  color: var(--text) !important;
}

.leaflet-draw-actions a:hover {
  background-color: var(--hover-bg) !important;
}

/* --------------------------------------------------------------------------
   Bouton FAB (menu 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-reverse;
    height: auto;
  }

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

  .map-container {
    height: 45vh;
    min-height: 280px;
    max-height: 350px;
    flex: none;
    position: sticky;
    top: 0;
    z-index: 10;
  }

  .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;
  }

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

/* Surcharges plein ecran mobile */
.map-container.map-fullscreen {
  max-height: 100vh !important;
  height: 100vh !important;
}
.map-container.map-fullscreen #map {
  height: 100% !important;
  max-height: none !important;
}

/* Deplace le bouton plein ecran pour eviter le chevauchement avec les
   controles de dessin */
.map-fullscreen-btn {
  right: auto;
  left: 50px;
}
