/* Sentinel GeoMap Styles - SVG-based (no external dependencies) */
:root {
  --bg-primary: #1a1a1a;
  --bg-secondary: #2d2d2d;
  --text-primary: #e0e0e0;
  --text-secondary: #a0a0a0;
  --border-color: #404040;
  --accent-blue: #0078d4;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 12px;
  background: var(--bg-primary);
  color: var(--text-primary);
  padding: 8px;
}

.loading, .empty, .error {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 24px;
  color: var(--text-secondary);
}

.error {
  color: #f65314;
}

.spinner {
  width: 16px;
  height: 16px;
  border: 2px solid var(--border-color);
  border-top-color: var(--accent-blue);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Wrapper for map + panel layout */
.geomap-wrapper {
  display: flex;
  gap: 12px;
}

.geomap-wrapper.with-panel .geomap-container {
  flex: 1;
  min-width: 0;
}

.geomap-container {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.geomap-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.geomap-stats {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  font-size: 11px;
  color: var(--text-secondary);
  padding: 6px 8px;
  background: var(--bg-secondary);
  border-radius: 4px;
  align-items: center;
}

.geomap-stats strong {
  color: var(--text-primary);
}

.enrichment-hint-inline {
  color: var(--accent-blue);
  font-style: italic;
}

/* Stats and Mode Toggle Row */
.stats-row {
  display: flex;
  gap: 12px;
  align-items: stretch;
}

.map-container {
  position: relative;
  height: 350px;
  border-radius: 4px;
  overflow: hidden;
  border: 1px solid var(--border-color);
  background: #1a1a2e;
  cursor: grab;
}

.map-container.zoomed {
  cursor: grab;
}

.map-container.panning {
  cursor: grabbing;
}

.world-map-svg {
  width: 100%;
  height: 100%;
  transition: transform 0.1s ease-out;
}

.map-container.panning .world-map-svg {
  transition: none;
}

/* Country paths styling */
.countries path {
  transition: fill 0.2s ease, filter 0.2s ease;
}

.countries path:hover {
  filter: brightness(1.3);
}

/* Graticule styling */
.graticule polyline {
  pointer-events: none;
}

/* Zoom Controls */
.zoom-controls {
  position: absolute;
  top: 8px;
  right: 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  z-index: 100;
  background: rgba(26, 26, 26, 0.9);
  padding: 6px;
  border-radius: 6px;
  border: 1px solid var(--border-color);
}

.zoom-btn {
  width: 28px;
  height: 28px;
  border: 1px solid var(--border-color);
  background: var(--bg-secondary);
  color: var(--text-primary);
  font-size: 16px;
  font-weight: bold;
  cursor: pointer;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, border-color 0.15s;
}

.zoom-btn:hover {
  background: var(--accent-blue);
  border-color: var(--accent-blue);
}

.zoom-btn.reset {
  font-size: 14px;
  margin-top: 4px;
  border-top: 1px solid var(--border-color);
  padding-top: 4px;
}

.zoom-level {
  font-size: 10px;
  color: var(--text-secondary);
  font-weight: 600;
  min-width: 36px;
  text-align: center;
}

/* Pulse animation for markers */
@keyframes pulse {
  0% { transform: scale(1); opacity: 0.3; }
  50% { transform: scale(1.3); opacity: 0.1; }
  100% { transform: scale(1); opacity: 0.3; }
}

.pulse-ring {
  animation: pulse 2s ease-in-out infinite;
  transform-origin: center;
  transform-box: fill-box;
}

.marker-viewing {
  stroke: #ffbb00 !important;
}

.marker-selected {
  stroke: #00ff88 !important;
}

/* Mode Toggle */
.mode-toggle {
  display: flex;
  gap: 2px;
  background: var(--bg-primary);
  border-radius: 6px;
  padding: 2px;
  border: 1px solid var(--border-color);
}

.mode-btn {
  padding: 4px 10px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-size: 11px;
  cursor: pointer;
  border-radius: 4px;
  transition: all 0.15s;
}

.mode-btn:hover {
  color: var(--text-primary);
  background: var(--bg-secondary);
}

.mode-btn.active {
  background: var(--accent-blue);
  color: white;
}

.selection-hint-inline {
  color: #00ff88;
  font-style: italic;
}

/* Selection Panel */
.selection-panel {
  width: 300px;
  min-width: 300px;
  background: var(--bg-secondary);
  border: 1px solid #00ff88;
  border-radius: 6px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  max-height: 420px;
  margin-top: 95px; /* Align with map top edge (title + stats + gap) */
  align-self: flex-start;
}

.selection-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 12px;
  background: rgba(0, 255, 136, 0.1);
  border-bottom: 1px solid var(--border-color);
}

.selection-title {
  font-weight: 600;
  font-size: 12px;
  color: var(--text-primary);
}

.selection-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #00ff88;
  color: #1a1a1a;
  min-width: 20px;
  height: 20px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: bold;
  margin-right: 6px;
  padding: 0 6px;
}

