/* ==========================================================================
   PORT 2040 — Port Radar 2.0 (Interactive Global Marine Map & Smart Rerouting)
   ========================================================================== */

:root {
  --map-bg: #040915;
  --map-ocean: #061124;
  --map-land: #0e1c33;
  --map-coast: #1e3a63;
  --map-grid: rgba(74, 168, 255, 0.08);
  --map-shipping-lane: rgba(0, 229, 255, 0.15);

  --radar-surface: #0a1324;
  --radar-surface-elevated: #111e38;
  --radar-border: rgba(2, 132, 199, 0.25);
  --radar-cyan: #00e5ff;
  --radar-green: #00e676;
  --radar-gold: #D4AF37;
  --radar-red: #ff3366;
  --radar-amber: #ffab00;
  --text-main: #f0f4f8;
  --text-muted: #7e95b3;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body.radar-theme {
  background: var(--map-bg);
  color: var(--text-main);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  height: 100vh;
  overflow: hidden;
}

.radar-layout {
  display: grid;
  grid-template-columns: 1fr 410px;
  height: calc(100vh - 52px);
  position: relative;
}

/* Main Global Map Panel */
.radar-map-panel {
  display: flex;
  flex-direction: column;
  background: var(--map-bg);
  position: relative;
  overflow: hidden;
}

/* Interactive Filter & Action Header */
.radar-control-bar {
  background: rgba(10, 19, 36, 0.88);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--radar-border);
  padding: 10px 18px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  z-index: 20;
}

.radar-filter-group {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.radar-select, .radar-search-input {
  background: var(--radar-surface-elevated);
  border: 1px solid var(--radar-border);
  color: var(--text-main);
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 11px;
  outline: none;
  transition: all 0.2s ease;
}

.radar-select:focus, .radar-search-input:focus {
  border-color: var(--radar-cyan);
  box-shadow: 0 0 8px rgba(0, 229, 255, 0.25);
}

.radar-search-input {
  width: 160px;
}

.radar-stats-badge {
  background: rgba(0, 229, 255, 0.08);
  border: 1px solid rgba(0, 229, 255, 0.3);
  padding: 5px 12px;
  border-radius: 6px;
  font-size: 11px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.radar-stats-badge strong {
  color: var(--radar-cyan);
  font-size: 14px;
}

.btn-history-global {
  background: rgba(212, 175, 55, 0.15);
  border: 1px solid var(--radar-gold);
  color: var(--radar-gold);
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s ease;
}

.btn-history-global:hover {
  background: var(--radar-gold);
  color: #000;
}

/* World Map Canvas Viewport */
.radar-canvas-container {
  flex: 1;
  position: relative;
  width: 100%;
  height: 100%;
  background: radial-gradient(circle at 50% 50%, var(--map-ocean) 0%, var(--map-bg) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  user-select: none;
}

#radar-canvas {
  width: 100%;
  height: 100%;
  display: block;
  cursor: grab;
}

#radar-canvas:active {
  cursor: grabbing;
}

/* Map Navigation Floating Controls (Zoom / Presets) */
.map-view-controls {
  position: absolute;
  top: 14px;
  right: 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  z-index: 15;
}

.map-ctrl-btn {
  background: rgba(10, 19, 36, 0.9);
  border: 1px solid var(--radar-border);
  color: #fff;
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  backdrop-filter: blur(8px);
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 6px;
}

.map-ctrl-btn:hover {
  background: #14284b;
  border-color: var(--radar-cyan);
  color: var(--radar-cyan);
}

/* Floating Overlay HUD over Canvas */
.radar-hud-overlay {
  position: absolute;
  top: 14px;
  left: 14px;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 15;
}

.hud-pill {
  background: rgba(6, 12, 24, 0.88);
  border: 1px solid var(--radar-border);
  backdrop-filter: blur(8px);
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 10px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 8px;
}

.hud-pill strong {
  color: var(--radar-cyan);
}

/* Floating Legend on Bottom Left */
.radar-legend {
  position: absolute;
  bottom: 14px;
  left: 14px;
  background: rgba(6, 12, 24, 0.9);
  border: 1px solid var(--radar-border);
  backdrop-filter: blur(8px);
  padding: 8px 14px;
  border-radius: 8px;
  display: flex;
  gap: 12px;
  font-size: 10px;
  color: var(--text-muted);
  z-index: 10;
  flex-wrap: wrap;
}

.legend-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
  margin-right: 4px;
}

/* Tooltip on Hover */
.radar-tooltip {
  position: absolute;
  background: rgba(10, 19, 36, 0.95);
  border: 1px solid var(--radar-cyan);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(10px);
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 11px;
  color: #fff;
  pointer-events: none;
  display: none;
  z-index: 100;
  max-width: 280px;
  line-height: 1.4;
}

