/* ==========================================
   FANU · NAVIGATION UI
   GPS card, action buttons, navigation banner, MOB, modals
   ========================================== */

/* ==========================================
   NAV CARD (top-left) — GPS, speed, compass
   ========================================== */
.nav-card {
  position: absolute;
  top: 16px;
  left: 16px;
  z-index: 50;
  background: var(--surface-elevated);
  backdrop-filter: blur(var(--blur)) saturate(180%);
  -webkit-backdrop-filter: blur(var(--blur)) saturate(180%);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  box-shadow: var(--shadow-md);
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 152px;
  opacity: 0;
  transform: translateY(-8px);
  animation: navCardIn 0.6s 0.6s var(--ease-out) forwards;
}
@keyframes navCardIn {
  to { opacity: 1; transform: translateY(0); }
}

.nav-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.nav-card-top-left {
  display: flex;
  align-items: center;
  gap: 6px;
}
.gps-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--good);
  box-shadow: 0 0 8px var(--good);
}
.gps-dot.weak { background: var(--accent); box-shadow: 0 0 8px var(--accent); }
.gps-dot.lost { background: var(--warn); box-shadow: 0 0 8px var(--warn); animation: blink 1s infinite; }
@keyframes blink { 50% { opacity: 0.3; } }

.nav-label {
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-3);
}
.nav-acc {
  font-family: 'JetBrains Mono', monospace;
  font-size: 9.5px;
  color: var(--text-3);
  font-weight: 500;
  letter-spacing: 0.02em;
}

.speed-stack {
  padding: 4px 0 6px;
  border-top: 0.5px solid var(--hairline);
  border-bottom: 0.5px solid var(--hairline);
}
.speed-row {
  display: flex;
  align-items: baseline;
  gap: 5px;
}
.speed-value {
  font-family: 'Newsreader', serif;
  font-size: 38px;
  font-weight: 500;
  letter-spacing: -0.045em;
  font-variant-numeric: tabular-nums;
  line-height: 0.9;
  color: var(--text);
}
.speed-unit {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-3);
  letter-spacing: -0.005em;
}
.speed-meta {
  font-size: 10.5px;
  color: var(--text-3);
  font-weight: 500;
  margin-top: 4px;
  letter-spacing: -0.005em;
  font-style: italic;
  font-family: 'Newsreader', serif;
}