.selection-clear {
  background: none;
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  font-size: 10px;
  cursor: pointer;
  padding: 3px 8px;
  border-radius: 3px;
  transition: all 0.15s;
}

.selection-clear:hover {
  border-color: #f65314;
  color: #f65314;
}

.selection-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.selection-item {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 10px;
  background: var(--bg-primary);
  border-radius: 4px;
  border-left: 3px solid #00ff88;
}

.selection-item-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.selection-ip {
  font-family: monospace;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-primary);
}

.selection-meta {
  font-size: 10px;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.selection-value {
  font-size: 10px;
  color: var(--accent-blue);
}

.abuse-badge {
  padding: 1px 4px;
  border-radius: 3px;
  font-size: 9px;
  font-weight: bold;
}

.abuse-badge.high {
  background: rgba(246, 83, 20, 0.2);
  color: #f65314;
}

.abuse-badge.medium {
  background: rgba(255, 187, 0, 0.2);
  color: #ffbb00;
}

.abuse-badge.low {
  background: rgba(0, 161, 241, 0.2);
  color: #00a1f1;
}

.selection-remove {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 16px;
  cursor: pointer;
  padding: 0 4px;
  line-height: 1;
  opacity: 0.6;
  transition: all 0.15s;
}

.selection-remove:hover {
  opacity: 1;
  color: #f65314;
}

.selection-actions {
  padding: 10px 12px;
  border-top: 1px solid var(--border-color);
  background: var(--bg-primary);
}

.btn-investigate {
  width: 100%;
  padding: 10px 16px;
  border: none;
  background: linear-gradient(135deg, #00a1f1, #0078d4);
  color: white;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  border-radius: 6px;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.btn-investigate:hover:not(:disabled) {
  background: linear-gradient(135deg, #00b4ff, #0088e8);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 120, 212, 0.4);
}

.btn-investigate:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* SVG Tooltip */
.svg-tooltip {
  position: fixed;
  padding: 8px 12px;
  background: #1a1a1a;
  border: 1px solid var(--accent-blue);
  border-radius: 4px;
  font-size: 11px;
  color: var(--text-primary);
  pointer-events: none;
  z-index: 1000;
  box-shadow: 0 2px 8px rgba(0,0,0,0.5);
  transition: opacity 0.15s;
}

.geomap-legend {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  font-size: 10px;
  color: var(--text-secondary);
}

.legend-gradient {
  width: 100px;
  height: 12px;
  border-radius: 2px;
}

.legend-label {
  white-space: nowrap;
}

.geomap-footer {
  font-size: 9px;
  color: var(--text-secondary);
  text-align: right;
  margin-top: 4px;
}

/* Enrichment Panel */
.enrichment-panel {
  width: 280px;
  min-width: 280px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  max-height: 420px;
  margin-top: 95px; /* Align with map top edge (title + stats + gap) */
  align-self: flex-start;
}

.enrichment-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  background: var(--bg-primary);
  border-bottom: 1px solid var(--border-color);
}

.enrichment-title {
  font-weight: 600;
  font-size: 12px;
  font-family: monospace;
}

.enrichment-close {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 18px;
  cursor: pointer;
  padding: 0 4px;
  line-height: 1;
}

.enrichment-close:hover {
  color: var(--text-primary);
}

.enrichment-body {
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  font-size: 11px;
  overflow-y: auto;
}

.enrichment-label {
  display: block;
  color: var(--text-secondary);
  font-size: 10px;
  text-transform: uppercase;
  margin-bottom: 2px;
}

.enrichment-value {
  color: var(--text-primary);
  font-weight: 500;
}

.enrichment-nodata {
  color: var(--text-secondary);
  font-style: italic;
}

/* Flags (VPN, Proxy, Tor) */
.enrichment-flags {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.flag {
  padding: 2px 6px;
  border-radius: 3px;
  font-size: 9px;
  font-weight: 600;
  text-transform: uppercase;
}

.flag-vpn {
  background: #5f4b8b;
  color: white;
}

.flag-proxy {
  background: #ff8c00;
  color: white;
}

.flag-tor {
  background: #7d4698;
  color: white;
}

/* Abuse meter */
.abuse-meter {
  position: relative;
  height: 16px;
  background: var(--bg-primary);
  border-radius: 3px;
  overflow: hidden;
}

.abuse-fill {
  height: 100%;
  transition: width 0.3s ease;
}

.abuse-score {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  font-weight: 600;
  font-size: 10px;
  color: white;
  text-shadow: 0 1px 2px rgba(0,0,0,0.5);
}

/* Threat tags */
.threat-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.threat-tag {
  padding: 2px 6px;
  background: rgba(246, 83, 20, 0.2);
  color: #f65314;
  border-radius: 3px;
  font-size: 9px;
}

/* Light mode support */
@media (prefers-color-scheme: light) {
  :root {
    --bg-primary: #ffffff;
    --bg-secondary: #f5f5f5;
    --text-primary: #1a1a1a;
    --text-secondary: #666666;
    --border-color: #e0e0e0;
  }
}
