/* Smart Map Text & Cursor System */

/* ============================================
   SMART SATELLITE LABELS - TYPOGRAPHY SYSTEM
   ============================================ */

.satellite-labels-overlay {
  /* Google Maps-style typography */
  font-family: 'Roboto', 'Segoe UI', -apple-system, BlinkMacSystemFont, sans-serif !important;
  font-weight: 600 !important; /* Semi-bold like Google Maps */
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  
  /* Google Maps-style ultra-strong contrast system */
  color: #ffffff !important;
  text-shadow: 
    /* Multiple outline layers for maximum contrast */
    -1px -1px 0 #000000,
    1px -1px 0 #000000,
    -1px 1px 0 #000000,
    1px 1px 0 #000000,
    /* Additional depth for Google Maps-like strength */
    -2px -2px 0 #000000,
    2px -2px 0 #000000,
    -2px 2px 0 #000000,
    2px 2px 0 #000000,
    /* Soft glow for extra visibility */
    0 0 4px rgba(0, 0, 0, 0.9),
    0 0 8px rgba(0, 0, 0, 0.7);
  
  /* Dynamic size system */
  --size-multiplier: 1;
  font-size: calc(14px * var(--size-multiplier)) !important;
  
  /* Enhanced contrast filters */
  filter: contrast(1.3) brightness(1.15);
  
  /* Google Maps-style spacing */
  letter-spacing: 0.15px;
  line-height: 1.1;
  
  /* Interactive hover effects */
  transition: all 0.2s ease;
}

/* Dynamic size variations based on user settings */
.satellite-labels-overlay.size-small {
  --size-multiplier: 0.85;
}

.satellite-labels-overlay.size-medium {
  --size-multiplier: 1;
}

.satellite-labels-overlay.size-large {
  --size-multiplier: 1.25;
}

.satellite-labels-overlay.size-extra-large {
  --size-multiplier: 1.5;
}

/* Text hierarchy for different label types - Google Maps style */
.satellite-labels-overlay .city-label {
  font-size: calc(18px * var(--size-multiplier)) !important;
  font-weight: 700 !important; /* Semi-bold like Google Maps */
  text-shadow: 
    /* Google Maps-style ultra-strong outline */
    -1px -1px 0 #000000,
    1px -1px 0 #000000,
    -1px 1px 0 #000000,
    1px 1px 0 #000000,
    -2px -2px 0 #000000,
    2px -2px 0 #000000,
    -2px 2px 0 #000000,
    2px 2px 0 #000000,
    0 0 6px rgba(0, 0, 0, 0.9);
  letter-spacing: 0.2px;
}

.satellite-labels-overlay .street-label {
  font-size: calc(14px * var(--size-multiplier)) !important;
  font-weight: 600 !important; /* Consistent with Google Maps */
  opacity: 1 !important;
  text-shadow: 
    /* Google Maps-style ultra-strong outline */
    -1px -1px 0 #000000,
    1px -1px 0 #000000,
    -1px 1px 0 #000000,
    1px 1px 0 #000000,
    -2px -2px 0 #000000,
    2px -2px 0 #000000,
    -2px 2px 0 #000000,
    2px 2px 0 #000000,
    0 0 4px rgba(0, 0, 0, 0.9);
  letter-spacing: 0.15px;
}

.satellite-labels-overlay .landmark-label {
  font-size: calc(16px * var(--size-multiplier)) !important;
  font-weight: 600 !important;
  font-style: italic;
  color: #ffffff !important;
  text-shadow: 
    /* Google Maps-style ultra-strong outline */
    -1px -1px 0 #000000,
    1px -1px 0 #000000,
    -1px 1px 0 #000000,
    1px 1px 0 #000000,
    -2px -2px 0 #000000,
    2px -2px 0 #000000,
    -2px 2px 0 #000000,
    2px 2px 0 #000000,
    0 0 5px rgba(0, 0, 0, 0.9);
  letter-spacing: 0.2px;
}

/* Smart contrast detection zones */
.satellite-labels-overlay .low-contrast-zone {
  /* Enhanced glow for dark areas */
  filter: drop-shadow(0 0 8px rgba(255, 255, 255, 0.4)) 
          drop-shadow(2px 2px 4px rgba(0, 0, 0, 0.9));
  color: #ffffff !important;
}

