/* Modern Hydrographic Survey Dashboard Theme */
:root {
  --bg-dark: #0f172a;
  --bg-panel: #1e293b;
  --bg-card: #273549;
  --bg-input: #0f172a;
  --border-color: #334155;
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --accent-cyan: #06b6d4;
  --accent-blue: #3b82f6;
  --accent-emerald: #10b981;
  --accent-amber: #f59e0b;
  --accent-rose: #f43f5e;
  --line-cyan: #22d3ee;
  --turn-amber: #fbbf24;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.25);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.35);
  --font-main: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
}

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

body {
  font-family: var(--font-main);
  background-color: var(--bg-dark);
  color: var(--text-primary);
  height: 100vh;
  overflow: hidden;
}

/* App Container */
.app-container {
  display: flex;
  flex-direction: column;
  height: 100vh;
}

/* Header */
.app-header {
  height: 56px;
  background-color: var(--bg-panel);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  z-index: 1000;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo-icon {
  font-size: 24px;
  color: var(--accent-cyan);
}

.header-left h1 {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.3px;
}

.subtitle {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 400;
}

.header-right {
  display: flex;
  gap: 12px;
}

.header-badge {
  background: var(--bg-card);
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  border: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  gap: 6px;
}

.header-badge.highlight {
  border-color: var(--accent-cyan);
  color: var(--accent-cyan);
  background: rgba(6, 182, 212, 0.1);
}

.header-badge strong, .header-badge span {
  font-family: var(--font-mono);
  font-weight: 600;
}

/* Main Workspace */
.main-workspace {
  display: flex;
  flex: 1;
  height: calc(100vh - 56px);
  position: relative;
}

/* Sidebar */
.sidebar {
  width: 420px;
  min-width: 380px;
  background: var(--bg-panel);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  z-index: 500;
  overflow: hidden;
}

/* Tabs */
.tabs {
  display: flex;
  background: var(--bg-dark);
  border-bottom: 1px solid var(--border-color);
}

.tab-btn {
  flex: 1;
  padding: 12px 6px;
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all 0.2s;
  border-bottom: 2px solid transparent;
}

.tab-btn:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.03);
}

.tab-btn.active {
  color: var(--accent-cyan);
  border-bottom-color: var(--accent-cyan);
  background: var(--bg-panel);
}

/* Tab Contents */
.tab-contents {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.tab-pane {
  display: none;
  flex-direction: column;
  gap: 14px;
}

.tab-pane.active {
  display: flex;
}

/* Param Card */
.param-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.param-card.highlight-card {
  background: linear-gradient(135deg, rgba(6, 182, 212, 0.12), rgba(30, 41, 59, 0.8));
  border-color: var(--accent-cyan);
}

.card-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--accent-cyan);
  display: flex;
  align-items: center;
  gap: 8px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.card-help {
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.4;
}

/* Form Controls */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.form-group label {
  font-size: 12px;
  color: var(--text-secondary);
  font-weight: 500;
}

.label-with-val {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.range-val {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--accent-cyan);
  font-weight: 600;
}

.form-control {
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  font-size: 13px;
  font-family: var(--font-main);
  outline: none;
  transition: border-color 0.2s;
}

.form-control:focus {
  border-color: var(--accent-cyan);
}

.form-range {
  accent-color: var(--accent-cyan);
  height: 6px;
  cursor: pointer;
}

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }

/* Radio & Checkbox */
.radio-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.radio-label, .checkbox-label {
  font-size: 12px;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}

/* Model Metadata Box */
.model-meta-box {
  background: rgba(15, 23, 42, 0.6);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  font-size: 11px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.meta-row {
  display: flex;
  justify-content: space-between;
}

.meta-row span {
  color: var(--text-muted);
}

.meta-row strong {
  font-family: var(--font-mono);
  color: var(--text-primary);
}

/* Swath Calculation Badge */
.swath-calc-badge {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  background: rgba(15, 23, 42, 0.7);
  padding: 8px;
  border-radius: var(--radius-sm);
  border: 1px dashed var(--border-color);
}

.calc-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.calc-item span {
  font-size: 10px;
  color: var(--text-muted);
}

.calc-item strong {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--accent-emerald);
}

