/* Custom styles for GeoSpatial Platform */

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  padding: 0;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

#map {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 100%;
}

.overlay {
  position: absolute;
  z-index: 1000;
  pointer-events: none;
}

.overlay > * {
  pointer-events: all;
}

.panel {
  background: white;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.panel:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

/* Loading spinner */
.spinner {
  border: 3px solid #f3f3f3;
  border-top: 3px solid #3b82f6;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Map controls */
.map-control {
  background: white;
  border-radius: 4px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
  padding: 8px;
  cursor: pointer;
  transition: background-color 0.2s;
}

.map-control:hover {
  background-color: #f9fafb;
}

/* Layer panel */
.layer-item {
  padding: 12px;
  border-bottom: 1px solid #e5e7eb;
  cursor: pointer;
  transition: background-color 0.2s;
}

.layer-item:hover {
  background-color: #f9fafb;
}

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

/* Widget container */
.widget {
  background: white;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  padding: 16px;
  resize: both;
  overflow: auto;
  min-width: 200px;
  min-height: 150px;
}

/* Animations */
@keyframes slide-in {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

.animate-slide-in {
  animation: slide-in 0.3s ease-out;
}

@keyframes fade-in {
  from {
    opacity: 0;
    transform: translateX(-50%) translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
  }
}

.animate-fade-in {
  animation: fade-in 0.4s ease-out;
}

/* Drawing instructions styling */
#drawing-instructions {
  transition: opacity 0.3s ease-out;
}

/* Line clamp utility */
.line-clamp-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Scrollbar styling */
.overflow-y-auto::-webkit-scrollbar {
  width: 6px;
}

.overflow-y-auto::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 10px;
}

.overflow-y-auto::-webkit-scrollbar-thumb {
  background: #888;
  border-radius: 10px;
}

.overflow-y-auto::-webkit-scrollbar-thumb:hover {
  background: #555;
}

/* Feature tooltip */
.feature-tooltip .mapboxgl-popup-content {
  padding: 8px 12px;
  font-size: 12px;
  background: rgba(0, 0, 0, 0.8);
  color: white;
  border-radius: 4px;
}

.feature-tooltip .mapboxgl-popup-tip {
  border-top-color: rgba(0, 0, 0, 0.8);
}

/* Basemap option */
.basemap-option {
  transition: all 0.2s;
}

.basemap-option:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

/* Layer drag indicator */
.layer-item.dragging {
  opacity: 0.5;
}

/* Responsive utilities */
@media (max-width: 768px) {
  .overlay {
    max-width: 90vw;
  }
  
  .panel {
    font-size: 14px;
  }
  
  #layer-panel,
  #styling-panel,
  #widget-panel {
    width: calc(100vw - 2rem);
    max-width: 400px;
  }
  
  #editor-top-bar {
    flex-direction: column;
    gap: 0.5rem;
  }
}