.satellite-labels-overlay .high-contrast-zone {
  /* Subtle outline for bright areas */
  filter: drop-shadow(1px 1px 2px rgba(0, 0, 0, 0.8));
  color: #f0f0f0 !important;
}

/* Interactive hover states */
.satellite-labels-overlay:hover {
  filter: contrast(1.25) brightness(1.2) saturate(1.2);
  transform: scale(1.05);
  cursor: pointer;
}

/* Google Maps-style high-contrast mode */
.satellite-labels-overlay.high-contrast {
  color: #ffffff !important;
  text-shadow: 
    /* Google Maps-style ultra-strong outline */
    -2px -2px 0 #000000,
    2px -2px 0 #000000,
    -2px 2px 0 #000000,
    2px 2px 0 #000000,
    -3px -3px 0 #000000,
    3px -3px 0 #000000,
    -3px 3px 0 #000000,
    3px 3px 0 #000000,
    0 0 8px rgba(0, 0, 0, 1),
    0 0 12px rgba(0, 0, 0, 0.9);
  filter: contrast(1.5) brightness(1.25);
  font-weight: 700 !important;
  letter-spacing: 0.2px;
}

/* Ultra high-contrast mode for difficult backgrounds */
.satellite-labels-overlay.ultra-contrast {
  color: #ffffff !important;
  background: rgba(0, 0, 0, 0.7) !important;
  padding: 2px 4px !important;
  border-radius: 3px !important;
  text-shadow: 
    2px 2px 4px rgba(0, 0, 0, 1),
    -2px -2px 4px rgba(0, 0, 0, 1);
  filter: contrast(1.6) brightness(1.4);
  font-weight: 800 !important;
  border: 1px solid rgba(255, 255, 255, 0.3) !important;
}

/* Language-specific adjustments */
.satellite-labels-overlay.cyrillic {
  font-family: 'Inter', 'Roboto', 'Segoe UI', sans-serif !important;
  letter-spacing: 0.5px;
}

.satellite-labels-overlay.asian {
  font-family: 'Inter', 'Noto Sans CJK', 'PingFang SC', sans-serif !important;
  font-weight: 700 !important;
}

/* Override default tile styling */
.leaflet-tile-pane .satellite-labels-overlay {
  mix-blend-mode: normal;
  opacity: 1 !important;
}

.leaflet-container .satellite-labels-overlay {
  pointer-events: auto; /* Enable hover interactions */
}

/* Override any default text colors */
.satellite-labels-overlay * {
  color: inherit !important;
  fill: currentColor !important;
  stroke: transparent !important;
}

/* ============================================
   SMART CURSOR SYSTEM
   ============================================ */

/* Custom cursor styles for map interactions */
.leaflet-container {
  /* Default cursor */
  cursor: grab;
}

.leaflet-container.leaflet-grab {
  cursor: grab;
}

.leaflet-container.leaflet-grabbing {
  cursor: grabbing;
}

/* Smart hover cursors for different map elements */
.leaflet-container .smart-cursor-hover {
  cursor: pointer !important;
}

.leaflet-container .smart-cursor-select {
  cursor: crosshair !important;
}

.leaflet-container .smart-cursor-pin {
  cursor: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="%23007bff" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M21 10c0 7-9 13-9 13s-9-6-9-13a9 9 0 0 1 18 0z"></path><circle cx="12" cy="10" r="3"></circle></svg>') 12 12, pointer !important;
}

/* Circle glow cursor for interactive elements */
.leaflet-container .smart-cursor-glow {
  cursor: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32"><circle cx="16" cy="16" r="14" fill="none" stroke="%23007bff" stroke-width="2" opacity="0.8"/><circle cx="16" cy="16" r="8" fill="%23007bff" opacity="0.3"/><circle cx="16" cy="16" r="2" fill="%23007bff"/></svg>') 16 16, pointer !important;
}

/* ============================================
   SMART TOOLTIPS & INFO PANELS
   ============================================ */

