/**
 * Mobile-optimized styles for enhanced map layer switcher
 */

/* Ensure layer switcher is visible and accessible on mobile */
.kasi-layer-switcher {
  z-index: 1000 !important;
  position: relative !important;
}

.kasi-layer-switcher .layer-switcher-button {
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: 44px !important;
  height: 44px !important;
  background: white !important;
  border-radius: 8px !important;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15) !important;
  border: 1px solid rgba(0,0,0,0.1) !important;
  cursor: pointer !important;
  text-decoration: none !important;
  font-size: 18px !important;
  transition: all 0.2s ease !important;
  -webkit-tap-highlight-color: transparent !important;
  user-select: none !important;
  -webkit-user-select: none !important;
  -moz-user-select: none !important;
  -ms-user-select: none !important;
  touch-action: manipulation !important;
}

.kasi-layer-switcher .layer-switcher-button:hover {
  background: #f8fafc !important;
  transform: scale(1.05) !important;
}

.kasi-layer-switcher .layer-switcher-button:active {
  transform: scale(0.95) !important;
  background: #f1f5f9 !important;
}

.kasi-layer-switcher .layer-switcher-dropdown {
  position: absolute !important;
  top: 100% !important;
  right: 0 !important;
  margin-top: 8px !important;
  background: white !important;
  border-radius: 12px !important;
  box-shadow: 0 8px 24px rgba(0,0,0,0.15) !important;
  min-width: 220px !important;
  max-width: 280px !important;
  z-index: 10000 !important;
  border: 1px solid rgba(0,0,0,0.1) !important;
  overflow: hidden !important;
  -webkit-backdrop-filter: blur(10px) !important;
  backdrop-filter: blur(10px) !important;
}

.kasi-layer-switcher .layer-option {
  padding: 14px 20px !important;
  cursor: pointer !important;
  display: flex !important;
  align-items: center !important;
  gap: 12px !important;
  font-size: 15px !important;
  color: #374151 !important;
  transition: background-color 0.2s !important;
  border-bottom: 1px solid #f9fafb !important;
  -webkit-tap-highlight-color: transparent !important;
  user-select: none !important;
  -webkit-user-select: none !important;
  min-height: 52px !important;
  touch-action: manipulation !important;
}

.kasi-layer-switcher .layer-option:hover {
  background-color: #f9fafb !important;
}

.kasi-layer-switcher .layer-option:active {
  background-color: #f3f4f6 !important;
}

.kasi-layer-switcher .layer-option:last-child {
  border-bottom: none !important;
}

/* Mobile-specific adjustments */
@media (max-width: 768px) {
  .kasi-layer-switcher .layer-switcher-button {
    width: 48px !important;
    height: 48px !important;
    font-size: 20px !important;
  }
  
  .kasi-layer-switcher .layer-switcher-dropdown {
    min-width: 240px !important;
    max-width: 90vw !important;
    margin-top: 10px !important;
  }
  
  .kasi-layer-switcher .layer-option {
    padding: 16px 20px !important;
    font-size: 16px !important;
    min-height: 56px !important;
  }
  
  .kasi-layer-switcher .layer-option span:first-child {
    font-size: 22px !important;
  }
}

/* Extra small mobile devices */
@media (max-width: 480px) {
  .kasi-layer-switcher .layer-switcher-dropdown {
    right: -10px !important;
    left: auto !important;
    min-width: 260px !important;
  }
}

/* Ensure the control doesn't interfere with map interactions */
.leaflet-control-container .kasi-layer-switcher {
  margin: 10px !important;
}

/* Fix for iOS Safari */
@supports (-webkit-touch-callout: none) {
  .kasi-layer-switcher .layer-switcher-button {
    -webkit-appearance: none !important;
    -webkit-touch-callout: none !important;
  }
  
  .kasi-layer-switcher .layer-option {
    -webkit-touch-callout: none !important;
  }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  .kasi-layer-switcher .layer-switcher-button {
    border: 2px solid #000 !important;
  }
  
  .kasi-layer-switcher .layer-switcher-dropdown {
    border: 2px solid #000 !important;
  }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
  .kasi-layer-switcher .layer-switcher-button {
    transition: none !important;
  }
  
  .kasi-layer-switcher .layer-option {
    transition: none !important;
  }
}