/* Map-specific CSS */
.world-map-container {
  position: relative;
  min-height: 400px;
}

.map-country {
  transition: all 0.2s ease;
  cursor: pointer;
}

.map-country:hover {
  stroke: #1f2937;
  stroke-width: 2;
  filter: brightness(1.1);
}

.map-country.highlighted {
  stroke: #1f2937;
  stroke-width: 3;
  filter: brightness(1.2);
}

.map-country.focused {
  stroke: #2563eb;
  stroke-width: 3;
  filter: brightness(1.2);
}

/* Risk level specific styles with new theme colors */
.map-country--high-risk { fill: #DC2626; }
.map-country--medium-risk { fill: var(--color-orange-warm); }
.map-country--low-risk { fill: #059669; }
.map-country--analyzing { fill: #2A4A6B; }
.map-country--no-profile { fill: var(--tactical-gray); }

/* Score-based colors for dynamic factor/vector analysis */
.map-country--score-high { fill: #DC2626; }      /* Red for scores 1-3 (high risk) */
.map-country--score-medium { fill: #F59E0B; }    /* Yellow for scores 4-6 (medium risk) */
.map-country--score-low { fill: #059669; }       /* Green for scores 7-10 (low risk) */
.map-country--score-none { fill: var(--tactical-gray); } /* Dark gray for no data */
.map-country--score-na { fill: #E5E7EB; }        /* Light gray for N/A (perspective doesn't evaluate these factors) */

/* Enhanced map interactions */
.map-country:hover {
  stroke: var(--color-navy-dark);
  stroke-width: 2;
  filter: brightness(1.15) saturate(1.1);
}

.map-country.highlighted {
  stroke: var(--color-yellow-bright);
  stroke-width: 3;
  filter: brightness(1.2) saturate(1.2);
}

.map-country.focused {
  stroke: var(--color-orange-warm);
  stroke-width: 3;
  filter: brightness(1.2) saturate(1.2);
  box-shadow: var(--shadow-md);
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .world-map-container {
    min-height: 300px;
  }
}

/* Legend color squares with new theme */
.legend-color-high-risk {
  background: linear-gradient(135deg, #DC2626 0%, #EF4444 100%);
  border-radius: var(--radius-sm);
}
.legend-color-medium-risk {
  background: linear-gradient(135deg, var(--color-orange-warm) 0%, var(--color-orange-light) 100%);
  border-radius: var(--radius-sm);
}
.legend-color-low-risk {
  background: linear-gradient(135deg, #059669 0%, #10B981 100%);
  border-radius: var(--radius-sm);
}
.legend-color-analyzing {
  background: linear-gradient(135deg, var(--color-navy-dark) 0%, var(--color-navy-light) 100%);
  border-radius: var(--radius-sm);
}
.legend-color-no-profile {
  background: linear-gradient(135deg, var(--color-gray-300) 0%, var(--color-gray-200) 100%);
  border-radius: var(--radius-sm);
}

/* ========================================
   MAP COUNTRY POPUP
   ======================================== */

/* Wrapper creates an invisible "safe zone" around the popup for easier mouse targeting */
.map-country-popup {
  position: fixed;
  z-index: 10000;
  /* Invisible padding creates the interactive border / buffer zone (like Tippy.js interactiveBorder) */
  padding: 30px;
  margin: -30px;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.map-country-popup.visible {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.map-country-popup-inner {
  min-width: 200px;
  max-width: 280px;
  background: linear-gradient(135deg, var(--command-navy, #1a2332) 0%, var(--tactical-gray, #2d3748) 100%);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 8px;
  box-shadow:
    0 8px 32px rgba(0, 0, 0, 0.6),
    0 0 0 1px rgba(255, 255, 255, 0.05),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);
  transform: translateY(8px);
  transition: opacity 0.15s ease, transform 0.15s ease;
}

.map-country-popup.visible .map-country-popup-inner {
  transform: translateY(0);
}

.map-country-popup-header {
  padding: 12px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.map-country-popup-name {
  color: rgba(255, 255, 255, 0.95);
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 0.02em;
  flex: 1;
}

.map-country-popup-score {
  display: flex;
  align-items: center;
  gap: 8px;
}

.map-country-popup-score-value {
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
  font-size: 18px;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.95);
}

.map-country-popup-badge {
  padding: 4px 10px;
  border-radius: 2px;
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  border: 1px solid currentColor;
}

.map-country-popup-badge--high {
  background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
  color: white;
  border-color: #dc2626;
}

.map-country-popup-badge--medium {
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  color: #0a0e1a;
  border-color: #f59e0b;
}

.map-country-popup-badge--low {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: white;
  border-color: #10b981;
}

.map-country-popup-badge--none {
  background: linear-gradient(135deg, #4b5563 0%, #374151 100%);
  color: rgba(255, 255, 255, 0.7);
  border-color: #4b5563;
}

.map-country-popup-body {
  padding: 12px 16px;
}

.map-country-popup-context {
  color: rgba(255, 255, 255, 0.6);
  font-size: 12px;
  margin-bottom: 8px;
}

.map-country-popup-sparkline {
  height: 6px;
  background: rgba(0, 0, 0, 0.3);
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 12px;
}

.map-country-popup-sparkline-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.3s ease;
}

.map-country-popup-sparkline-fill--high {
  background: linear-gradient(90deg, #ef4444 0%, #dc2626 100%);
}

.map-country-popup-sparkline-fill--medium {
  background: linear-gradient(90deg, #f59e0b 0%, #d97706 100%);
}

.map-country-popup-sparkline-fill--low {
  background: linear-gradient(90deg, #10b981 0%, #059669 100%);
}

.map-country-popup-sparkline-fill--none {
  background: linear-gradient(90deg, #4b5563 0%, #374151 100%);
}

.map-country-popup-link {
  display: block;
  text-align: center;
  padding: 10px 16px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 4px;
  color: rgba(255, 255, 255, 0.85);
  font-size: 12px;
  font-weight: 500;
  text-decoration: none;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  transition: all 0.15s ease;
  cursor: pointer;
}

.map-country-popup-link:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.2);
  color: white;
}

.map-country-popup-no-profile {
  color: rgba(255, 255, 255, 0.5);
  font-size: 12px;
  text-align: center;
  font-style: italic;
}