/* Leaflet Interaction Mode Button */
.interaction-mode-btn {
  width: 40px !important;
  height: 40px !important;
  min-width: 40px !important;
  min-height: 40px !important;
  max-width: 40px !important;
  max-height: 40px !important;
  border: none;
  border-radius: 50% !important;
  background: rgba(255, 255, 255, 0.2);
  backdrop-filter: blur(15px);
  -webkit-backdrop-filter: blur(15px);
  border: 1px solid rgba(255, 255, 255, 0.3);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1), inset 0 1px 0 rgba(255, 255, 255, 0.4);
  cursor: pointer;
  display: flex !important;
  align-items: center;
  justify-content: center;
  color: var(--text);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: absolute;
  top: 12px;
  left: 12px;
  z-index: 10060;
  flex-shrink: 0 !important;
  flex-grow: 0 !important;
}

.interaction-mode-btn:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: scale(1.05);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15), inset 0 1px 0 rgba(255, 255, 255, 0.5);
}

.interaction-mode-btn.active {
  background: rgba(59, 130, 246, 0.2);
  border-color: rgba(59, 130, 246, 0.5);
  color: #3b82f6;
}

.interaction-mode-btn.active:hover {
  background: rgba(59, 130, 246, 0.3);
  box-shadow: 0 6px 20px rgba(59, 130, 246, 0.2), inset 0 1px 0 rgba(255, 255, 255, 0.5);
}

.interaction-mode-btn svg {
  width: 20px;
  height: 20px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Leaflet Center Location Button */
.center-location-btn {
  width: 40px !important;
  height: 40px !important;
  min-width: 40px !important;
  min-height: 40px !important;
  max-width: 40px !important;
  max-height: 40px !important;
  border: none;
  border-radius: 50% !important;
  background: rgba(255, 255, 255, 0.2);
  backdrop-filter: blur(15px);
  -webkit-backdrop-filter: blur(15px);
  border: 1px solid rgba(255, 255, 255, 0.3);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1), inset 0 1px 0 rgba(255, 255, 255, 0.4);
  cursor: pointer;
  display: flex !important;
  align-items: center;
  justify-content: center;
  color: var(--text);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: absolute;
  top: 60px;
  left: 12px;
  z-index: 10060;
  flex-shrink: 0 !important;
  flex-grow: 0 !important;
}

.center-location-btn:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: scale(1.05);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15), inset 0 1px 0 rgba(255, 255, 255, 0.5);
}

.center-location-btn:active {
  transform: scale(0.95);
}