.smart-tooltip {
  position: absolute;
  background: rgba(0, 0, 0, 0.9);
  color: white;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  pointer-events: none;
  z-index: 1000;
  max-width: 200px;
  line-height: 1.4;
  backdrop-filter: blur(4px);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.smart-tooltip::before {
  content: '';
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 5px solid transparent;
  border-top-color: rgba(0, 0, 0, 0.9);
}

.smart-tooltip .tooltip-title {
  font-weight: 600;
  margin-bottom: 2px;
  color: #ffffff;
}

.smart-tooltip .tooltip-subtitle {
  font-size: 11px;
  opacity: 0.8;
  color: #cccccc;
}

.smart-tooltip .tooltip-coords {
  font-size: 10px;
  opacity: 0.6;
  color: #aaaaaa;
  font-family: 'Courier New', monospace;
  margin-top: 4px;
}

/* ============================================
   CONTEXT MENU SYSTEM
   ============================================ */

.smart-context-menu {
  position: absolute;
  background: white;
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
  padding: 4px 0;
  min-width: 160px;
  z-index: 1001;
  border: 1px solid rgba(0, 0, 0, 0.08);
  backdrop-filter: blur(8px);
}

.smart-context-menu-item {
  display: flex;
  align-items: center;
  padding: 8px 12px;
  font-size: 14px;
  color: #333;
  cursor: pointer;
  transition: background-color 0.15s ease;
  gap: 8px;
}

.smart-context-menu-item:hover {
  background: #f8f9fa;
}

.smart-context-menu-item .icon {
  width: 16px;
  height: 16px;
  opacity: 0.7;
}

.smart-context-menu-divider {
  height: 1px;
  background: rgba(0, 0, 0, 0.08);
  margin: 4px 0;
}

/* ============================================
   TEXT SETTINGS PANEL
   ============================================ */

.text-settings-panel {
  background: white;
  border-radius: 12px;
  padding: 16px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
  border: 1px solid rgba(0, 0, 0, 0.08);
  min-width: 280px;
}

.text-settings-title {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 16px;
  color: #333;
  display: flex;
  align-items: center;
  gap: 8px;
}

.text-settings-group {
  margin-bottom: 16px;
}

.text-settings-label {
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 8px;
  color: #555;
}

.text-settings-control {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
}

.text-settings-toggle {
  position: relative;
  width: 44px;
  height: 24px;
  background: #ddd;
  border-radius: 12px;
  cursor: pointer;
  transition: background-color 0.2s ease;
}

.text-settings-toggle.active {
  background: #007bff;
}

.text-settings-toggle::before {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 20px;
  height: 20px;
  background: white;
  border-radius: 50%;
  transition: transform 0.2s ease;
}

.text-settings-toggle.active::before {
  transform: translateX(20px);
}

.text-settings-select {
  flex: 1;
  padding: 6px 8px;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-size: 14px;
  background: white;
}

/* ============================================
   RESPONSIVE DESIGN
   ============================================ */

@media (max-width: 768px) {
  .satellite-labels-overlay .city-label {
    font-size: 12px !important;
  }
  
  .satellite-labels-overlay .street-label {
    font-size: 10px !important;
  }
  
  .satellite-labels-overlay .landmark-label {
    font-size: 11px !important;
  }
  
  .smart-tooltip {
    font-size: 12px;
    padding: 6px 10px;
    max-width: 160px;
  }
  
  .smart-context-menu {
    min-width: 140px;
  }
  
  .text-settings-panel {
    min-width: 240px;
  }
}

/* ============================================
   ACCESSIBILITY FEATURES
   ============================================ */

/* High contrast mode */
@media (prefers-contrast: high) {
  .satellite-labels-overlay {
    color: #ffffff !important;
    text-shadow: 
      2px 2px 6px rgba(0, 0, 0, 1),
      -2px -2px 6px rgba(0, 0, 0, 1),
      0 0 8px rgba(0, 0, 0, 1);
    filter: contrast(1.4) brightness(1.2);
  }
  
  .smart-tooltip {
    background: #000000;
    border: 2px solid #ffffff;
  }
  
  .smart-context-menu {
    border: 2px solid #333;
  }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  .satellite-labels-overlay {
    transition: none;
  }
  
  .satellite-labels-overlay:hover {
    transform: none;
  }
  
  .smart-tooltip,
  .smart-context-menu {
    transition: none;
  }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
  .smart-context-menu {
    background: #2d2d2d;
    border-color: #444;
  }
  
  .smart-context-menu-item {
    color: #fff;
  }
  
  .smart-context-menu-item:hover {
    background: #3d3d3d;
  }
  
  .text-settings-panel {
    background: #2d2d2d;
    border-color: #444;
  }
  
  .text-settings-title,
  .text-settings-label {
    color: #fff;
  }
}