/* IHO Box */
.iho-feedback-box {
  background: rgba(15, 23, 42, 0.6);
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  font-size: 11px;
}

.iho-desc {
  color: var(--text-secondary);
  font-size: 11px;
  line-height: 1.3;
}

.btn-micro {
  background: var(--accent-cyan);
  color: var(--bg-dark);
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border: none;
  border-radius: 4px;
  cursor: pointer;
}

/* Buttons */
.btn {
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.2s;
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent-cyan), var(--accent-blue));
  color: #fff;
  box-shadow: var(--shadow-sm);
}

.btn-primary:hover {
  opacity: 0.95;
  transform: translateY(-1px);
}

.btn-secondary {
  background: var(--bg-card);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
}

.btn-block { width: 100%; }
.btn-lg { padding: 12px; font-size: 14px; }
.btn-sm { padding: 6px 10px; font-size: 12px; }

/* File Dropzone */
.file-dropzone {
  border: 2px dashed var(--border-color);
  border-radius: var(--radius-md);
  padding: 24px 16px;
  text-align: center;
  cursor: pointer;
  background: rgba(15, 23, 42, 0.4);
  transition: all 0.2s;
}

.file-dropzone:hover {
  border-color: var(--accent-cyan);
  background: rgba(6, 182, 212, 0.05);
}

.drop-icon {
  font-size: 32px;
  color: var(--accent-cyan);
  margin-bottom: 8px;
}

.file-dropzone p {
  font-size: 12px;
  color: var(--text-secondary);
}

.file-ext {
  font-size: 10px;
  color: var(--text-muted);
}

.dtm-info-box {
  background: rgba(15, 23, 42, 0.8);
  border-radius: var(--radius-sm);
  padding: 10px;
  font-size: 12px;
}

.dtm-info-header {
  font-weight: 600;
  color: var(--accent-emerald);
  margin-bottom: 6px;
}

/* Grand Time Display */
.grand-time-display {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 12px;
  background: rgba(15, 23, 42, 0.7);
  border-radius: var(--radius-sm);
}

.time-label {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
}

.time-val {
  font-family: var(--font-mono);
  font-size: 24px;
  color: var(--accent-cyan);
  margin-top: 4px;
}

.time-breakdown {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 6px;
}

.breakdown-item {
  background: rgba(15, 23, 42, 0.5);
  padding: 6px 8px;
  border-radius: var(--radius-sm);
  display: flex;
  flex-direction: column;
  align-items: center;
}

.breakdown-item span {
  font-size: 10px;
  color: var(--text-muted);
}

.breakdown-item strong {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-primary);
}

/* Stats Table */
.stats-table {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 12px;
}