.center-location-btn svg {
  width: 20px;
  height: 20px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.center-location-btn.loading {
  animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

/* Leaflet Interaction Menu Styles */
.leaflet-interaction-menu {
  position: absolute;
  z-index: 1000;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 16px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15), inset 0 1px 0 rgba(255, 255, 255, 0.4);
  padding: 0;
  min-width: 280px;
  max-width: 320px;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  animation: menuSlideIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes menuSlideIn {
  from {
    opacity: 0;
    transform: translateY(-10px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.leaflet-interaction-menu .menu-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px 12px 20px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

.leaflet-interaction-menu .menu-header h4 {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  color: #1f2937;
}

.leaflet-interaction-menu .close-btn {
  background: none;
  border: none;
  font-size: 20px;
  color: #6b7280;
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  transition: all 0.2s ease;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.leaflet-interaction-menu .close-btn:hover {
  background: rgba(0, 0, 0, 0.1);
  color: #374151;
}

.leaflet-interaction-menu .menu-content {
  padding: 16px 20px 20px 20px;
}

.leaflet-interaction-menu .menu-content p {
  margin: 0 0 16px 0;
  font-size: 14px;
  color: #6b7280;
  font-family: 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', Consolas, 'Courier New', monospace;
}

.leaflet-interaction-menu .point-types {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 16px;
}

.leaflet-interaction-menu .type-btn {
  background: rgba(255, 255, 255, 0.8);
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: 12px;
  padding: 12px 8px;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  font-size: 13px;
  font-weight: 500;
  color: #374151;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.leaflet-interaction-menu .type-btn:hover {
  background: rgba(255, 255, 255, 1);
  border-color: rgba(59, 130, 246, 0.3);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.leaflet-interaction-menu .type-btn:active {
  transform: translateY(0);
}

.leaflet-interaction-menu .custom-point {
  border-top: 1px solid rgba(0, 0, 0, 0.1);
  padding-top: 16px;
}

.leaflet-interaction-menu .custom-name {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: 8px;
  font-size: 14px;
  margin-bottom: 8px;
  background: rgba(255, 255, 255, 0.8);
  transition: all 0.2s ease;
}

.leaflet-interaction-menu .custom-name:focus {
  outline: none;
  border-color: rgba(59, 130, 246, 0.5);
  background: rgba(255, 255, 255, 1);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.leaflet-interaction-menu .add-custom-btn {
  width: 100%;
  background: linear-gradient(135deg, #3b82f6, #1d4ed8);
  color: white;
  border: none;
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.leaflet-interaction-menu .add-custom-btn:hover {
  background: linear-gradient(135deg, #2563eb, #1e40af);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.leaflet-interaction-menu .add-custom-btn:active {
  transform: translateY(0);
}

/* Popup Actions Styles */
.leaflet-popup-content .popup-actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid rgba(0, 0, 0, 0.1);
}

.leaflet-popup-content .edit-btn,
.leaflet-popup-content .delete-btn {
  flex: 1;
  padding: 6px 12px;
  border: none;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.leaflet-popup-content .edit-btn {
  background: rgba(59, 130, 246, 0.1);
  color: #3b82f6;
}

.leaflet-popup-content .edit-btn:hover {
  background: rgba(59, 130, 246, 0.2);
}

.leaflet-popup-content .delete-btn {
  background: rgba(239, 68, 68, 0.1);
  color: #ef4444;
}

.leaflet-popup-content .delete-btn:hover {
  background: rgba(239, 68, 68, 0.2);
}

/* Mobile Responsive */
@media (max-width: 480px) {
  .leaflet-interaction-menu {
    min-width: 260px;
    max-width: 280px;
  }
  
  .leaflet-interaction-menu .point-types {
    grid-template-columns: 1fr;
    gap: 6px;
  }
  
  .leaflet-interaction-menu .type-btn {
    padding: 10px 6px;
    font-size: 12px;
  }
  
  /* Assicura che i pulsanti rimangano tondi su mobile */
  .center-location-btn,
  .interaction-mode-btn {
    width: 40px !important;
    height: 40px !important;
    min-width: 40px !important;
    min-height: 40px !important;
    max-width: 40px !important;
    max-height: 40px !important;
    border-radius: 50% !important;
    flex-shrink: 0 !important;
    flex-grow: 0 !important;
  }
}

/* Tablet responsive */
@media (min-width: 481px) and (max-width: 768px) {
  /* Assicura che i pulsanti rimangano tondi su tablet */
  .center-location-btn,
  .interaction-mode-btn {
    width: 40px !important;
    height: 40px !important;
    min-width: 40px !important;
    min-height: 40px !important;
    max-width: 40px !important;
    max-height: 40px !important;
    border-radius: 50% !important;
    flex-shrink: 0 !important;
    flex-grow: 0 !important;
  }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
  .leaflet-interaction-menu {
    background: rgba(31, 41, 55, 0.95);
    border-color: rgba(255, 255, 255, 0.2);
  }
  
  .leaflet-interaction-menu .menu-header h4 {
    color: #f9fafb;
  }
  
  .leaflet-interaction-menu .close-btn {
    color: #9ca3af;
  }
  
  .leaflet-interaction-menu .close-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #d1d5db;
  }
  
  .leaflet-interaction-menu .menu-content p {
    color: #9ca3af;
  }
  
  .leaflet-interaction-menu .type-btn {
    background: rgba(55, 65, 81, 0.8);
    border-color: rgba(255, 255, 255, 0.1);
    color: #d1d5db;
  }
  
  .leaflet-interaction-menu .type-btn:hover {
    background: rgba(55, 65, 81, 1);
    border-color: rgba(59, 130, 246, 0.5);
  }
  
  .leaflet-interaction-menu .custom-name {
    background: rgba(55, 65, 81, 0.8);
    border-color: rgba(255, 255, 255, 0.1);
    color: #d1d5db;
  }
  
  .leaflet-interaction-menu .custom-name:focus {
    background: rgba(55, 65, 81, 1);
    border-color: rgba(59, 130, 246, 0.5);
  }
}