.compass-row {
  display: flex;
  align-items: center;
  gap: 12px;
}
.compass-disc {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1px solid var(--hairline-strong);
  background: var(--bg-2);
  position: relative;
  flex-shrink: 0;
}
.compass-needle {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 3px;
  height: 14px;
  margin-left: -1.5px;
  margin-top: -7px;
  border-radius: 2px;
  transform-origin: center;
  transform: rotate(0deg);
  transition: transform 0.5s var(--ease-in-out);
  background: linear-gradient(to bottom,
    var(--accent) 0%,
    var(--accent) 49%,
    var(--text-3) 51%,
    var(--text-3) 100%);
}
.compass-n {
  position: absolute;
  top: 2px;
  left: 50%;
  transform: translateX(-50%);
  font-family: 'JetBrains Mono', monospace;
  font-size: 7px;
  font-weight: 700;
  color: var(--text-3);
  letter-spacing: 0.05em;
}
.compass-info {
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.compass-deg {
  font-family: 'Newsreader', serif;
  font-size: 17px;
  font-weight: 500;
  letter-spacing: -0.025em;
  font-variant-numeric: tabular-nums;
  color: var(--text);
  line-height: 1;
}
.compass-label {
  font-size: 9.5px;
  font-weight: 500;
  color: var(--text-3);
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

/* ==========================================
   FLOATING ACTION BUTTONS (top-right)
   ========================================== */
.fab-stack {
  position: absolute;
  top: 16px;
  right: 16px;
  z-index: 50;
  display: flex;
  flex-direction: column;
  gap: 10px;
  opacity: 0;
  transform: translateY(-8px);
  animation: fabIn 0.6s 0.8s var(--ease-out) forwards;
}
@keyframes fabIn {
  to { opacity: 1; transform: translateY(0); }
}

.fab {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--surface-elevated);
  backdrop-filter: blur(var(--blur)) saturate(180%);
  -webkit-backdrop-filter: blur(var(--blur)) saturate(180%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text);
  box-shadow: var(--shadow-sm);
  transition: all 0.2s ease;
}
.fab:hover { transform: translateY(-1px); color: var(--accent); }
.fab:active { transform: scale(0.92); }
.fab svg { width: 18px; height: 18px; stroke-width: 2; }

.fab-mob {
  background: var(--warn);
  color: white;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  margin-top: 6px;
  border: 0.5px solid rgba(255, 255, 255, 0.2);
}
.fab-mob:hover {
  background: #ff6b62;
  color: white;
}
.fab-mob-text { display: block; }

/* ==========================================
   GOTO NAVIGATION BANNER (bottom)
   ========================================== */
.goto-banner {
  position: absolute;
  left: 16px;
  right: 16px;
  bottom: calc(20px + var(--safe-bottom));
  z-index: 60;
  background: var(--surface-elevated);
  backdrop-filter: blur(var(--blur)) saturate(180%);
  -webkit-backdrop-filter: blur(var(--blur)) saturate(180%);
  border-radius: var(--radius-lg);
  border: 0.5px solid rgba(255, 159, 10, 0.3);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4), 0 0 0 0.5px rgba(255, 159, 10, 0.2);
  padding: 14px 16px;
  display: none;
  align-items: center;
  gap: 14px;
  max-width: 560px;
  margin: 0 auto;
  transform: translateY(20px);
  opacity: 0;
  transition: all 0.4s var(--ease-out);
}
.goto-banner.active {
  display: flex;
  transform: translateY(0);
  opacity: 1;
}

.goto-bearing-wrap {
  flex-shrink: 0;
}
.goto-bearing {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: rgba(255, 159, 10, 0.12);
  border: 1px solid rgba(255, 159, 10, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
  transition: transform 0.5s var(--ease-in-out);
}
.goto-arrow {
  width: 28px;
  height: 28px;
}

.goto-info {
  flex: 1;
  min-width: 0;
}
.goto-target {
  font-family: 'Newsreader', serif;
  font-style: italic;
  font-weight: 500;
  font-size: 17px;
  letter-spacing: -0.02em;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 3px;
}
.goto-stats {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  color: var(--text-2);
  font-weight: 500;
  flex-wrap: wrap;
}
.goto-stats strong {
  color: var(--text);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
}
.dot-sep { color: var(--text-4); }
.goto-eta { color: var(--accent); font-weight: 600; }

.goto-stop {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--bg-3);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-2);
  flex-shrink: 0;
  transition: all 0.2s ease;
}
.goto-stop:hover { background: var(--neutral); color: var(--text); }
.goto-stop svg { width: 14px; height: 14px; }

/* ==========================================
   MOB BANNER (overrides goto when active)
   ========================================== */
.mob-banner {
  position: absolute;
  left: 16px;
  right: 16px;
  bottom: calc(20px + var(--safe-bottom));
  z-index: 70;
  background: var(--warn);
  border-radius: var(--radius-lg);
  padding: 16px 18px;
  display: none;
  align-items: center;
  gap: 14px;
  color: white;
  max-width: 560px;
  margin: 0 auto;
  box-shadow: 0 12px 40px rgba(255, 69, 58, 0.5);
}
.mob-banner.active { display: flex; }

.mob-pulse {
  width: 16px;
  height: 16px;
  background: white;
  border-radius: 50%;
  flex-shrink: 0;
  position: relative;
  animation: mobBlink 0.6s ease-in-out infinite;
}
.mob-pulse::before {
  content: '';
  position: absolute;
  inset: -8px;
  border-radius: 50%;
  background: rgba(255,255,255,0.4);
  animation: mobRing 1.2s cubic-bezier(0,0,0.2,1) infinite;
}
@keyframes mobBlink { 0%, 100% { opacity: 1; } 50% { opacity: 0.5; } }
@keyframes mobRing { to { transform: scale(2.5); opacity: 0; } }

