/* =============================================================
   BASE STYLES
   ============================================================= */
body {
  margin: 0;
  padding: 0;
  font-family: Arial, sans-serif;
}

/* =============================================================
   CURSEURS PERSONNALISÉS - DÉSACTIVÉ
   ============================================================= */

#map {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 100%;
  transition: clip-path 0.1s ease-out;
  z-index: 1;
}


/* Carte de comparaison - doit être au-dessus mais sans bloquer les événements */
#mapComparison {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 100%;
  z-index: 2;
  pointer-events: none; /* Laisser passer tous les événements souris */
}

/* =============================================================
   OVERLAY DE CHARGEMENT
   ============================================================= */
#loading-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: #0095E9;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  transition: opacity 0.5s ease;
}

#loading-overlay.hidden {
  opacity: 0;
  pointer-events: none;
}

.loading-image-container {
  position: relative;
  max-width: 1000px;
  width: 90%;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.loading-image {
  width: 100%;
  height: auto;
  border-radius: 12px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

.loading-bar-container {
  position: relative;
  width: 100%;
  height: 8px;
  background: rgba(0, 0, 0, 0.3);
  border-radius: 0 0 8px 8px;
  overflow: hidden;
  margin-top: -8px;
}

.loading-bar {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #4CAF50, #8BC34A);
  border-radius: 0 0 8px 8px;
  transition: width 0.3s ease-out;
  box-shadow: 0 0 10px rgba(76, 175, 80, 0.5);
}

/* Anciens styles pour compatibilité */
.loading-text {
  color: white;
  font-size: 18px;
  font-weight: 500;
  margin-top: 20px;
}

.loading-spinner {
  width: 50px;
  height: 50px;
  border: 4px solid rgba(255, 255, 255, 0.3);
  border-top: 4px solid white;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

/* =============================================================
   MENU CONTEXTUEL
   ============================================================= */
.context-menu {
  position: absolute;
  background: white;
  border-radius: 8px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.3);
  padding: 8px 0;
  z-index: 1000;
  display: none;
  min-width: 180px;
}

.context-menu-item {
  padding: 10px 16px;
  cursor: pointer;
  font-size: 14px;
  display: flex;
  align-items: center;
}

.context-menu-item:hover {
  background: #f0f0f0;
}

.context-menu-item i {
  margin-right: 10px;
  width: 20px;
}

/* Menu contextuel pour maisons */
.context-menu-header {
  padding: 8px 16px;
  font-weight: bold;
  background: #f8f9fa;
  border-bottom: 1px solid #dee2e6;
  font-size: 14px;
  color: #495057;
}

.context-menu-item.delete-option {
  color: #dc3545;
}

.context-menu-item.delete-option:hover {
  background: #f8d7da;
  color: #721c24;
}

/* =============================================================
   INDICATEUR DE MODE PLACEMENT
   ============================================================= */
#placementIndicator {
  position: absolute;
  top: 10px;
  left: 50%;
  transform: translateX(-50%);
  background: #4CAF50;
  color: white;
  padding: 10px 20px;
  border-radius: 20px;
  font-size: 14px;
  z-index: 1000;
  display: none;
  box-shadow: 0 2px 10px rgba(0,0,0,0.2);
}

/* =============================================================
   BARRE DE RECHERCHE
   ============================================================= */
.search-container {
  position: fixed;
  top: 15px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9999;
  background: linear-gradient(135deg, rgba(0, 0, 0, 0.8), rgba(20, 20, 30, 0.9));
  padding: 8px;
  border-radius: 15px;
  backdrop-filter: blur(10px);
  box-shadow:
    0 5px 20px rgba(0, 0, 0, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.1),
    0 0 0 1px rgba(255, 255, 255, 0.05);
  display: none; /* Caché au chargement */
  align-items: center;
  gap: 10px;
  border: 2px solid rgba(100, 150, 255, 0.2);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.search-container:hover {
  border-color: rgba(100, 150, 255, 0.4);
  box-shadow: 
    0 5px 25px rgba(100, 150, 255, 0.2),
    inset 0 0 20px rgba(100, 150, 255, 0.05);
}

.search-input {
  width: 250px;
  height: 44px;
  padding: 0 14px;
  border: 1px solid rgba(100, 150, 255, 0.2);
  border-radius: 12px;
  font-size: 14px;
  outline: none;
  background: rgba(255, 255, 255, 0.05);
  color: white;
  backdrop-filter: blur(5px);
  transition: all 0.3s;
  box-sizing: border-box;
}

.search-input::placeholder {
  color: rgba(255, 255, 255, 0.5);
}

.search-input:focus {
  border-color: #0095E9;
  background: rgba(255, 255, 255, 0.08);
  box-shadow: 0 0 15px rgba(0, 149, 233, 0.2);
}

.search-button {
  margin-left: 10px;
  padding: 10px 18px;
  background: linear-gradient(145deg, #0095E9, #0077c7);
  color: white;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  transition: all 0.3s;
  box-shadow: 0 2px 10px rgba(0, 149, 233, 0.3);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.search-button:hover {
  background: linear-gradient(145deg, #00a5f9, #0087d7);
  box-shadow: 
    0 5px 20px rgba(0, 149, 233, 0.4),
    inset 0 0 10px rgba(255, 255, 255, 0.1);
}

.search-button:active {
  opacity: 0.9;
}

.search-results {
  position: absolute;
  top: 100%;
  left: 12px;
  right: 12px;
  background: linear-gradient(135deg, rgba(0, 0, 0, 0.9), rgba(20, 20, 30, 0.95));
  border-radius: 12px;
  box-shadow: 0 5px 20px rgba(0, 0, 0, 0.4);
  margin-top: 8px;
  max-height: 200px;
  overflow-y: auto;
  display: none;
  border: 1px solid rgba(100, 150, 255, 0.2);
  backdrop-filter: blur(10px);
}

.search-result-item {
  padding: 12px 14px;
  cursor: pointer;
  border-bottom: 1px solid rgba(100, 150, 255, 0.1);
  font-size: 14px;
  color: rgba(255, 255, 255, 0.9);
  transition: all 0.3s;
}

.search-result-item:hover {
  background: rgba(100, 150, 255, 0.1);
  padding-left: 18px;
  color: white;
}

.search-result-item:last-child {
  border-bottom: none;
}

/* Boutons dans la barre de recherche */
.search-container .ui-button {
  width: 44px;
  height: 44px;
  min-width: 44px;
  min-height: 44px;
  flex-shrink: 0;
  background: linear-gradient(145deg, #2a2a3a, #1a1a2a);
  border: 2px solid rgba(100, 150, 255, 0.2);
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.search-container .ui-button:hover {
  border-color: rgba(100, 150, 255, 0.5);
  box-shadow:
    0 5px 20px rgba(100, 150, 255, 0.3),
    inset 0 0 20px rgba(100, 150, 255, 0.1);
}

.search-container .ui-button-icon {
  width: 28px;
  height: 28px;
  object-fit: contain;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.5));
}

.search-container .ui-button:hover .ui-button-icon {
  filter:
    drop-shadow(0 0 10px rgba(100, 150, 255, 0.6))
    drop-shadow(0 2px 4px rgba(0, 0, 0, 0.5))
    brightness(1.2);
}

/* Tooltips pour les boutons dans search-container */
.search-container .ui-button-label {
  position: absolute !important;
  bottom: auto !important;
  top: 52px !important;
  left: 50% !important;
  right: auto !important;
  transform: translateX(-50%) !important;
  background: rgba(0, 0, 0, 0.9);
  color: white;
  padding: 6px 10px;
  border-radius: 8px;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  opacity: 0;
  transition: opacity 0.3s, top 0.3s !important;
  white-space: nowrap;
  pointer-events: none;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(100, 150, 255, 0.2);
  backdrop-filter: blur(10px);
  z-index: 10000;
}

.search-container .ui-button:hover .ui-button-label {
  opacity: 1;
  top: 54px !important;
  left: 50% !important;
}

/* Flèche pointant vers le bouton */
.search-container .ui-button-label::before {
  content: '';
  position: absolute;
  top: -6px !important;
  left: 50% !important;
  right: auto !important;
  bottom: auto !important;
  transform: translateX(-50%) !important;
  width: 0;
  height: 0;
  border-left: 6px solid transparent;
  border-right: 6px solid transparent;
  border-top: 6px solid transparent;
  border-bottom: 6px solid rgba(0, 0, 0, 0.9);
  border-right: none !important;
}

/* =============================================================
   CONTRÔLES DE NAVIGATION MAPLIBRE (ZOOM)
   ============================================================= */
.maplibregl-ctrl-group {
  background: linear-gradient(135deg, rgba(0, 0, 0, 0.8), rgba(20, 20, 30, 0.9)) !important;
  border: 2px solid rgba(100, 150, 255, 0.2) !important;
  border-radius: 15px !important;
  box-shadow: 
    0 5px 20px rgba(0, 0, 0, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.1),
    0 0 0 1px rgba(255, 255, 255, 0.05) !important;
  backdrop-filter: blur(10px) !important;
  overflow: hidden !important;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
}

.maplibregl-ctrl-group:hover {
  border-color: rgba(100, 150, 255, 0.4) !important;
  box-shadow: 
    0 5px 25px rgba(100, 150, 255, 0.2),
    inset 0 0 20px rgba(100, 150, 255, 0.05) !important;
}

.maplibregl-ctrl-group button {
  background: transparent !important;
  border: none !important;
  color: rgba(255, 255, 255, 0.8) !important;
  width: 40px !important;
  height: 40px !important;
  position: relative !important;
  transition: all 0.3s !important;
  cursor: pointer !important;
}

.maplibregl-ctrl-group button + button {
  border-top: 1px solid rgba(100, 150, 255, 0.2) !important;
}

.maplibregl-ctrl-group button:hover {
  background: rgba(100, 150, 255, 0.1) !important;
  color: #6495ff !important;
}

.maplibregl-ctrl-group button:active {
  background: rgba(100, 150, 255, 0.2) !important;
}

/* Style pour les icônes de zoom */
.maplibregl-ctrl-zoom-in .maplibregl-ctrl-icon,
.maplibregl-ctrl-zoom-out .maplibregl-ctrl-icon {
  background-image: none !important;
  position: relative !important;
}

.maplibregl-ctrl-zoom-in .maplibregl-ctrl-icon::before {
  content: '+';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 24px;
  font-weight: bold;
  color: rgba(255, 255, 255, 0.8);
}

.maplibregl-ctrl-zoom-out .maplibregl-ctrl-icon::before {
  content: '−';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 24px;
  font-weight: bold;
  color: rgba(255, 255, 255, 0.8);
}

.maplibregl-ctrl-zoom-in:hover .maplibregl-ctrl-icon::before,
.maplibregl-ctrl-zoom-out:hover .maplibregl-ctrl-icon::before {
  color: #6495ff;
  text-shadow: 0 0 10px rgba(100, 150, 255, 0.5);
}

/* Position des contrôles - en dessous du champ de recherche */
.maplibregl-ctrl-top-right {
  top: 90px; /* Position en dessous du champ de recherche */
  right: 20px;
}

/* =============================================================
   INDICATEURS
   ============================================================= */
.zoom-indicator {
  position: absolute;
  bottom: 30px;
  left: 10px;
  background: linear-gradient(135deg, rgba(0, 0, 0, 0.8), rgba(20, 20, 30, 0.9));
  padding: 12px 16px;
  border-radius: 15px;
  backdrop-filter: blur(10px);
  box-shadow: 
    0 5px 20px rgba(0, 0, 0, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.1),
    0 0 0 1px rgba(255, 255, 255, 0.05);
  font-size: 14px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.8);
  z-index: 1;
  border: 2px solid rgba(100, 150, 255, 0.2);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.zoom-indicator:hover {
  border-color: rgba(100, 150, 255, 0.4);
  box-shadow: 
    0 5px 25px rgba(100, 150, 255, 0.2),
    inset 0 0 20px rgba(100, 150, 255, 0.05);
}

.zoom-level {
  color: #6495ff;
  font-weight: bold;
  text-shadow: 0 0 10px rgba(100, 150, 255, 0.5);
  margin-left: 5px;
}

.texture-loading {
  position: absolute;
  top: 170px;
  left: 20px;
  z-index: 10000;
  background: #fff3cd;
  padding: 8px 12px;
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.2);
  font-size: 13px;
  color: #856404;
  display: none !important;
}

.texture-loading.show {
  display: none !important;
}

.texture-loading.success {
  background: #d4edda;
  color: #155724;
}

.texture-loading.error {
  background: #f8d7da;
  color: #721c24;
}

.network-status {
  position: absolute;
  bottom: 70px;
  left: 10px;
  background: white;
  padding: 6px 10px;
  border-radius: 6px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.2);
  font-size: 12px;
  z-index: 1;
  display: none;
}

.network-status.online {
  border-left: 3px solid #4CAF50;
}

.network-status.offline {
  border-left: 3px solid #f44336;
  display: block;
}

.queue-indicator {
  position: absolute;
  top: 70px;
  left: 10px;
  background: #ff9800;
  color: white;
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 12px;
  display: none;
  z-index: 1;
}

.queue-indicator.show {
  display: block;
}

/* =============================================================
   TOAST NOTIFICATION
   ============================================================= */
.toast {
  position: fixed;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%);
  background: #333;
  color: white;
  padding: 12px 20px;
  border-radius: 8px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.3);
  z-index: 9999999999;
  display: none;
  animation: slideUp 0.3s ease;
}

.toast.success {
  background: #4CAF50;
}

.toast.error {
  background: #f44336;
}

.toast.warning {
  background: #ff9800;
}

.toast.show {
  display: block;
}

/* =============================================================
   LOADING SPINNER POUR ACTIONS
   ============================================================= */
.loading {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  display: none;
}

.loading.show {
  display: block;
}

.spinner {
  border: 3px solid #f3f3f3;
  border-top: 3px solid #0095E9;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  animation: spin 1s linear infinite;
}

/* =============================================================
   CURSEURS PERSONNALISÉS
   ============================================================= */
.map-cursor-crosshair {
  cursor: crosshair !important;
}

/* =============================================================
   STYLES POUR LES MARQUEURS DE BÂTIMENTS
   ============================================================= */
.building-marker {
  cursor: pointer !important;
  transition: transform 0.2s, filter 0.2s;
  z-index: 100;
}

.maplibregl-marker {
  z-index: 100 !important;
}

.maplibregl-popup {
  z-index: 200 !important;
}

/* =============================================================
   ANIMATIONS
   ============================================================= */
@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

@keyframes slideUp {
  from {
    transform: translate(-50%, 100%);
    opacity: 0;
  }
  to {
    transform: translate(-50%, 0);
    opacity: 1;
  }
}