.stat-row {
  display: flex;
  justify-content: space-between;
  padding: 4px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.stat-row span {
  color: var(--text-secondary);
}

.stat-row strong {
  font-family: var(--font-mono);
}

.stat-row.highlight {
  color: var(--accent-emerald);
  font-weight: 700;
  border-top: 1px solid var(--border-color);
  padding-top: 6px;
}

/* Export Buttons */
.export-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.btn-export {
  padding: 10px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid transparent;
  color: #fff;
  transition: all 0.2s;
}

.btn-export.hypack {
  background: #1e3a8a;
  border-color: #3b82f6;
}
.btn-export.hypack:hover { background: #1d4ed8; }

.btn-export.dxf {
  background: #7c2d12;
  border-color: #f97316;
}
.btn-export.dxf:hover { background: #9a3412; }

.btn-export.geojson {
  background: #064e3b;
  border-color: #10b981;
}
.btn-export.geojson:hover { background: #047857; }

.btn-export.qgc {
  background: #0c4a6e;
  border-color: #0284c7;
}
.btn-export.qgc:hover { background: #0369a1; }

.btn-export.mp {
  background: #431407;
  border-color: #ea580c;
}
.btn-export.mp:hover { background: #c2410c; }

.form-text-muted {
  font-size: 11px;
  color: var(--text-muted);
  display: block;
  margin-top: 4px;
  line-height: 1.4;
}

/* Right Map View */
.map-view {
  flex: 1;
  position: relative;
  height: 100%;
}

#map {
  width: 100%;
  height: 100%;
  background: #bfe2f7; /* OpenCPN nautical water blue */
}

.leaflet-container {
  background: #bfe2f7 !important;
}

.opencpn-tile {
  filter: saturate(0.95) contrast(1.05);
}

/* Floating Controls on Map */
.map-floating-panel {
  position: absolute;
  top: 16px;
  left: 60px;
  z-index: 800;
  background: rgba(30, 41, 59, 0.9);
  backdrop-filter: blur(8px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 8px 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  box-shadow: var(--shadow-md);
}

.preset-selector {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
}

.preset-selector span {
  color: var(--accent-cyan);
  font-weight: 600;
}

.btn-preset {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  font-size: 11px;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s;
}

.btn-preset:hover {
  background: var(--accent-cyan);
  color: var(--bg-dark);
  font-weight: 600;
}

.map-hint {
  font-size: 11px;
  color: var(--text-muted);
}

/* Map Legend */
.map-legend {
  position: absolute;
  bottom: 24px;
  right: 24px;
  z-index: 800;
  background: rgba(30, 41, 59, 0.9);
  backdrop-filter: blur(8px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  box-shadow: var(--shadow-md);
  font-size: 11px;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
}

.legend-color {
  width: 14px;
  height: 4px;
  border-radius: 2px;
}

.legend-color.boundary { background: #facc15; border: 1px dashed #ca8a04; height: 10px; width: 14px; }
.legend-color.opencpn-land { background: #d8c68c; border: 1px solid #b45309; height: 10px; width: 14px; }
.legend-color.line { background: var(--line-cyan); height: 3px; }
.legend-color.turn { background: var(--turn-amber); height: 2px; border-style: dotted; }
.legend-color.coast { background: #f59e0b; height: 3px; }
.legend-color.coast-buffer { background: rgba(239, 68, 68, 0.4); border: 1px dashed #ef4444; height: 8px; width: 14px; }
.legend-color.tie { background: var(--accent-rose); height: 3px; }

.highlight-coast-card {
  border-left: 3px solid #f59e0b;
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.06), transparent);
}

.coast-safety-badge {
  background: rgba(15, 23, 42, 0.7);
  border: 1px dashed #f59e0b;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  color: var(--text-secondary);
}

.coast-safety-badge strong {
  color: #fbbf24;
  font-family: var(--font-mono);
  margin-left: 4px;
}


/* Custom Leaflet Line Label Tooltip */
.line-label-tooltip {
  background: rgba(15, 23, 42, 0.85);
  border: 1px solid var(--accent-cyan);
  color: #fff;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  padding: 1px 4px;
  border-radius: 3px;
  box-shadow: none;
}

.leaflet-tooltip-left:before, .leaflet-tooltip-right:before {
  display: none;
}

/* Cross section canvas */
#cross-section-canvas {
  width: 100%;
  height: 140px;
  background: #0f172a;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
}

/* Quick Calculator Styling (capt-clay10 feature) */
.qc-result-box {
  background: rgba(15, 23, 42, 0.7);
  border: 1px solid var(--accent-cyan);
  border-radius: var(--radius-md);
  padding: 12px;
  animation: fadeIn 0.3s ease-in-out;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}


/* S-57 ENC & Depth Indicators */
.depth-source-indicator {
  font-size: 11px;
  color: var(--text-secondary);
  background: rgba(15, 23, 42, 0.6);
  padding: 6px 8px;
  border-radius: var(--radius-sm);
  margin-top: 4px;
}

.depth-source-indicator strong {
  color: var(--accent-cyan);
}

.s57-info-box, .geotiff-info-box {
  background: rgba(15, 23, 42, 0.7);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 10px;
}

.sounding-tooltip {
  background: rgba(15, 23, 42, 0.9);
  border: 1px solid #38bdf8;
  color: #38bdf8;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  padding: 2px 4px;
  border-radius: 3px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.5);
}

.legend-color.sounding {
  background: #38bdf8;
  height: 6px;
  width: 6px;
  border-radius: 50%;
  border: 1px solid #0284c7;
}

.btn-preset.highlight {
  border-color: #38bdf8;
  color: #38bdf8;
  background: rgba(56, 189, 248, 0.1);
  font-weight: 700;
}


/* Azimuth & Compass Dial Controls */
.azimuth-mode-selector {
  display: flex;
  gap: 6px;
  background: var(--bg-dark);
  padding: 4px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
}

.btn-mode {
  flex: 1;
  padding: 7px 8px;
  font-size: 11px;
  font-weight: 600;
  background: transparent;
  color: var(--text-secondary);
  border: none;
  border-radius: 4px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all 0.2s;
}

.btn-mode.active {
  background: var(--accent-cyan);
  color: var(--bg-dark);
  font-weight: 700;
}

.azimuth-control-box {
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 12px;
}

.azimuth-display-row {
  display: flex;
  align-items: center;
  gap: 16px;
}

.compass-dial-box {
  width: 68px;
  height: 68px;
  position: relative;
  flex-shrink: 0;
}

.compass-ring {
  width: 68px;
  height: 68px;
  border: 2px solid var(--border-color);
  border-radius: 50%;
  position: relative;
  background: radial-gradient(circle, #1e293b 40%, #0f172a 100%);
  box-shadow: inset 0 0 6px rgba(0, 0, 0, 0.6);
}

.compass-needle {
  position: absolute;
  top: 6px;
  left: 31px;
  width: 4px;
  height: 52px;
  background: linear-gradient(to bottom, #ef4444 50%, #38bdf8 50%);
  border-radius: 2px;
  transform-origin: center center;
  transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 0 4px rgba(0, 0, 0, 0.8);
}

.compass-label-n, .compass-label-e, .compass-label-s, .compass-label-w {
  position: absolute;
  font-size: 8px;
  font-weight: 700;
  color: var(--text-muted);
}
.compass-label-n { top: 2px; left: 30px; color: #ef4444; }
.compass-label-s { bottom: 2px; left: 30px; }
.compass-label-e { top: 28px; right: 4px; }
.compass-label-w { top: 28px; left: 4px; }

.azimuth-inputs {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.azimuth-num-group {
  display: flex;
  align-items: center;
  gap: 4px;
}

.azimuth-num-group input {
  font-family: var(--font-mono);
  font-size: 16px;
  font-weight: 700;
  color: var(--accent-cyan);
  padding: 6px 10px;
}

.unit-deg {
  font-family: var(--font-mono);
  font-size: 16px;
  color: var(--text-secondary);
}

.azimuth-dir-name {
  font-size: 11px;
  color: var(--accent-cyan);
  font-weight: 600;
}

.azimuth-pills {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
}

.pill-btn {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  font-size: 10px;
  font-weight: 600;
  padding: 5px 2px;
  border-radius: 4px;
  cursor: pointer;
  text-align: center;
  transition: all 0.2s;
}

.pill-btn:hover, .pill-btn.active {
  background: rgba(6, 182, 212, 0.15);
  border-color: var(--accent-cyan);
  color: var(--accent-cyan);
}

/* Turning Radius Enhanced Controls */
.input-with-unit {
  position: relative;
  display: flex;
  align-items: center;
}

.input-with-unit input {
  padding-right: 28px;
  font-family: var(--font-mono);
  font-weight: 700;
  color: var(--accent-emerald);
}

.input-with-unit .unit-label {
  position: absolute;
  right: 10px;
  font-size: 11px;
  color: var(--text-muted);
}

.turn-diameter-badge {
  background: rgba(15, 23, 42, 0.7);
  border: 1px dashed var(--border-color);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  color: var(--text-secondary);
}

.turn-diameter-badge strong {
  color: var(--accent-emerald);
  font-family: var(--font-mono);
  margin-left: 4px;
}

.turn-geometry-info {
  font-size: 11px;
  color: var(--text-muted);
  background: rgba(15, 23, 42, 0.5);
  padding: 6px 8px;
  border-radius: var(--radius-sm);
  margin-top: 6px;
  line-height: 1.4;
}

.turn-geometry-info strong {
  color: #fbbf24;
}

/* ==========================================================================
   Viewport Depth Recommendation & Map HUD Styling
   ========================================================================== */

/* Pulsing Live Dot Animation */
.badge-live-pulse {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: rgba(14, 165, 233, 0.15);
  color: #38bdf8;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 9999px;
  letter-spacing: 0.5px;
  border: 1px solid rgba(56, 189, 248, 0.35);
}

.badge-live-pulse::before {
  content: "";
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #38bdf8;
  box-shadow: 0 0 8px #38bdf8;
  animation: pulse-ring 1.8s infinite;
}

@keyframes pulse-ring {
  0% { transform: scale(0.9); opacity: 1; }
  50% { transform: scale(1.3); opacity: 0.5; }
  100% { transform: scale(0.9); opacity: 1; }
}

/* Viewport Recommendation in Tab 1 (Params) */
.viewport-rec-box {
  background: linear-gradient(135deg, rgba(14, 165, 233, 0.1), rgba(15, 23, 42, 0.7));
  border: 1px solid rgba(56, 189, 248, 0.35);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  transition: all 0.2s ease;
}

.viewport-rec-box:hover {
  border-color: rgba(56, 189, 248, 0.6);
  box-shadow: 0 2px 8px rgba(14, 165, 233, 0.15);
}

.vp-rec-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11px;
  color: var(--text-secondary);
}

.vp-rec-body {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 4px;
}

.vp-rec-val-group {
  display: flex;
  align-items: baseline;
  gap: 6px;
}

.vp-rec-val {
  font-family: var(--font-mono);
  font-size: 1.2rem;
  font-weight: 700;
  color: #38bdf8;
}

.vp-rec-sub {
  font-size: 11px;
  color: var(--text-muted);
}

.btn-xs {
  padding: 4px 8px;
  font-size: 11px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  cursor: pointer;
}

.vp-rec-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 6px;
  padding-top: 4px;
  border-top: 1px dashed rgba(255, 255, 255, 0.08);
}

.vp-rec-footer .checkbox-label.micro {
  font-size: 10.5px;
  color: var(--text-muted);
}

.vp-rec-count {
  font-size: 10.5px;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

/* Tab 2 Cards */
.viewport-depth-card {
  background: rgba(14, 165, 233, 0.08);
  border: 1px solid rgba(56, 189, 248, 0.3);
  border-radius: var(--radius-sm);
  padding: 10px;
}

.polygon-depth-card {
  background: rgba(245, 158, 11, 0.06);
  border: 1px solid rgba(245, 158, 11, 0.25);
  border-radius: var(--radius-sm);
  padding: 10px;
}

.vp-card-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-primary);
}

.overall-chart-details {
  background: rgba(15, 23, 42, 0.4);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  font-size: 11px;
}

.overall-chart-details summary {
  cursor: pointer;
  color: var(--text-muted);
  user-select: none;
}

.overall-chart-details summary:hover {
  color: var(--text-secondary);
}

/* Floating Viewport Depth HUD on Map */
.viewport-depth-hud {
  position: absolute;
  top: 76px;
  right: 16px;
  z-index: 850;
  width: 220px;
  background: rgba(15, 23, 42, 0.88);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(56, 189, 248, 0.35);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.6);
  transition: all 0.25s ease;
}

.viewport-depth-hud:hover {
  border-color: rgba(56, 189, 248, 0.6);
  box-shadow: 0 12px 30px rgba(14, 165, 233, 0.2);
}

.hud-top-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}

.hud-live-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 9px;
  font-weight: 700;
  color: #38bdf8;
  background: rgba(56, 189, 248, 0.15);
  padding: 1px 5px;
  border-radius: 9999px;
}

.pulse-dot {
  width: 5px;
  height: 5px;
  background: #38bdf8;
  border-radius: 50%;
  box-shadow: 0 0 6px #38bdf8;
  animation: pulse-ring 1.5s infinite;
}

.hud-title {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 5px;
}

.hud-count-tag {
  font-size: 10px;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

.hud-main-val {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding: 2px 0 4px 0;
}

.hud-val-group {
  display: flex;
  align-items: baseline;
  gap: 2px;
}

.hud-num {
  font-family: var(--font-mono);
  font-size: 1.5rem;
  font-weight: 800;
  color: #38bdf8;
  line-height: 1;
}

.hud-unit {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  margin-left: 2px;
}

.hud-badge-rec {
  font-size: 10px;
  font-weight: 600;
  color: #94a3b8;
  background: rgba(255, 255, 255, 0.08);
  padding: 2px 6px;
  border-radius: 4px;
}

.hud-sub-stats {
  font-size: 10.5px;
  color: var(--text-muted);
  display: flex;
  justify-content: space-between;
  margin-bottom: 8px;
}

.hud-sub-stats b {
  color: var(--text-primary);
  font-family: var(--font-mono);
}

.hud-actions-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding-top: 6px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.btn-hud-apply {
  flex: 1;
  background: #0284c7;
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  padding: 4px 8px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  transition: all 0.2s;
}

.btn-hud-apply:hover {
  background: #0ea5e9;
  box-shadow: 0 0 10px rgba(14, 165, 233, 0.4);
}

.hud-auto-label {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 10px;
  color: var(--text-muted);
  cursor: pointer;
  user-select: none;
}


/* Real-Time Floating Nautical Coordinate Balloon (dd mm.mmm) */
.mouse-coord-tooltip {
  position: absolute;
  z-index: 1200;
  pointer-events: none; /* Mouse clicks pass through cleanly to map */
  background: rgba(15, 23, 42, 0.92);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(56, 189, 248, 0.6);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4), 0 0 12px rgba(56, 189, 248, 0.25);
  border-radius: 6px;
  padding: 5px 10px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11.5px;
  color: #ffffff;
  white-space: nowrap;
  transform: translate(16px, 16px); /* Offset smoothly next to mouse cursor */
  transition: opacity 0.1s ease-out;
}

.mouse-coord-tooltip::before {
  content: "";
  position: absolute;
  top: -5px;
  left: 6px;
  width: 0;
  height: 0;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-bottom: 5px solid rgba(56, 189, 248, 0.7);
}

.mouse-coord-tooltip .coord-dm-line {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  color: #38bdf8;
}

.mouse-coord-tooltip .coord-tag {
  color: #facc15;
  font-size: 11px;
}

.mouse-coord-tooltip .coord-deg-line {
  font-size: 9.5px;
  color: #94a3b8;
  margin-top: 2px;
  padding-left: 18px;
}


/* ==========================================================================
   Interactive Survey Line Rotation Gizmo & Polygon Context Menu
   ========================================================================== */

/* Custom Polygon Context Menu */
.polygon-context-menu {
  position: absolute;
  z-index: 99999;
  background: rgba(15, 23, 42, 0.94);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(56, 189, 248, 0.35);
  border-radius: 8px;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.6), 0 0 15px rgba(56, 189, 248, 0.2);
  width: 260px;
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  animation: ctxFadeIn 0.15s ease-out;
}

@keyframes ctxFadeIn {
  from { opacity: 0; transform: scale(0.96) translateY(-4px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.ctx-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px 6px 8px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #94a3b8;
  border-bottom: 1px solid rgba(51, 65, 85, 0.5);
  margin-bottom: 2px;
}

.ctx-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: #e2e8f0;
  cursor: pointer;
  text-align: left;
  transition: all 0.15s ease;
  width: 100%;
}

.ctx-item:hover {
  background: rgba(56, 189, 248, 0.12);
  border-color: rgba(56, 189, 248, 0.3);
  transform: translateX(2px);
}

.ctx-icon-box {
  width: 24px;
  height: 24px;
  border-radius: 4px;
  background: rgba(30, 41, 59, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  flex-shrink: 0;
}

.ctx-item-text {
  display: flex;
  flex-direction: column;
  flex-grow: 1;
}

.ctx-title {
  font-size: 12.5px;
  font-weight: 600;
  color: #f1f5f9;
}

.ctx-desc {
  font-size: 10.5px;
  color: #94a3b8;
  margin-top: 1px;
}

.ctx-badge {
  font-size: 9.5px;
  padding: 2px 6px;
  border-radius: 10px;
  background: rgba(56, 189, 248, 0.2);
  color: #38bdf8;
  font-weight: 700;
  border: 1px solid rgba(56, 189, 248, 0.4);
}

.ctx-status-tag {
  font-size: 10px;
  font-family: var(--font-mono);
  padding: 2px 6px;
  border-radius: 4px;
  background: rgba(16, 185, 129, 0.2);
  color: #10b981;
  font-weight: 700;
}

.ctx-divider {
  height: 1px;
  background: rgba(51, 65, 85, 0.5);
  margin: 3px 0;
}

.ctx-item.primary {
  background: linear-gradient(135deg, rgba(6, 182, 212, 0.15), rgba(14, 165, 233, 0.25));
  border: 1px solid rgba(56, 189, 248, 0.4);
}

.ctx-item.primary:hover {
  background: linear-gradient(135deg, rgba(6, 182, 212, 0.3), rgba(14, 165, 233, 0.4));
  border-color: #38bdf8;
}

/* Floating Rotation Banner on Map */
.rotation-mode-banner {
  position: absolute;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 2200;
  background: rgba(15, 23, 42, 0.95);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1.5px solid #38bdf8;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.7), 0 0 20px rgba(56, 189, 248, 0.35);
  border-radius: 12px;
  padding: 10px 18px;
  display: flex;
  align-items: center;
  gap: 20px;
  animation: bannerSlideDown 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes bannerSlideDown {
  from { opacity: 0; transform: translate(-50%, -20px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}

.rot-banner-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.rot-pulse-icon {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: rgba(56, 189, 248, 0.15);
  color: #38bdf8;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  border: 1px solid rgba(56, 189, 248, 0.4);
}

.rot-subtext {
  font-size: 11px;
  color: #94a3b8;
  margin-top: 1px;
}

.rot-banner-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0 15px;
  border-left: 1px solid rgba(51, 65, 85, 0.6);
  border-right: 1px solid rgba(51, 65, 85, 0.6);
}

.rot-angle-live {
  font-family: var(--font-mono);
  font-size: 20px;
  font-weight: 700;
  color: #facc15;
  text-shadow: 0 0 10px rgba(250, 204, 21, 0.4);
}

.rot-dir-live {
  font-size: 10.5px;
  color: #38bdf8;
  font-weight: 600;
}

.rot-banner-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Interactive Rotation Handle Marker */
.interactive-rotation-handle {
  position: relative;
  cursor: grab;
  user-select: none;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  align-items: center;
}

.interactive-rotation-handle:active {
  cursor: grabbing;
}

.rot-arrow-strip {
  display: flex;
  align-items: center;
  gap: 6px;
  background: linear-gradient(135deg, #0284c7, #0369a1);
  color: #ffffff;
  padding: 5px 12px;
  border-radius: 20px;
  border: 2px solid #ffffff;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.6), 0 0 14px rgba(56, 189, 248, 0.7);
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
  font-weight: 700;
  transition: transform 0.1s ease, box-shadow 0.1s ease;
}

.interactive-rotation-handle:hover .rot-arrow-strip,
.interactive-rotation-handle:active .rot-arrow-strip {
  transform: scale(1.12);
  background: linear-gradient(135deg, #0ea5e9, #0284c7);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.8), 0 0 25px rgba(56, 189, 248, 0.9);
}

.rot-arrow-left, .rot-arrow-right {
  font-size: 15px;
  color: #facc15;
  animation: arrowPulse 1.2s infinite ease-in-out;
}

@keyframes arrowPulse {
  0%, 100% { opacity: 0.7; transform: scale(1); }
  50% { opacity: 1; transform: scale(1.2); }
}

.rot-center-grip {
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 14px;
}

.rot-handle-tooltip {
  margin-top: 5px;
  background: rgba(15, 23, 42, 0.92);
  border: 1px solid rgba(56, 189, 248, 0.5);
  border-radius: 4px;
  padding: 2px 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  white-space: nowrap;
  pointer-events: none;
}

.rot-tooltip-angle {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 700;
  color: #facc15;
}

.rot-tooltip-guide {
  font-size: 9.5px;
  color: #94a3b8;
}

/* Live dynamic preview lines */
.live-preview-line {
  stroke-dasharray: 6, 4;
  animation: dashAnimation 1s linear infinite;
}

@keyframes dashAnimation {
  from { stroke-dashoffset: 0; }
  to { stroke-dashoffset: 20; }
}
