/* World Map Component Styles */

.world-map-section {
  position: relative;
  z-index: 10;
  width: 100%;
  padding: 40px 0;
  background-color: #ffffff;
  overflow: visible;
}

.world-map-container {
  width: 100%;
  max-width: 1200px;
  margin: 40px auto;
  border-radius: 8px;
  overflow: visible;
  background-color: transparent;
  height: 500px;
  position: relative;
  z-index: 10;
  pointer-events: auto;
  /* Better touch handling on mobile */
  touch-action: pan-y pinch-zoom;
}

/* Larger map on wider screens */
@media screen and (min-width: 1400px) {
  .world-map-container {
    max-width: 1600px;
    height: 700px;
  }
}

@media screen and (min-width: 1920px) {
  .world-map-container {
    max-width: 1800px;
    height: 800px;
  }
}

/* Highcharts styling overrides */
.world-map-container .highcharts-background {
  fill: transparent !important;
}

/* Ensure Highcharts SVG elements are interactive */
.world-map-container svg {
  pointer-events: auto !important;
  position: relative;
  z-index: 1;
}

.world-map-container .highcharts-container {
  pointer-events: auto !important;
  position: relative;
  z-index: 1;
  overflow: visible !important;
  /* Better touch handling */
  touch-action: manipulation;
}

/* Ensure Highcharts tooltips are visible and above everything */
div.highcharts-tooltip {
  z-index: 99999 !important;
}

/* Style the map navigation buttons */
.world-map-container .highcharts-map-navigation {
  z-index: 100;
}

/* Add shadow effect to button boxes */
.world-map-container .highcharts-map-navigation .highcharts-button-box {
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1));
}

/* Hover effect */
.world-map-container .highcharts-map-navigation .highcharts-button:hover .highcharts-button-box {
  filter: drop-shadow(0 4px 8px rgba(252, 184, 37, 0.3));
}

/* Desktop/Mobile visibility utilities */
.desktop-only {
  display: block;
}

.mobile-only {
  display: none;
}

/* Keep map visible on mobile - hide list view */
.world-map-section .mobile-only {
  display: none !important;
}

.world-map-section .desktop-only {
  display: block !important;
}

/* Mobile Locations Grid */
.mobile-locations-grid {
  max-width: 1200px;
  margin: 40px auto;
  padding: 0 20px;
}

.locations-region {
  margin-bottom: 24px;
}

.region-title {
  color: var(--amp-yellow);
  font-size: 14px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--amp-yellow);
}

.locations-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.location-tag {
  background: linear-gradient(135deg, #f5f5f5 0%, #e8e8e8 100%);
  color: var(--amp-gray);
  padding: 8px 14px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 500;
  transition: all 0.2s ease;
}

.location-tag:hover,
.location-tag:active {
  background: var(--amp-yellow);
  color: var(--amp-gray);
}

/* Location Popup */
.location-popup-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.6);
  z-index: 9999;
  padding: 20px;
  box-sizing: border-box;
  display: none;
  justify-content: center;
  align-items: center;
}

.location-popup-overlay.active {
  display: flex !important;
}

.location-popup {
  background: var(--amp-yellow);
  border-radius: 12px;
  max-width: 320px;
  width: 100%;
  position: relative;
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  animation: popupIn 0.2s ease-out;
}

@keyframes popupIn {
  from {
    opacity: 0;
    transform: scale(0.9);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.location-popup-header {
  display: none;
}

.location-popup-image-container {
  width: 100%;
  height: 180px;
  overflow: hidden;
  background: var(--amp-yellow);
  display: none;
  position: relative;
  border-radius: 8px 8px 0 0;
}

.location-popup-image-container.show,
.location-popup-image-container[style*="display: block"] {
  display: block !important;
}

.location-popup-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  border-radius: 0;
}

.location-popup-content {
  padding: 12px 20px;
  padding-top: 16px;
  color: #30303d;
  text-align: center;
  background: var(--amp-yellow);
}

.popup-row {
  margin: 0;
  font-size: 13px;
  line-height: 1.4;
  color: #30303d;
}

.popup-row:last-child {
  margin-bottom: 0;
}

.popup-label {
  color: #30303d;
  opacity: 0.7;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.popup-row strong {
  display: block;
  font-size: 16px;
  margin-top: 4px;
  color: #30303d;
}

.location-popup-close {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 32px;
  height: 32px;
  border: none;
  background: rgba(48, 48, 61, 0.2);
  color: #30303d;
  font-size: 24px;
  font-weight: bold;
  line-height: 1;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  z-index: 10;
}

.location-popup-close:hover,
.location-popup-close:active {
  background: rgba(48, 48, 61, 0.4);
}

/* Tablet & Mobile - Keep map visible, adjust sizing */
@media screen and (max-width: 991px) {
  .world-map-section {
    padding: 30px 0;
  }
  
  /* Fix container padding on tablet to prevent overflow */
  .world-map-section .container {
    padding-left: 16px;
    padding-right: 16px;
    max-width: 100%;
  }
  
  /* Fix section header wrapper to prevent text overflow */
  .world-map-section .section-header-wrapper {
    width: 100%;
    max-width: 100%;
    padding-left: 0;
    padding-right: 0;
    box-sizing: border-box;
  }
  
  /* Ensure title doesn't overflow */
  .world-map-section .section-header-title {
    padding-left: 0;
    padding-right: 0;
    word-wrap: break-word;
    overflow-wrap: break-word;
    max-width: 100%;
    box-sizing: border-box;
  }
  
  /* Ensure subtitle doesn't overflow */
  .world-map-section .section-header-subtitle {
    padding-left: 0;
    padding-right: 0;
    word-wrap: break-word;
    overflow-wrap: break-word;
    max-width: 100%;
    box-sizing: border-box;
  }
  
  .world-map-container {
    max-width: 100%;
    height: 400px;
    margin: 20px auto;
    padding: 0 16px;
  }
  
  /* Hide mobile list view on home page */
  .world-map-section .mobile-only {
    display: none !important;
  }
  
  .world-map-section .desktop-only {
    display: block !important;
  }
}

/* Mobile - smaller adjustments */
@media screen and (max-width: 767px) {
  .world-map-section {
    padding: 24px 0;
  }
  
  /* Fix container padding on mobile to prevent overflow */
  .world-map-section .container {
    padding-left: 16px;
    padding-right: 16px;
    max-width: 100%;
  }
  
  /* Fix section header wrapper to prevent text overflow */
  .world-map-section .section-header-wrapper {
    width: 100%;
    max-width: 100%;
    padding-left: 0;
    padding-right: 0;
    box-sizing: border-box;
  }
  
  /* Ensure title doesn't overflow */
  .world-map-section .section-header-title {
    padding-left: 0;
    padding-right: 0;
    word-wrap: break-word;
    overflow-wrap: break-word;
    max-width: 100%;
    box-sizing: border-box;
  }
  
  /* Ensure subtitle doesn't overflow */
  .world-map-section .section-header-subtitle {
    padding-left: 0;
    padding-right: 0;
    word-wrap: break-word;
    overflow-wrap: break-word;
    max-width: 100%;
    box-sizing: border-box;
    text-align: center !important;
  }
  
  .world-map-container {
    height: 350px;
    margin: 16px auto;
    padding: 0 12px;
  }
  
  /* Ensure map navigation buttons are touch-friendly */
  .world-map-container .highcharts-map-navigation {
    font-size: 14px;
  }
  
  .world-map-container .highcharts-button {
    width: 36px;
    height: 36px;
  }
}
