/* ==========================================================================
   Interactive Global Reach World Map — Mark Maker Engineering
   ========================================================================== */

.map-section {
  padding: 100px 0 80px;
  position: relative;
  overflow: hidden;
}

.map-section::before {
  content: "";
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 90vw;
  height: 500px;
  background: radial-gradient(ellipse at 50% 0%, rgba(0, 200, 255, 0.08) 0%, transparent 70%);
  pointer-events: none;
  z-index: 0;
}

/* --------------------------------------------------------------------------
   KPI Metric Bar
   -------------------------------------------------------------------------- */
.global-kpi-bar {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-top: 36px;
  margin-bottom: 28px;
}

.kpi-stat-card {
  background: rgba(14, 21, 38, 0.6);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: var(--radius-md, 18px);
  padding: 20px 24px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  position: relative;
  overflow: hidden;
  transition: transform 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
}

.kpi-stat-card::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--accent, #00c8ff), transparent);
  opacity: 0.4;
  transition: opacity 0.3s ease;
}

.kpi-stat-card:hover {
  transform: translateY(-3px);
  border-color: rgba(0, 200, 255, 0.3);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.35), 0 0 20px rgba(0, 200, 255, 0.1);
}

.kpi-stat-card:hover::after {
  opacity: 1;
}

.kpi-stat-val {
  font-family: "Plus Jakarta Sans", sans-serif;
  font-size: clamp(2rem, 3vw, 2.75rem);
  font-weight: 800;
  line-height: 1;
  color: #ffffff;
  letter-spacing: -0.02em;
  background: linear-gradient(135deg, #ffffff 40%, var(--accent, #00c8ff) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.kpi-stat-card--hq .kpi-stat-val {
  background: linear-gradient(135deg, #ffffff 40%, #ffb400 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.kpi-stat-lbl {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-muted, #94a3b8);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

/* --------------------------------------------------------------------------
   Global Map Card Container
   -------------------------------------------------------------------------- */
.global-map-card {
  background: rgba(10, 16, 32, 0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(0, 200, 255, 0.18);
  border-radius: var(--radius-lg, 24px);
  overflow: hidden;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6), 0 0 40px rgba(0, 200, 255, 0.08);
  position: relative;
  z-index: 1;
}

/* --------------------------------------------------------------------------
   Map Toolbar: Filters, Search, Action Controls
   -------------------------------------------------------------------------- */
.global-map-toolbar {
  padding: 16px 24px;
  background: rgba(14, 22, 42, 0.7);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.map-filters {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.map-filter-btn {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text-muted, #94a3b8);
  padding: 8px 14px;
  border-radius: 99px;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.25s ease;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.map-filter-btn:hover {
  background: rgba(0, 200, 255, 0.1);
  border-color: rgba(0, 200, 255, 0.4);
  color: #ffffff;
}

.map-filter-btn.active {
  background: rgba(0, 200, 255, 0.2);
  border-color: var(--accent, #00c8ff);
  color: #ffffff;
  box-shadow: 0 0 14px rgba(0, 200, 255, 0.35);
}

.map-filter-btn--hq.active {
  background: rgba(255, 180, 0, 0.2);
  border-color: #ffb400;
  color: #ffb400;
  box-shadow: 0 0 14px rgba(255, 180, 0, 0.35);
}

.map-toolbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.map-search-box {
  position: relative;
  display: flex;
  align-items: center;
}

.map-search-box .search-icon {
  position: absolute;
  left: 12px;
  font-size: 18px;
  color: var(--text-muted, #94a3b8);
  pointer-events: none;
}

.map-search-input {
  background: rgba(7, 11, 22, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 99px;
  padding: 8px 36px 8px 36px;
  font-size: 0.82rem;
  color: #ffffff;
  width: 190px;
  transition: all 0.25s ease;
  outline: none;
}

.map-search-input:focus {
  width: 230px;
  border-color: var(--accent, #00c8ff);
  box-shadow: 0 0 14px rgba(0, 200, 255, 0.3);
}

.map-search-clear {
  position: absolute;
  right: 10px;
  background: none;
  border: none;
  color: var(--text-muted, #94a3b8);
  font-size: 16px;
  cursor: pointer;
  padding: 2px 6px;
  line-height: 1;
  border-radius: 50%;
  display: none;
}

.map-search-clear:hover {
  color: #ffffff;
}

.map-tool-btn {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text-muted, #94a3b8);
  padding: 8px 12px;
  border-radius: 10px;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.25s ease;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.map-tool-btn .material-symbols-outlined {
  font-size: 18px;
}

.map-tool-btn:hover {
  background: rgba(0, 200, 255, 0.12);
  border-color: rgba(0, 200, 255, 0.4);
  color: #ffffff;
}

.map-tool-btn.active {
  background: rgba(0, 200, 255, 0.22);
  border-color: var(--accent, #00c8ff);
  color: #ffffff;
}

/* --------------------------------------------------------------------------
   Map Viewport & SVG Elements
   -------------------------------------------------------------------------- */
.global-map-viewport {
  position: relative;
  width: 100%;
  aspect-ratio: 1000 / 520;
  min-height: 400px;
  background: #03060d;
  overflow: hidden;
  user-select: none;
}

.world-map-svg {
  width: 100%;
  height: 100%;
  display: block;
}

/* Base Non-Export Countries */
.country-shape.is-base {
  fill: #111a2d;
  stroke: rgba(255, 255, 255, 0.06);
  stroke-width: 0.6;
  transition: fill 0.3s ease, opacity 0.3s ease;
}

.country-shape.is-base:hover {
  fill: #16223b;
}

/* Export Countries (20 Nations) */
.country-shape.is-export {
  fill: rgba(0, 200, 255, 0.18);
  stroke: rgba(0, 200, 255, 0.75);
  stroke-width: 1.1;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  filter: drop-shadow(0 0 5px rgba(0, 200, 255, 0.25));
}

.country-shape.is-export:hover,
.country-shape.is-export.is-active {
  fill: rgba(0, 229, 255, 0.45);
  stroke: #00ffff;
  stroke-width: 1.8;
  filter: drop-shadow(0 0 14px rgba(0, 229, 255, 0.8));
}

/* India Global HQ */
.country-shape.is-hq {
  fill: rgba(255, 180, 0, 0.3);
  stroke: #ffb400;
  stroke-width: 1.5;
  filter: drop-shadow(0 0 8px rgba(255, 180, 0, 0.45));
}

.country-shape.is-hq:hover,
.country-shape.is-hq.is-active {
  fill: rgba(255, 180, 0, 0.55);
  stroke: #ffd000;
  stroke-width: 2.2;
  filter: drop-shadow(0 0 16px rgba(255, 180, 0, 0.9));
}

/* Dimmed State when Filtered */
.country-shape.is-dimmed {
  opacity: 0.22;
  filter: none !important;
}

.map-pin.is-dimmed {
  opacity: 0.12;
}

/* Supply Trajectory Arcs */
.export-route {
  fill: none;
  stroke: url(#routeGrad);
  stroke-width: 1.2;
  stroke-dasharray: 6 5;
  opacity: 0.38;
  animation: routeFlow 22s linear infinite;
  pointer-events: none;
  transition: opacity 0.3s ease, stroke-width 0.3s ease;
}

@keyframes routeFlow {
  from {
    stroke-dashoffset: 220;
  }
  to {
    stroke-dashoffset: 0;
  }
}

.export-route.is-active {
  opacity: 1 !important;
  stroke: #00ffff !important;
  stroke-width: 2.4 !important;
  stroke-dasharray: none !important;
  filter: drop-shadow(0 0 10px #00ffff);
  animation: none;
}

.export-route.is-dimmed {
  opacity: 0.08 !important;
}

.map-layer-routes.routes-hidden {
  display: none;
}

/* Markers / Pins */
.map-pin {
  cursor: pointer;
  transition: transform 0.25s ease, opacity 0.3s ease;
}

.map-pin .pin-core {
  fill: #00e5ff;
  stroke: #ffffff;
  stroke-width: 1;
  filter: drop-shadow(0 0 5px #00e5ff);
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), r 0.2s ease;
}

.map-pin:hover .pin-core,
.map-pin.is-active .pin-core {
  r: 5.5;
  fill: #ffffff;
  stroke: #00e5ff;
  stroke-width: 2;
  filter: drop-shadow(0 0 10px #00ffff);
}

.map-pin .pin-glow {
  fill: rgba(0, 229, 255, 0.3);
  pointer-events: none;
}

.map-pin .pin-radar {
  fill: none;
  stroke: rgba(0, 229, 255, 0.7);
  stroke-width: 1.2;
  pointer-events: none;
  animation: pinRadarWave 2.8s cubic-bezier(0.16, 1, 0.3, 1) infinite;
  transform-origin: 0 0;
}

@keyframes pinRadarWave {
  0% {
    r: 3;
    opacity: 1;
  }
  100% {
    r: 18;
    opacity: 0;
  }
}

/* HQ Pin Distinct Styling */
.map-pin.is-hq .pin-core--hq {
  fill: #ffb400;
  stroke: #ffffff;
  stroke-width: 1.5;
  filter: drop-shadow(0 0 8px #ffb400);
}

.map-pin.is-hq .pin-radar--outer {
  stroke: rgba(255, 180, 0, 0.85);
  stroke-width: 1.5;
  animation: hqRadarWaveOuter 2.4s cubic-bezier(0.16, 1, 0.3, 1) infinite;
}

.map-pin.is-hq .pin-radar--inner {
  stroke: rgba(0, 200, 255, 0.85);
  stroke-width: 1.2;
  animation: hqRadarWaveInner 2.4s cubic-bezier(0.16, 1, 0.3, 1) infinite 0.6s;
}

@keyframes hqRadarWaveOuter {
  0% {
    r: 5;
    opacity: 1;
  }
  100% {
    r: 28;
    opacity: 0;
  }
}

@keyframes hqRadarWaveInner {
  0% {
    r: 4;
    opacity: 1;
  }
  100% {
    r: 18;
    opacity: 0;
  }
}

.pin-badge-bg {
  fill: rgba(10, 16, 32, 0.92);
  stroke: #ffb400;
  stroke-width: 1.2;
  filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.6));
}

.pin-badge-text {
  font-family: "Plus Jakarta Sans", sans-serif;
  font-size: 8.5px;
  font-weight: 800;
  fill: #ffb400;
  letter-spacing: 0.08em;
}

/* --------------------------------------------------------------------------
   Floating HUD Tooltip Card
   -------------------------------------------------------------------------- */
.map-hud-tooltip {
  position: absolute;
  z-index: 30;
  width: 320px;
  background: rgba(8, 14, 28, 0.94);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(0, 200, 255, 0.4);
  border-radius: var(--radius-md, 18px);
  padding: 18px 20px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.7), 0 0 30px rgba(0, 200, 255, 0.2);
  pointer-events: none;
  opacity: 0;
  transform: translate(-50%, -100%) scale(0.95);
  transition: opacity 0.2s ease, transform 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  will-change: transform, opacity;
}

.map-hud-tooltip.is-visible {
  opacity: 1;
  transform: translate(-50%, -115%) scale(1);
  pointer-events: auto;
}

.map-hud-tooltip.is-visible.pos-below {
  transform: translate(-50%, 18px) scale(1);
}

.hud-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  padding-bottom: 10px;
}

.hud-title-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
}

.hud-flag {
  font-size: 1.6rem;
  line-height: 1;
}

.hud-country-name {
  font-family: "Plus Jakarta Sans", sans-serif;
  font-size: 1.15rem;
  font-weight: 700;
  color: #ffffff;
  margin: 0;
  line-height: 1.2;
}

.hud-region-badge {
  background: rgba(0, 200, 255, 0.15);
  border: 1px solid rgba(0, 200, 255, 0.35);
  color: var(--accent, #00c8ff);
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 4px 8px;
  border-radius: 99px;
  white-space: nowrap;
}

.hud-region-badge--hq {
  background: rgba(255, 180, 0, 0.18);
  border-color: rgba(255, 180, 0, 0.5);
  color: #ffb400;
}

.hud-status-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  font-size: 0.8rem;
  font-weight: 600;
  color: #38ef7d;
}

.hud-status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #38ef7d;
  box-shadow: 0 0 8px #38ef7d;
  flex-shrink: 0;
}

.hud-status-row--hq {
  color: #ffb400;
}

.hud-status-row--hq .hud-status-dot {
  background: #ffb400;
  box-shadow: 0 0 10px #ffb400;
}

.hud-desc {
  font-size: 0.82rem;
  color: var(--text-muted, #94a3b8);
  line-height: 1.5;
  margin-bottom: 12px;
}

.hud-section-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--accent, #00c8ff);
  font-weight: 700;
  margin-bottom: 4px;
  display: block;
}

.hud-solutions-text {
  font-size: 0.8rem;
  color: #e2e8f0;
  line-height: 1.45;
  background: rgba(255, 255, 255, 0.03);
  padding: 8px 10px;
  border-radius: 8px;
  border-left: 2px solid var(--accent, #00c8ff);
  margin-bottom: 10px;
}

.hud-compliance-tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.75rem;
  color: #cbd5e1;
  font-weight: 500;
}

.hud-compliance-tag .material-symbols-outlined {
  font-size: 15px;
  color: var(--accent, #00c8ff);
}

/* --------------------------------------------------------------------------
   Legend Overlay in Corner
   -------------------------------------------------------------------------- */
.map-legend {
  position: absolute;
  bottom: 16px;
  left: 20px;
  background: rgba(10, 16, 32, 0.85);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 10px 14px;
  display: flex;
  align-items: center;
  gap: 16px;
  pointer-events: none;
  z-index: 10;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.76rem;
  color: var(--text-muted, #94a3b8);
  font-weight: 600;
}

.legend-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  flex-shrink: 0;
}

.legend-dot--hq {
  background: #ffb400;
  box-shadow: 0 0 6px #ffb400;
}

.legend-dot--export {
  background: #00e5ff;
  box-shadow: 0 0 6px #00e5ff;
}

.legend-line {
  width: 16px;
  height: 2px;
  background: linear-gradient(90deg, #ffb400, #00e5ff);
}

/* --------------------------------------------------------------------------
   Country Quick-Select Pills Drawer
   -------------------------------------------------------------------------- */
.map-country-drawer {
  padding: 20px 24px;
  background: rgba(12, 18, 35, 0.9);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.map-country-drawer__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
  flex-wrap: wrap;
  gap: 8px;
}

.drawer-title {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: "Plus Jakarta Sans", sans-serif;
  font-size: 0.95rem;
  font-weight: 700;
  color: #ffffff;
}

.drawer-title .material-symbols-outlined {
  color: var(--accent, #00c8ff);
  font-size: 20px;
}

.drawer-hint {
  font-size: 0.78rem;
  color: var(--text-muted, #94a3b8);
}

.map-country-pills {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 8px;
  scroll-behavior: smooth;
  scrollbar-width: thin;
  scrollbar-color: rgba(0, 200, 255, 0.3) transparent;
}

.map-country-pills::-webkit-scrollbar {
  height: 6px;
}

.map-country-pills::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.04);
  border-radius: 99px;
}

.map-country-pills::-webkit-scrollbar-thumb {
  background: rgba(0, 200, 255, 0.3);
  border-radius: 99px;
}

.map-country-pill {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  padding: 10px 16px;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  flex-shrink: 0;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  color: #ffffff;
}

.map-country-pill:hover {
  background: rgba(0, 200, 255, 0.12);
  border-color: rgba(0, 200, 255, 0.45);
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.3);
}

.map-country-pill.is-active {
  background: rgba(0, 200, 255, 0.22);
  border-color: var(--accent, #00c8ff);
  box-shadow: 0 0 16px rgba(0, 200, 255, 0.4);
  transform: translateY(-2px);
}

.map-country-pill--hq {
  border-color: rgba(255, 180, 0, 0.35);
  background: rgba(255, 180, 0, 0.06);
}

.map-country-pill--hq:hover,
.map-country-pill--hq.is-active {
  background: rgba(255, 180, 0, 0.25);
  border-color: #ffb400;
  box-shadow: 0 0 16px rgba(255, 180, 0, 0.4);
}

.pill-flag {
  font-size: 1.25rem;
  line-height: 1;
}

.pill-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.pill-name {
  font-size: 0.85rem;
  font-weight: 700;
  line-height: 1.2;
}

.pill-region {
  font-size: 0.7rem;
  color: var(--text-muted, #94a3b8);
  font-weight: 500;
}

/* --------------------------------------------------------------------------
   Responsive Styles
   -------------------------------------------------------------------------- */
@media (max-width: 1024px) {
  .global-kpi-bar {
    grid-template-columns: repeat(2, 1fr);
  }

  .map-legend {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
    bottom: 10px;
    left: 10px;
    padding: 8px 10px;
  }
}

@media (max-width: 768px) {
  .map-section {
    padding: 60px 0 50px;
  }

  .global-kpi-bar {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-top: 24px;
    margin-bottom: 20px;
  }

  .kpi-stat-card {
    padding: 16px;
  }

  .global-map-toolbar {
    padding: 12px 16px;
  }

  .map-filters {
    overflow-x: auto;
    width: 100%;
    padding-bottom: 4px;
    flex-wrap: nowrap;
    scrollbar-width: none;
  }

  .map-filters::-webkit-scrollbar {
    display: none;
  }

  .map-toolbar-actions {
    width: 100%;
    justify-content: space-between;
  }

  .map-search-box {
    flex: 1;
  }

  .map-search-input {
    width: 100%;
  }

  .map-search-input:focus {
    width: 100%;
  }

  .global-map-viewport {
    min-height: 320px;
  }

  .map-legend {
    display: none; /* Hide clutter on small screens */
  }

  .map-hud-tooltip {
    width: calc(100% - 32px);
    left: 16px !important;
    bottom: 16px !important;
    top: auto !important;
    transform: none !important;
    border-radius: 14px;
    padding: 14px 16px;
  }

  .map-hud-tooltip.is-visible {
    transform: none !important;
  }
}
