/**
 * Interactive World Map Component Styles
 * 
 * DEBUGGING GUIDE:
 * 1. Map container issues: Check #world-map-container styles
 * 2. Country coloring issues: Check .country and [data-status] rules
 * 3. Tooltip not showing: Check .map-tooltip opacity and z-index
 * 4. Marker visibility: Check .chapter-marker styles
 * 5. Zoom controls not working: Check .map-zoom-controls and .zoom-btn
 * 6. Mobile display issues: See responsive media queries at bottom
 */

/* MAP SECTION CONTAINER */
#map-section {
  padding: 4rem 0;
  background-color: #ebebeb;
  width: 100%;
  overflow: hidden;
}

#map-section .container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}

/* Section title and description */
#map-section h2 {
  text-align: center;
  margin-bottom: 1rem;
  font-size: 2.8rem;
  color: #2c3e50;
  font-weight: 700;
}

#map-section .section-subtitle {
  text-align: center;
  margin-bottom: 2.5rem;
  font-size: 1.1rem;
  color: #555;
  max-width: 700px;
  margin-left: auto;
  margin-right: auto;
  line-height: 1.6;
}

/* Main map container */
#world-map-container {
  position: relative;
  width: 100%;
  max-width: 1000px;
  margin: 0 auto;
  overflow: hidden;
  background-color: #f9f9f9;
  border: 1px solid #000;
  box-shadow: 0 1px 3px rgb(0 0 0 / 20%);
  cursor: grab; /* Indicates the map is draggable */
}

#world-map-container:active {
  cursor: grabbing; /* Indicates active panning */
}

#world-map-container svg {
  width: 100%;
  height: auto;
  display: block;
  max-height: 70vh;
}

/* COUNTRY STYLES */
.country {
  transition:
    fill 0.3s ease,
    filter 0.3s ease;
  cursor: pointer;
  outline: none;
  stroke: #333;
  stroke-width: 0.2;
}

/* Status-based country colors - also set via JavaScript */
.country[data-status='ratified'] {
  fill: #3498db;
} /* Active chapters */
.country[data-status='unratified'] {
  fill: #f5b5b5;
} /* Upcoming chapters */
.country[data-status='none'] {
  fill: #e9ecef;
} /* Non-chapter countries */

/* CONTEXT BUTTON - appears below map */
#map-button-container {
  min-height: 60px;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 15px 10px;
  background-color: transparent;
}

.map-context-button {
  padding: 12px 24px;
  font-size: 1rem;
  color: #fff;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition:
    background-color 0.2s ease,
    transform 0.2s ease;
  box-shadow: 0 2px 5px rgb(0 0 0 / 20%);
  font-family: Montserrat, sans-serif;
  font-weight: 500;
}

.map-context-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgb(0 0 0 / 25%);
}

.map-context-button:focus-visible {
  outline: 3px solid #0056b3;
  outline-offset: 2px;
}

/* Button color variations */
.map-context-button[data-status='ratified'] {
  background-color: #3498db;
}

.map-context-button[data-status='unratified'] {
  background-color: #f0ad4e;
}

.map-context-button[data-status='none'] {
  background-color: #5cb85c;
}

/* TOOLTIP */
.map-tooltip {
  position: absolute;
  background-color: rgb(44 62 80 / 90%);
  color: white;
  padding: 10px 16px;
  border-radius: 8px;
  font-size: 0.95rem;
  font-weight: 500;
  pointer-events: none;
  white-space: nowrap;
  opacity: 0;
  transform: translate(-50%, -120%);
  transition:
    opacity 0.2s ease,
    transform 0.2s ease;
  z-index: 1000;
  box-shadow: 0 4px 10px rgb(0 0 0 / 15%);
}

/* CHAPTER LOCATION MARKERS */
.chapter-marker {
  fill: #3498db; /* Blue markers */
  stroke: #fff;
  stroke-width: 2px;
  transition: all 0.3s ease;
  cursor: pointer;
}

.chapter-marker:hover {
  fill: #2980b9; /* Darker blue on hover */
  transform: scale(1.2);
  transform-origin: center;
}

/* Optional text labels for chapters */
.chapter-label {
  font-family: Montserrat, sans-serif;
  font-size: 12px;
  font-weight: 600;
  fill: #2c3e50;
  text-anchor: middle;
  pointer-events: none;
}

/* ZOOM CONTROLS */
.map-zoom-controls {
  position: absolute;
  bottom: 20px;
  right: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 10;
}

.zoom-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background-color: #fff;
  border: 1px solid #ddd;
  box-shadow: 0 2px 5px rgb(0 0 0 / 10%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.2s ease;
}

.zoom-btn:hover {
  background-color: #f8f9fa;
  transform: translateY(-2px);
}

.zoom-btn:active {
  transform: translateY(0);
  box-shadow: 0 1px 2px rgb(0 0 0 / 10%);
}

/* ZOOM INDICATOR */
.zoom-indicator {
  position: absolute;
  bottom: 20px;
  left: 20px;
  background-color: rgb(255 255 255 / 80%);
  padding: 5px 10px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 500;
  color: #333;
  z-index: 10;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.zoom-indicator.active {
  opacity: 1;
}

/* RESPONSIVE ADJUSTMENTS */
@media (width <= 768px) {
  /* Container adjustments */
  #world-map-container {
    max-height: 60vh;
  }

  /* Text adjustments */
  #map-section h2 {
    font-size: 2.2rem;
  }

  #map-section .section-subtitle {
    font-size: 1rem;
  }

  /* Button adjustments */
  .map-context-button {
    padding: 10px 20px;
    font-size: 0.9rem;
  }

  /* Control adjustments */
  .map-zoom-controls {
    bottom: 10px;
    right: 10px;
  }

  .zoom-btn {
    width: 36px;
    height: 36px;
    font-size: 16px;
  }

  .zoom-indicator {
    bottom: 10px;
    left: 10px;
  }
}