.mob-content { flex: 1; min-width: 0; }
.mob-title {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.18em;
  margin-bottom: 4px;
}
.mob-stats {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 500;
  flex-wrap: wrap;
}
.mob-stats strong {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  font-family: 'JetBrains Mono', monospace;
}

.mob-cancel {
  padding: 8px 14px;
  background: rgba(255,255,255,0.2);
  border-radius: 100px;
  color: white;
  font-size: 12px;
  font-weight: 600;
  border: 0.5px solid rgba(255,255,255,0.3);
  flex-shrink: 0;
  transition: background 0.2s;
}
.mob-cancel:hover { background: rgba(255,255,255,0.3); }

/* ==========================================
   MODALS
   ========================================== */
.modal-bg {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  z-index: 200;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}
.modal-bg.open {
  opacity: 1;
  pointer-events: auto;
}

.modal {
  width: 100%;
  max-width: 560px;
  background: var(--surface-elevated);
  backdrop-filter: blur(var(--blur)) saturate(180%);
  -webkit-backdrop-filter: blur(var(--blur)) saturate(180%);
  border-top-left-radius: 28px;
  border-top-right-radius: 28px;
  border: 0.5px solid var(--hairline);
  padding: 14px 22px calc(28px + var(--safe-bottom));
  max-height: 90vh;
  overflow-y: auto;
  transform: translateY(100%);
  transition: transform 0.5s var(--ease-out);
  position: relative;
}
.modal-bg.open .modal { transform: translateY(0); }

.modal::-webkit-scrollbar { width: 0; }

.modal-grabber {
  width: 36px;
  height: 5px;
  background: var(--text-4);
  border-radius: 100px;
  margin: 4px auto 18px;
}

.modal-close {
  position: absolute;
  top: 18px;
  right: 18px;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--bg-3);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-2);
  z-index: 10;
  transition: all 0.2s ease;
}
.modal-close:hover { background: var(--neutral); color: var(--text); }
.modal-close svg { width: 14px; height: 14px; stroke-width: 2.5; }

.modal-eyebrow {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--text-4);
  margin-bottom: 8px;
}
.modal-title {
  font-family: 'Newsreader', serif;
  font-style: italic;
  font-weight: 500;
  font-size: 30px;
  letter-spacing: -0.025em;
  line-height: 1.05;
  margin-bottom: 6px;
}
.modal-sub {
  font-size: 13px;
  color: var(--text-2);
  line-height: 1.5;
  margin-bottom: 22px;
  letter-spacing: -0.005em;
  font-family: 'JetBrains Mono', monospace;
  font-weight: 500;
  font-size: 11px;
}

/* ==========================================
   FORMS
   ========================================== */
.form-label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--text-3);
  margin: 14px 0 8px;
  font-family: 'JetBrains Mono', monospace;
}
.form-label:first-of-type { margin-top: 0; }

.form-input {
  width: 100%;
  background: var(--bg-2);
  border: 0.5px solid var(--hairline);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  font-size: 14px;
  color: var(--text);
  letter-spacing: -0.005em;
  transition: border-color 0.2s ease;
  outline: none;
  resize: none;
  font-family: inherit;
}
.form-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(255, 159, 10, 0.12);
}
.form-input::placeholder { color: var(--text-4); }

textarea.form-input {
  min-height: 60px;
  font-family: inherit;
  line-height: 1.4;
}

/* ==========================================
   CATEGORY GRID
   ========================================== */
.cat-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 6px;
  margin-bottom: 4px;
}
.cat-pick {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 12px 8px;
  background: var(--bg-2);
  border: 0.5px solid var(--hairline);
  border-radius: var(--radius-sm);
  transition: all 0.2s ease;
}
.cat-pick:hover { border-color: var(--hairline-strong); }
.cat-pick.selected {
  background: linear-gradient(135deg, rgba(255,159,10,0.14), rgba(255,159,10,0.04));
  border-color: rgba(255,159,10,0.4);
  box-shadow: 0 0 0 0.5px rgba(255,159,10,0.4);
}
.cat-icon { font-size: 22px; line-height: 1; }
.cat-name {
  font-size: 10.5px;
  font-weight: 500;
  color: var(--text-2);
  letter-spacing: -0.005em;
}
.cat-pick.selected .cat-name { color: var(--accent); font-weight: 600; }