/* Radar Sidebar */
.radar-sidebar {
  background: var(--radar-surface);
  border-left: 1px solid var(--radar-border);
  display: flex;
  flex-direction: column;
  height: calc(100vh - 52px);
  overflow: hidden;
}

.sidebar-header {
  padding: 14px 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.02);
}

.sidebar-header h2 {
  font-size: 14px;
  margin: 0 0 4px 0;
  color: #fff;
  display: flex;
  justify-content: space-between;
}

.sidebar-header p {
  font-size: 11px;
  color: var(--text-muted);
}

.vessels-list {
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow-y: auto;
  flex: 1;
}

.vessel-card {
  background: var(--radar-surface-elevated);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 8px;
  padding: 10px 12px;
  cursor: pointer;
  transition: all 0.15s ease;
  border-left: 3px solid var(--radar-cyan);
}

.vessel-card:hover, .vessel-card.active {
  border-color: var(--radar-cyan);
  background: rgba(0, 229, 255, 0.08);
  transform: translateX(2px);
}

.vessel-card.qatar-vessel {
  border-left-color: var(--radar-gold);
}

.vessel-card.breach-alert {
  border-left-color: var(--radar-red);
  background: rgba(255, 51, 102, 0.08);
}

.vessel-card.reroute-recommend {
  border-left-color: var(--radar-green);
  box-shadow: 0 0 10px rgba(0, 230, 118, 0.15);
}

.vessel-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
}

.vessel-name-title {
  font-size: 12px;
  font-weight: 800;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 4px;
}

.status-tag {
  font-size: 9px;
  font-weight: 800;
  padding: 2px 6px;
  border-radius: 4px;
  text-transform: uppercase;
}

.status-tag.ON_TIME { background: rgba(0, 230, 118, 0.15); color: var(--radar-green); }
.status-tag.QATAR_LNG { background: rgba(138, 21, 56, 0.4); color: var(--radar-gold); border: 1px solid var(--radar-gold); }
.status-tag.WINDOW_BREACH_ALERT { background: rgba(255, 51, 102, 0.2); color: var(--radar-red); }
.status-tag.MANEUVERING { background: rgba(0, 229, 255, 0.15); color: var(--radar-cyan); }
.status-tag.REROUTE_SAVINGS { background: rgba(0, 230, 118, 0.2); color: var(--radar-green); border: 1px solid var(--radar-green); }

.vessel-card-meta, .vessel-card-telemetry {
  font-size: 11px;
  color: var(--text-muted);
  display: flex;
  justify-content: space-between;
  margin-top: 2px;
}

.reroute-badge-inline {
  margin-top: 6px;
  background: rgba(0, 230, 118, 0.08);
  border: 1px solid rgba(0, 230, 118, 0.3);
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 10px;
  color: var(--radar-green);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* Modal Tabs Header */
.modal-tabs-header {
  display: flex;
  background: rgba(0, 0, 0, 0.3);
  border-bottom: 1px solid var(--radar-border);
}

.modal-tab-btn {
  flex: 1;
  padding: 10px 14px;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
  background: none;
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
  border-bottom: 2px solid transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.modal-tab-btn:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.03);
}

.modal-tab-btn.active {
  color: var(--radar-cyan);
  border-bottom-color: var(--radar-cyan);
  background: rgba(0, 229, 255, 0.06);
}

/* Vessel Modal & Rerouting Simulator */
.vessel-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  z-index: 99999;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.vessel-modal-overlay.open {
  display: flex;
}

.vessel-modal {
  background: var(--radar-surface);
  border: 1px solid var(--radar-cyan);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.8), 0 0 30px rgba(0, 229, 255, 0.15);
  border-radius: 12px;
  width: 100%;
  max-width: 640px;
  overflow: hidden;
}

