/* Modern APRS Watch UI - Stable v1.0 */

:root {
  --bg-primary: #ffffff;
  --bg-secondary: #f8f9fa;
  --bg-tertiary: #eff1f5;
  --text-primary: #1a1a1a;
  --text-secondary: #666;
  --text-tertiary: #999;
  --border: #e0e0e0;
  --accent-primary: #2a7f2a;
  --accent-secondary: #1a5a1a;
  --accent-light: #e8f5e9;
  --shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* DARK THEME */
body.dark-mode {
  --bg-primary: #1a1a1a;
  --bg-secondary: #222;
  --bg-tertiary: #2a2a2a;
  --text-primary: #fff;
  --text-secondary: #aaa;
  --text-tertiary: #777;
  --border: #333;
  --accent-primary: #4a4;
  --accent-secondary: #6f6;
  --accent-light: #1a3a1a;
  --shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.5);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html, body {
  height: 100%;
}

body {
  background: var(--bg-primary);
  color: var(--text-primary);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  display: flex;
  flex-direction: column;
}

/* TOP HEADER */
#top {
  padding: 10px 20px;
  background: var(--bg-primary);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow);
  z-index: 100;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 15px;
}

/* Position the theme toggle button correctly in the flex layout */
[onclick="toggleDarkMode()"] {
  background: var(--bg-tertiary);
  color: var(--text-secondary);
  border: 1px solid var(--border);
  padding: 6px 10px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
}

[onclick="toggleDarkMode()"]:hover {
  background: var(--border);
}

h1 {
  color: var(--accent-primary);
  font-size: 20px;
  font-weight: 600;
  margin-bottom: 0;
  display: inline-block;
}

#status {
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 500;
}

#status.connected {
  color: var(--accent-primary);
}

#controls {
  display: flex;
  flex-wrap: nowrap;
  gap: 10px;
  align-items: center;
  margin-top: 0;
  font-size: 12px;
  overflow-x: auto;
  flex: 1;
}

#controls span {
  color: var(--text-secondary);
  font-weight: 500;
}

#controls input[type="range"] {
  width: 80px;
  height: 6px;
  -webkit-appearance: none;
  appearance: none;
  background: var(--bg-tertiary);
  border-radius: 3px;
  outline: none;
}

#controls input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  background: var(--accent-primary);
  border-radius: 50%;
  cursor: pointer;
}

#controls input[type="range"]::-moz-range-thumb {
  width: 16px;
  height: 16px;
  background: var(--accent-primary);
  border-radius: 50%;
  cursor: pointer;
  border: none;
}

#loc-display {
  color: var(--accent-primary);
  font-family: 'Monaco', 'Courier New', monospace;
  font-size: 12px;
  font-weight: 600;
}

#controls button {
  background: var(--accent-primary);
  color: white;
  border: none;
  padding: 6px 12px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 500;
  transition: background 0.2s;
}

#controls button:hover {
  background: var(--accent-secondary);
}

#stream {
  margin-top: 4px;
  font-family: 'Monaco', 'Courier New', monospace;
  font-size: 11px;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  opacity: 0.8;
  max-height: 16px;
  flex-basis: 100%;
}

/* MAIN LAYOUT */
#main {
  display: flex;
  flex: 1;
  overflow: hidden;
}

#left {
  width: 300px;
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  background: var(--bg-secondary);
  flex-shrink: 0;
  z-index: 10;
}

#left h2 {
  color: var(--text-primary);
  font-size: 15px;
  font-weight: 600;
  padding: 14px 16px;
  background: var(--bg-primary);
  border-bottom: 1px solid var(--border);
}

#list {
  flex: 1;
  overflow-y: auto;
}

.sort-controls {
  padding: 12px 16px;
  background: var(--bg-primary);
  border-bottom: 1px solid var(--border);
  display: flex;
  gap: 8px;
  align-items: center;
}

.sort-controls span {
  color: var(--text-tertiary);
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
}

.sort-controls button {
  background: var(--bg-primary);
  color: var(--text-secondary);
  border: 1px solid var(--border);
  padding: 5px 10px;
  font-size: 11px;
  cursor: pointer;
  border-radius: 4px;
  transition: all 0.2s;
}