/* ==========================================
   PRIMARY BUTTON
   ========================================== */
.btn-primary {
  width: 100%;
  background: var(--text);
  color: var(--bg-0);
  padding: 16px 22px;
  border-radius: 100px;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.01em;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.2s ease;
  margin-top: 18px;
}
.btn-primary:hover { transform: scale(1.01); }
.btn-primary:active { transform: scale(0.98); }
.btn-primary:disabled {
  background: var(--bg-3);
  color: var(--text-4);
  cursor: not-allowed;
  transform: none;
}

/* ==========================================
   WAYPOINT LIST
   ========================================== */
.waypoint-list {
  display: flex;
  flex-direction: column;
  gap: 1px;
  background: var(--bg-2);
  border: 0.5px solid var(--hairline);
  border-radius: var(--radius-md);
  overflow: hidden;
}
.waypoint-list:empty { display: none; }

.wp-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 18px;
  background: var(--bg-2);
  position: relative;
  transition: background 0.2s ease;
  cursor: pointer;
}
.wp-item:hover { background: var(--bg-3); }
.wp-item + .wp-item::before {
  content: '';
  position: absolute;
  top: 0;
  left: 18px;
  right: 18px;
  height: 0.5px;
  background: var(--hairline);
}

.wp-icon {
  width: 36px;
  height: 36px;
  border-radius: 9px;
  background: var(--bg-3);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}
.wp-info { flex: 1; min-width: 0; }
.wp-name {
  font-family: 'Newsreader', serif;
  font-size: 15px;
  font-weight: 500;
  letter-spacing: -0.015em;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.wp-meta {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10.5px;
  color: var(--text-3);
  margin-top: 2px;
  letter-spacing: 0.02em;
  font-weight: 500;
}

.wp-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}
.wp-action-btn {
  padding: 6px 10px;
  border-radius: 100px;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: -0.005em;
  font-family: 'Manrope', sans-serif;
  transition: all 0.2s ease;
}
.wp-go {
  background: var(--accent);
  color: black;
}
.wp-go:hover { background: var(--accent-2); }
.wp-del {
  width: 28px;
  height: 28px;
  padding: 0;
  background: var(--bg-3);
  color: var(--text-3);
  display: flex;
  align-items: center;
  justify-content: center;
}
.wp-del:hover { background: rgba(255, 69, 58, 0.15); color: var(--warn); }
.wp-del svg { width: 13px; height: 13px; stroke-width: 2; }

/* ==========================================
   EMPTY STATE
   ========================================== */
.empty-state {
  display: none;
  text-align: center;
  padding: 40px 20px;
}
.empty-state.show { display: block; }
.empty-icon {
  font-size: 42px;
  margin-bottom: 14px;
  opacity: 0.6;
}
.empty-title {
  font-family: 'Newsreader', serif;
  font-style: italic;
  font-size: 19px;
  font-weight: 500;
  margin-bottom: 6px;
  letter-spacing: -0.02em;
  color: var(--text);
}
.empty-sub {
  font-size: 13px;
  color: var(--text-3);
  line-height: 1.5;
  max-width: 280px;
  margin: 0 auto;
  letter-spacing: -0.005em;
}

/* ==========================================
   TOAST
   ========================================== */
.toast {
  position: fixed;
  bottom: calc(110px + var(--safe-bottom));
  left: 50%;
  transform: translateX(-50%) translateY(40px);
  z-index: 300;
  background: var(--surface-elevated);
  backdrop-filter: blur(var(--blur)) saturate(180%);
  -webkit-backdrop-filter: blur(var(--blur)) saturate(180%);
  border: 0.5px solid var(--hairline);
  border-radius: 100px;
  padding: 12px 20px 12px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  pointer-events: none;
  transition: all 0.4s var(--ease-out);
  white-space: nowrap;
}
.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
.toast-icon {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--good);
  color: black;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  flex-shrink: 0;
}
.toast-icon.error { background: var(--warn); color: white; }
.toast-icon.warn { background: var(--accent); color: black; }
.toast-text {
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text);
  letter-spacing: -0.005em;
}