.vessel-modal-header {
  padding: 14px 18px;
  background: rgba(255, 255, 255, 0.03);
  border-bottom: 1px solid var(--radar-border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.vessel-modal-body {
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  max-height: 75vh;
  overflow-y: auto;
}

.vessel-grid-details {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.detail-item {
  background: var(--radar-surface-elevated);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 6px;
  padding: 8px 10px;
}

.detail-item .lbl {
  font-size: 9px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
}

.detail-item .val {
  font-size: 13px;
  font-weight: 800;
  color: #fff;
  margin-top: 2px;
}

/* Rerouting Arbitrage Box inside Modal */
.rerouting-box {
  background: rgba(0, 230, 118, 0.06);
  border: 1px solid var(--radar-green);
  border-radius: 8px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.rerouting-heading {
  font-size: 12px;
  font-weight: 800;
  color: var(--radar-green);
  display: flex;
  align-items: center;
  gap: 6px;
}

.arbitrage-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.arb-card {
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(0, 230, 118, 0.3);
  border-radius: 6px;
  padding: 8px;
  text-align: center;
}

.arb-card .l {
  font-size: 9px;
  color: var(--text-muted);
  font-weight: 700;
  text-transform: uppercase;
}

.arb-card .v {
  font-size: 14px;
  font-weight: 900;
  color: #fff;
  margin-top: 2px;
}

.btn-reroute-accept {
  background: linear-gradient(135deg, #059669, #10b981);
  color: #fff;
  border: none;
  padding: 10px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
  transition: all 0.2s ease;
  width: 100%;
}

.btn-reroute-accept:hover {
  filter: brightness(1.15);
}

/* 2025-2026 Voyage History Timeline Elements */
.voyage-timeline {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.voyage-card {
  background: var(--radar-surface-elevated);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  position: relative;
}

.voyage-card.rerouted {
  border-color: rgba(255, 171, 0, 0.4);
  background: rgba(255, 171, 0, 0.04);
}

.voyage-card-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.voyage-year-badge {
  font-size: 11px;
  font-weight: 900;
  padding: 2px 8px;
  border-radius: 4px;
  background: rgba(0, 229, 255, 0.15);
  color: var(--radar-cyan);
}

.voyage-route-tag {
  font-size: 10px;
  font-weight: 800;
  padding: 3px 8px;
  border-radius: 4px;
}

.voyage-route-tag.DIRECT {
  background: rgba(0, 230, 118, 0.15);
  color: var(--radar-green);
}

.voyage-route-tag.REROUTED {
  background: rgba(255, 171, 0, 0.2);
  color: var(--radar-amber);
  border: 1px solid var(--radar-amber);
}

.voyage-ports-flow {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  font-weight: 800;
  color: #fff;
}

.voyage-port-pill {
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 4px 10px;
  border-radius: 6px;
}

.voyage-arrow {
  color: var(--radar-cyan);
  font-size: 16px;
}

.voyage-cargo-info {
  font-size: 11px;
  color: var(--text-muted);
  display: flex;
  justify-content: space-between;
}

.voyage-reroute-details {
  background: rgba(0, 0, 0, 0.3);
  border-left: 3px solid var(--radar-amber);
  padding: 8px 10px;
  border-radius: 4px;
  font-size: 11px;
  color: #f1f5f9;
  line-height: 1.4;
}

/* Status tags for Live Maritime Flow */
.status-tag.DEPARTED_BRAZIL { background: rgba(192, 132, 252, 0.2); color: #c084fc; border: 1px solid #c084fc; }
.status-tag.OPERATING { background: rgba(56, 189, 248, 0.2); color: #38bdf8; border: 1px solid #38bdf8; }
.status-tag.ANCHORED { background: rgba(251, 146, 60, 0.2); color: #fb923c; border: 1px solid #fb923c; }

.vessel-card.departed-vessel {
  border-left-color: #c084fc;
  background: rgba(192, 132, 252, 0.05);
}

.vessel-card.operating-vessel {
  border-left-color: #38bdf8;
  background: rgba(56, 189, 248, 0.04);
}

.vessel-card.anchored-vessel {
  border-left-color: #fb923c;
  background: rgba(251, 146, 60, 0.04);
}

@keyframes pulseLive {
  0% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.3; transform: scale(1.25); }
  100% { opacity: 1; transform: scale(1); }
}

.live-pulse-dot {
  display: inline-block;
  animation: pulseLive 2s infinite ease-in-out;
}

/* 24h Movement Modal Styles */
.movement-modal-dialog {
  max-width: 920px !important;
  width: 95% !important;
}

.movement-metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.movement-metric-card {
  background: var(--radar-surface-elevated);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  padding: 12px;
  text-align: center;
}

.movement-metric-card .num {
  font-size: 20px;
  font-weight: 900;
  margin-top: 4px;
}

@media (max-width: 1024px) {
  .radar-layout {
    grid-template-columns: 1fr;
    height: auto;
  }
  .radar-sidebar {
    height: 450px;
  }
  .radar-canvas-container {
    height: 550px;
  }
}

/* 🏗️ Enterprice Logistics Project Cargo Modal & Badges */
.project-cargo-modal-dialog {
  max-width: 980px !important;
  width: 94vw !important;
  border-color: rgba(245, 158, 11, 0.4) !important;
  box-shadow: 0 0 35px rgba(245, 158, 11, 0.25) !important;
}

.modal-tab-btn[data-filter="TRANSFORMADORES"]:hover,
.modal-tab-btn[data-filter="EOLICA"]:hover,
.modal-tab-btn[data-filter="OFFSHORE"]:hover {
  border-color: #fbbf24 !important;
  color: #fbbf24 !important;
}