.sort-controls button:hover {
  background: var(--bg-tertiary);
}

.sort-controls button.active {
  background: var(--accent-primary);
  color: white;
  border-color: var(--accent-primary);
}

.sort-controls .add-station-btn {
  margin-left: auto;
  background: var(--accent-primary);
  color: white;
  border: none;
  font-weight: 600;
  white-space: nowrap;
}

.sort-controls .add-station-btn:hover {
  background: var(--accent-secondary);
}

/* LIST ITEMS */
.item {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.15s;
}

.item:hover {
  background: var(--bg-tertiary);
}

.item.sel {
  background: var(--accent-light);
  border-left: 3px solid var(--accent-primary);
  padding-left: 13px;
}

.item .call {
  font-size: 14px;
  font-weight: 600;
  color: var(--accent-primary);
  margin-bottom: 4px;
}

.item .call-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 3px;
}

.item .call-info {
  display: flex;
  align-items: baseline;
  gap: 6px;
  flex: 1;
}

.item .item-controls {
  display: flex;
  gap: 6px;
  align-items: center;
  margin-left: 15px;
  padding-left: 10px;
  border-left: 1px solid var(--border); /* Optional: adds a nice separator */
}

.item .nick {
  font-size: 12px;
  color: var(--text-secondary);
  font-weight: normal;
}

.item .edit-nick {
  font-size: 11px;
  opacity: 0.4;
  cursor: pointer;
  transition: opacity 0.2s;
}

.item:hover .edit-nick {
  opacity: 1;
}

.item .info {
  font-size: 11px;
  color: var(--text-tertiary);
  display: flex;
  justify-content: space-between;
  margin-top: 4px;
}

.item .age {
  color: var(--text-tertiary);
}

.item .dist {
  color: var(--text-secondary);
  font-weight: 500;
}

.item .x {
  color: var(--text-tertiary);
  font-size: 16px;
  cursor: pointer;
  transition: color 0.2s;
}

.item .x:hover {
  color: #d32f2f;
}

.item.dstar {
  background: #e3f2fd;
  border-left: 3px solid #1976d2;
}

.item.dstar:hover {
  background: #e1f5fe;
}

.item.dstar.sel {
  background: #bbdefb;
}

.dstar-tag {
  font-size: 10px;
  color: #1976d2;
  margin-left: 4px;
}

.mobile-tag {
  font-size: 10px;
  margin-left: 3px;
}

.section-header {
  color: var(--text-tertiary);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  padding: 10px 16px 4px;
  margin-top: 8px;
  border-bottom: 1px solid var(--border);
}

.section-header.inactive-header {
  color: var(--text-tertiary);
}

.item.inactive {
  opacity: 0.6;
}

.item.inactive:hover {
  opacity: 0.8;
}

/* RIGHT PANEL */
#right {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: var(--bg-primary);
}

#right h2 {
  color: var(--text-primary);
  font-size: 15px;
  font-weight: 600;
  padding: 14px 16px;
  background: var(--bg-primary);
  border-bottom: 1px solid var(--border);
}

#details {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
}

#map {
  flex: 1;
  width: 100%;
  height: 100%;
  z-index: 1;
}

.empty {
  color: var(--text-tertiary);
  text-align: center;
  margin-top: 40px;
  font-size: 14px;
}