/* ==========================================
   WAYPOINT MAP MARKERS
   ========================================== */
.wp-marker {
  width: 28px;
  height: 28px;
  border-radius: 50% 50% 50% 0;
  background: var(--accent);
  border: 2px solid white;
  transform: rotate(-45deg);
  box-shadow: 0 4px 12px rgba(0,0,0,0.4);
  display: flex;
  align-items: center;
  justify-content: center;
}
.wp-marker-inner {
  transform: rotate(45deg);
  font-size: 14px;
  line-height: 1;
}
.wp-marker.cat-fishing { background: var(--accent); }
.wp-marker.cat-harbor { background: var(--tide); }
.wp-marker.cat-anchor { background: #5e8aa7; }
.wp-marker.cat-dive { background: #00b8d4; }
.wp-marker.cat-hazard { background: var(--warn); }
.wp-marker.cat-other { background: var(--neutral); }

.wp-marker.target {
  animation: targetPulse 1.5s ease-in-out infinite;
}
@keyframes targetPulse {
  0%, 100% { box-shadow: 0 4px 12px rgba(0,0,0,0.4), 0 0 0 0 rgba(255, 159, 10, 0.6); }
  50% { box-shadow: 0 4px 12px rgba(0,0,0,0.4), 0 0 0 12px rgba(255, 159, 10, 0); }
}

/* MOB marker */
.mob-marker {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--warn);
  border: 3px solid white;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.05em;
  box-shadow: 0 4px 16px rgba(255, 69, 58, 0.6);
  animation: mobMarker 1s ease-in-out infinite;
}
@keyframes mobMarker {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.1); }
}

/* Boat marker */
.boat-marker {
  position: relative;
  width: 18px;
  height: 18px;
}
.boat-marker::before {
  content: '';
  position: absolute;
  inset: -10px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255,159,10,0.35), transparent 65%);
  animation: boatPulse 2.6s cubic-bezier(0, 0, 0.2, 1) infinite;
}
.boat-marker::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: var(--accent);
  border: 3px solid #000;
  box-shadow: 0 0 0 1.5px var(--accent), 0 4px 14px rgba(0,0,0,0.6);
}
[data-theme="light"] .boat-marker::after { border-color: #fff; }
@keyframes boatPulse {
  0% { transform: scale(0.6); opacity: 0.9; }
  100% { transform: scale(2.5); opacity: 0; }
}

/* Boat heading arrow */
.boat-heading {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  border-left: 6px solid transparent;
  border-right: 6px solid transparent;
  border-bottom: 14px solid var(--accent);
  transform: translate(-50%, -130%) rotate(0deg);
  transform-origin: 50% 130%;
  transition: transform 0.4s var(--ease-in-out);
  filter: drop-shadow(0 1px 2px rgba(0,0,0,0.4));
}

/* Trail polyline color via Leaflet inline override */
.leaflet-interactive { cursor: pointer; }

/* ==========================================
   RESPONSIVE
   ========================================== */
@media (max-width: 420px) {
  .nav-card { min-width: 138px; padding: 12px 14px; gap: 10px; }
  .speed-value { font-size: 32px; }
  .compass-disc { width: 32px; height: 32px; }
  .compass-needle { height: 12px; margin-top: -6px; }
  .compass-deg { font-size: 15px; }
  .fab { width: 40px; height: 40px; }
  .fab-mob { font-size: 10px; }
  .modal-title { font-size: 26px; }
  .cat-grid { grid-template-columns: 1fr 1fr 1fr; }
}

@media (max-width: 360px) {
  .nav-card { min-width: 124px; padding: 10px 12px; }
  .speed-value { font-size: 28px; }
  .speed-meta { font-size: 10px; }
  .goto-target { font-size: 14px; }
  .goto-stats { font-size: 10.5px; }
}