.hdr {
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.hdr .call {
  font-size: 24px;
  font-weight: 600;
  color: var(--accent-primary);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.map-btn {
  background: var(--accent-primary);
  color: white;
  border: none;
  padding: 6px 12px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  transition: background 0.2s;
}

.map-btn:hover {
  background: var(--accent-secondary);
}

.hdr .sum {
  display: flex;
  gap: 20px;
  font-size: 13px;
}

.hdr .sum div {
  display: flex;
  flex-direction: column;
}

.hdr .sum .lbl {
  color: var(--text-tertiary);
  font-size: 11px;
  text-transform: uppercase;
  margin-bottom: 3px;
}

.hdr .sum .val {
  color: var(--text-primary);
  font-weight: 600;
}

.pkt {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 12px;
  margin-bottom: 12px;
}

.pkt .time {
  font-size: 11px;
  color: var(--text-tertiary);
  margin-bottom: 8px;
}

.pkt .data {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 4px 12px;
  font-size: 12px;
  margin-bottom: 8px;
}

.pkt .data .lbl {
  color: var(--text-secondary);
  text-align: right;
  font-weight: 500;
}

.pkt .data .val {
  color: var(--text-primary);
  font-family: 'Monaco', 'Courier New', monospace;
}

.pkt .raw {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
  font-family: 'Monaco', 'Courier New', monospace;
  font-size: 11px;
  color: var(--text-secondary);
  word-break: break-all;
}

/* MODALS */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  justify-content: center;
  align-items: center;
  z-index: 1000;
}

.modal-content {
  background: var(--bg-primary);
  border-radius: 8px;
  padding: 28px;
  width: 800px;
  max-width: 90%;
  box-shadow: var(--shadow-md);
  max-height: 90vh;
  display: flex;
  flex-direction: column;
}

.modal-content h2 {
  color: var(--text-primary);
  margin-bottom: 20px;
  font-size: 20px;
  font-weight: 600;
  flex-shrink: 0;
}

.modal-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
  overflow-y: auto;
  overflow-x: hidden;
  padding-right: 5px;
}

.modal-row {
  display: flex;
  gap: 16px;
}

.modal-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
}

.modal-form label {
  color: var(--text-primary);
  font-size: 13px;
  font-weight: 600;
}

.modal-form input,
.modal-form select {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  color: var(--text-primary);
  padding: 10px 12px;
  font-size: 14px;
  border-radius: 6px;
}

.modal-form input:focus,
.modal-form select:focus {
  outline: none;
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px rgba(42, 127, 42, 0.1);
}

.input-group {
  display: flex;
  gap: 8px;
}

.input-group select {
  flex: 1;
  min-width: 0; /* Allow select to shrink below content width */
}

.test-btn {
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  color: var(--text-primary);
  padding: 0 12px;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 600;
  white-space: nowrap;
}

.test-btn:hover {
  background: var(--border);
}

.modal-buttons {
  display: flex;
  gap: 12px;
  margin-top: 24px;
  flex-shrink: 0;
}

.modal-buttons button {
  flex: 1;
  padding: 12px;
  font-size: 14px;
  font-weight: 600;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s;
}

.modal-buttons .save {
  background: var(--accent-primary);
  color: white;
}

.modal-buttons .save:hover {
  background: var(--accent-secondary);
}

.modal-buttons .cancel {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

.modal-buttons .cancel:hover {
  background: var(--border);
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 4px;
  cursor: pointer;
}

.checkbox-label span {
  font-size: 13px;
  color: var(--text-secondary);
}

/* SAVED LOCATIONS */
.saved-locations-list {
  max-height: 200px;
  overflow-y: auto;
  margin-bottom: 16px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg-secondary);
}

.saved-loc {
  display: flex;
  align-items: center;
  padding: 10px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.15s;
}

.saved-loc:last-child {
  border-bottom: none;
}

.saved-loc:hover {
  background: var(--bg-tertiary);
}

.saved-loc .loc-name {
  flex: 1;
  color: var(--accent-primary);
  font-weight: 600;
  font-size: 13px;
}

.saved-loc .loc-coords {
  color: var(--text-tertiary);
  font-size: 11px;
  font-family: 'Monaco', 'Courier New', monospace;
  margin-right: 10px;
}

.saved-loc .loc-delete {
  color: var(--text-tertiary);
  font-size: 16px;
  padding: 0 5px;
  cursor: pointer;
  transition: color 0.2s;
}

.saved-loc .loc-delete:hover {
  color: #d32f2f;
}

.modal-divider {
  text-align: center;
  color: var(--text-tertiary);
  font-size: 12px;
  margin: 16px 0;
  position: relative;
}

.modal-divider::before,
.modal-divider::after {
  content: '';
  position: absolute;
  top: 50%;
  width: 40%;
  height: 1px;
  background: var(--border);
}

.modal-divider::before {
  left: 0;
}

.modal-divider::after {
  right: 0;
}

/* STREAM VIEW */
.stream-title {
  color: var(--accent-primary);
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 12px;
  text-transform: uppercase;
}

.stream-packet {
  padding: 6px 0;
  border-bottom: 1px solid var(--border);
  display: grid;
  grid-template-columns: 80px 120px 200px 1fr;
  gap: 10px;
  transition: background 0.1s;
  cursor: pointer;
}

.stream-packet:hover {
  background: var(--bg-tertiary);
}

.stream-time {
  color: var(--text-tertiary);
  font-size: 11px;
  font-family: 'Monaco', 'Courier New', monospace;
}

.stream-call {
  color: var(--accent-primary);
  font-weight: 600;
  font-size: 12px;
}

.stream-path {
  color: #1976d2;
  font-size: 11px;
  font-family: 'Monaco', 'Courier New', monospace;
}

.stream-payload {
  color: var(--text-secondary);
  word-break: break-all;
  font-size: 11px;
  font-family: 'Monaco', 'Courier New', monospace;
}

.voice-tag {
  font-size: 10px;
  margin-left: 3px;
  opacity: 0.8;
}

.station-checkbox {
  margin-right: 10px;
  cursor: pointer;
  width: 16px;
  height: 16px;
}

.item.selected {
  background: var(--accent-light);
  border-left: 3px solid var(--accent-primary);
}

/* SUPER WATCHLIST - VOICE ALERTS */
.super-container {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
}

.super-drop-zone {
  flex-shrink: 0;
  max-height: 40%; /* Reduced to give more space to stream/map */
  overflow-y: auto;
  border-bottom: 1px solid var(--border);
  padding: 10px; /* Slightly less padding */
  background: var(--bg-secondary);
}

.stream-view {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 14px;
}

#stream-packets {
  flex: 1;
  overflow-y: auto;
  font-family: 'Monaco', 'Courier New', monospace;
  font-size: 11px;
}

.super-drop-zone.super-empty {
  min-height: 120px;
  max-height: 120px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px dashed var(--border);
  background: var(--bg-primary);
}

.super-empty-text {
  color: var(--text-tertiary);
  font-size: 13px;
  font-style: italic;
}

.super-tiles {
  display: flex;
  flex-wrap: wrap;
  gap: 8px; /* Slightly less gap */
}

.super-tile {
  background: var(--bg-primary);
  border: 1px solid var(--border);
  padding: 6px 8px; /* Reduced vertical padding */
  border-radius: 6px;
  box-shadow: var(--shadow);
  flex: 0 1 auto;
  min-width: 160px;
}

@keyframes tile-glow {
  0% {
    box-shadow: var(--shadow);
    border-color: var(--border);
  }
  50% {
    box-shadow: 0 0 12px 3px var(--accent-primary);
    border-color: var(--accent-primary);
  }
  100% {
    box-shadow: var(--shadow);
    border-color: var(--border);
  }
}

.super-tile.updated {
  animation: tile-glow 4s ease-out;
}

.super-tile-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2px; /* Reduced margin */
}

.super-tile-call {
  color: var(--accent-primary);
  font-size: 14px; /* Slightly smaller */
  font-weight: 600;
  font-size: 15px;
  font-weight: 700;
}

.super-tile-remove {
  color: var(--text-tertiary);
  cursor: pointer;
  font-size: 18px;
  transition: color 0.2s;
  margin-left: 15px;
}

.super-tile-remove:hover {
  color: #d32f2f;
}

.super-tile-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-bottom: 4px; /* Reduced margin */
  font-size: 11px; /* Slightly smaller */
}

.super-tile-dist {
  color: var(--text-primary);
  font-weight: 600;
  display: inline;
  margin-right: 10px;
}

.super-tile-bearing {
  color: var(--text-secondary);
  font-size: 11px;
  display: inline;
}

.super-tile-age {
  color: var(--text-tertiary);
  font-size: 11px;
  margin-top: 4px;
}

.super-tile-buttons {
  display: flex;
  gap: 6px;
}

.super-tile-buttons button {
  flex: 1;
  background: var(--accent-light);
  color: var(--accent-primary);
  border: none;
  padding: 3px; /* Reduced padding */
  border-radius: 4px;
  cursor: pointer;
  font-size: 10px; /* Slightly smaller font */
  font-weight: 500;
  transition: all 0.2s;
}

.super-tile-buttons button:hover {
  background: var(--accent-primary);
  color: white;
}

.super-tile-nick {
  color: var(--text-tertiary); /* Slightly lighter color */
  font-size: 10px; /* Slightly smaller */
  font-style: italic;
  margin-bottom: 2px; /* Reduced margin */
}

.detail-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.detail-header {
  background: var(--bg-primary);
  color: var(--text-primary);
  font-size: 14px;
  font-weight: 600;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.detail-header button {
  background: var(--bg-tertiary);
  color: var(--text-secondary);
  border: none;
  padding: 4px 10px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 12px;
  transition: all 0.2s;
}

.detail-header button:hover {
  background: var(--border);
  color: #d32f2f;
}

#detail-content {
  flex: 1;
  overflow-y: auto;
  padding: 14px;
}

.item.waiting {
  opacity: 0.6;
}

.volume-controls {
  display: flex;
  gap: 24px;
  padding: 14px 16px;
  background: var(--bg-primary);
  border-bottom: 1px solid var(--border);
}

.volume-group {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
}

.volume-group label {
  font-size: 13px;
  color: var(--text-primary);
  font-weight: 600;
  min-width: 70px;
}

.volume-group input[type="range"] {
  flex: 1;
  height: 6px;
  background: var(--bg-tertiary);
  border-radius: 3px;
  outline: none;
  -webkit-appearance: none;
  appearance: none;
}

.volume-group input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  background: var(--accent-primary);
  border-radius: 50%;
  cursor: pointer;
}

.volume-group input[type="range"]::-moz-range-thumb {
  width: 16px;
  height: 16px;
  background: var(--accent-primary);
  border-radius: 50%;
  cursor: pointer;
  border: none;
}

.volume-group span {
  min-width: 45px;
  text-align: right;
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 500;
}

.super-tile-wx {
  color: var(--text-tertiary); /* Slightly lighter color */
  font-size: 10px; /* Slightly smaller */
  margin: 2px 0;
}

/* SCROLLBAR STYLING */
::-webkit-scrollbar {
  width: 8px;
}

::-webkit-scrollbar-track {
  background: var(--bg-secondary);
}

::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-tertiary);
}

/* UTILITY CLASSES */
.hidden {
  display: none !important;
}

/* WEATHER & TELEMETRY DASHBOARDS */
.wx-dashboard, .telem-dashboard {
  margin-top: 8px;
  background: var(--bg-secondary);
  border-radius: 8px;
  padding: 12px;
  border: 1px solid var(--border);
  margin-bottom: 8px;
}

.wx-title, .telem-title {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  margin-bottom: 10px;
  letter-spacing: 0.5px;
}

.wx-cards, .telem-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(70px, 1fr));
  gap: 8px;
}

.wx-card, .telem-card {
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px 4px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.wx-card-label, .telem-card-label {
  font-size: 9px;
  color: var(--text-tertiary);
  margin-bottom: 6px;
  text-transform: uppercase;
  font-weight: 600;
  height: 12px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  width: 100%;
}

.wx-gauge, .telem-gauge {
  width: 6px;
  height: 36px;
  background: var(--bg-tertiary);
  border-radius: 3px;
  margin-bottom: 6px;
  position: relative;
  display: flex;
  align-items: flex-end;
  overflow: hidden;
}

.wx-gauge-fill, .telem-gauge-fill {
  width: 100%;
  border-radius: 3px;
  transition: height 0.3s ease;
  min-height: 2px;
}

.wx-card-value, .telem-card-value {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.2;
}

.wx-card-sub, .telem-card-sub {
  font-size: 9px;
  color: var(--text-secondary);
  margin-top: 1px;
}

.telem-meta {
  margin-top: 8px;
  padding-top: 6px;
  border-top: 1px solid var(--border);
  font-size: 10px;
  color: var(--text-tertiary);
  display: flex;
  gap: 10px;
  font-family: 'Monaco', 'Courier New', monospace;
}

.telem-item {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  margin-bottom: 4px;
}

.telem-label {
  color: var(--text-secondary);
}

.telem-value {
  font-weight: 600;
  font-family: 'Monaco', 'Courier New', monospace;
}

/* LEAFLET MARKER GLOW */
@keyframes marker-glow-animation {
  0% {
    filter: drop-shadow(0 0 0px transparent);
  }
  50% {
    filter: drop-shadow(0 0 10px var(--accent-primary)) drop-shadow(0 0 4px var(--accent-primary));
  }
  100% {
    filter: drop-shadow(0 0 0px transparent);
  }
}

.leaflet-marker-icon.marker-glow {
  animation: marker-glow-animation 2.5s ease-out;
}

/* FLASH TOOLTIP */
.leaflet-tooltip.flash-tooltip {
  background-color: var(--accent-primary);
  color: white;
  border: none;
  box-shadow: var(--shadow);
  font-weight: 600;
  font-size: 12px;
  padding: 4px 8px;
  border-radius: 4px;
  opacity: 0.9;
}

.leaflet-tooltip.flash-tooltip::before {
  border-top-color: var(--accent-primary);
}

/* LEAFLET POPUP STYLING */
.leaflet-popup-content-wrapper {
  background: var(--bg-primary);
  color: var(--text-primary);
  border-radius: 8px;
  box-shadow: var(--shadow-md);
}

.leaflet-popup-content {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  font-size: 13px;
  line-height: 1.6;
  margin: 15px !important;
  min-width: 200px;
}

.leaflet-popup-content b {
  color: var(--accent-primary);
  font-size: 15px;
}

.leaflet-popup-content small {
  color: var(--text-tertiary);
}

.leaflet-popup-content hr {
  margin: 8px 0;
  border: none;
  border-top: 1px solid var(--border);
}

.leaflet-popup-content .map-btn {
  width: 100%;
  margin-top: 8px;
}

.leaflet-popup-tip {
  background: var(--bg-primary);
}

.leaflet-container a.leaflet-popup-close-button {
  color: var(--text-tertiary);
}
.leaflet-container a.leaflet-popup-close-button:hover {
  color: var(--text-primary);
}

/* MAP VIEWS CONTROL */
.map-views-control {
  background: var(--bg-primary);
  padding: 8px;
  display: flex;
  gap: 8px;
  align-items: center;
  border: 2px solid var(--border);
  border-radius: 8px !important; /* Override leaflet defaults */
  box-shadow: var(--shadow-md) !important;
}

.map-views-control select {
  height: 40px;
  font-size: 16px;
  font-weight: 600;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg-secondary);
  color: var(--text-primary);
  min-width: 160px;
  max-width: 240px;
  padding: 0 8px;
  cursor: pointer;
}

.map-views-control button {
  height: 40px;
  width: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 6px;
  background: var(--accent-primary);
  color: white;
  cursor: pointer;
  font-size: 22px;
  transition: background 0.2s;
}

.map-views-control button:hover {
  background: var(--accent-secondary);
}

/* RESPONSIVE */
@media (max-width: 768px) {
  #main {
    flex-direction: column;
  }

  #left {
    width: 100%;
    max-height: 40%;
  }

  #right {
    flex: 1;
  }

  #controls {
    flex-direction: column;
    align-items: stretch;
  }

  .modal-content {
    width: 95%;
  }
  
  .modal-row {
    flex-direction: column;
  }
}

/* APRS Custom Icon Styling */
.aprs-icon-svg {
  filter: drop-shadow(0 0 2px rgba(0,0,0,0.4));
  transition: transform 0.2s ease;
}

.dark-mode .aprs-icon-svg {
  filter: brightness(1.1) drop-shadow(0 0 3px rgba(255,255,255,0.3));
}
