/* Global Variables & Tactical Theme */
:root {
  --bg-primary: #0a0c10;
  --bg-card: rgba(15, 22, 33, 0.85);
  --bg-card-hover: rgba(22, 32, 48, 0.95);
  --border-color: rgba(0, 240, 255, 0.15);
  --border-hover: rgba(0, 240, 255, 0.4);
  
  /* Tactical Status Colors */
  --color-normal: #10b981;     /* Emerald Green */
  --color-help: #f59e0b;       /* Amber Yellow */
  --color-combat: #ef4444;     /* Red-Orange */
  --color-rescue: #ff0055;     /* Neon Red/Pink */
  --color-cyan: #00f0ff;       /* Tech Cyan */
  
  --text-main: #e2e8f0;
  --text-muted: #64748b;
  --text-dark: #0f172a;
  
  --font-mono: 'Share Tech Mono', monospace;
  --font-sans: 'Inter', sans-serif;
  --glow-cyan: 0 0 10px rgba(0, 240, 255, 0.35);
  --glow-red: 0 0 15px rgba(255, 0, 85, 0.5);
  --glow-orange: 0 0 10px rgba(239, 68, 68, 0.4);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body, html {
  width: 100%;
  height: 100%;
  overflow: hidden;
  font-family: var(--font-sans);
  background-color: var(--bg-primary);
  color: var(--text-main);
  -webkit-tap-highlight-color: transparent;
}

/* Scrollbar styling */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.2);
}
::-webkit-scrollbar-thumb {
  background: var(--text-muted);
  border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--color-cyan);
}

#app {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
}

/* Glassmorphism Card Style Utility */
.glass-card {
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.4);
}

/* Header overlay */
.tactical-header {
  position: absolute;
  top: 15px;
  left: 15px;
  right: 15px;
  height: 42px;
  z-index: 1000;
  display: flex;
  justify-content: space-between;
  align-items: center;
  pointer-events: none; /* Let clicks pass to map */
}

/* Individual floating glass-card widgets */
.status-widget {
  position: absolute;
  top: 0;
  right: 0;
  left: auto;
  transform: none;
  height: 22px;
  display: flex;
  align-items: center;
  pointer-events: auto; /* Re-enable clicks */
  transition: all 0.3s ease;
  padding: 0 8px;
  border-radius: 6px;
  z-index: 1001;
  font-family: var(--font-mono);
  font-size: 0.55rem;
  letter-spacing: 0.5px;
  gap: 4px;
}

.logo-widget {
  position: absolute;
  top: 0;
  left: 0;
  height: 22px;
  display: flex;
  align-items: center;
  pointer-events: auto; /* Re-enable clicks */
  transition: all 0.3s ease;
  padding: 0 8px;
  border-radius: 6px;
  z-index: 1001;
}

/* Integrated Operator Profile Widget in Card */
.profile-widget {
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 8px;
  padding: 10px 12px;
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
  width: 100%;
  pointer-events: auto;
}

.logo {
  display: flex;
  align-items: center;
  gap: 3px;
}

.logo i {
  color: var(--color-cyan);
  font-size: 0.55rem;
  text-shadow: var(--glow-cyan);
}

.logo h1 {
  font-family: var(--font-mono);
  font-size: 0.55rem;
  font-weight: 700;
  letter-spacing: 0.5px;
}

.logo .highlight {
  color: var(--color-cyan);
  text-shadow: var(--glow-cyan);
}

.logo .sub-title {
  display: none !important;
}

@media (min-width: 768px) {
  .logo .sub-title {
    display: inline-block;
  }
}

.header-status {
  display: flex;
  align-items: center;
  gap: 15px;
}

.connection-status {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(0,0,0,0.3);
  padding: 6px 12px;
  border-radius: 20px;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 1px;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.status-dot {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  display: inline-block;
}

.status-dot.connected {
  background-color: var(--color-normal);
  box-shadow: 0 0 4px var(--color-normal);
  animation: pulse 2s infinite;
}

.status-dot.disconnected {
  background-color: var(--color-rescue);
  box-shadow: 0 0 4px var(--color-rescue);
  animation: pulse 1s infinite;
}

.user-profile {
  display: flex;
  align-items: center;
  gap: 8px;
}

.user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid var(--color-cyan);
  box-shadow: var(--glow-cyan);
}

.user-info {
  display: flex;
  flex-direction: column;
}

.user-name {
  font-size: 0.8rem;
  font-weight: 600;
  max-width: 100px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.gps-status-badge {
  font-size: 0.65rem;
  font-family: var(--font-mono);
  color: var(--color-normal);
}

.gps-status-badge.searching {
  color: var(--color-help);
  animation: blink 1.5s infinite;
}

.gps-status-badge.error {
  color: var(--color-rescue);
}

/* Main Layout & Map */
.tactical-main {
  position: relative;
  flex: 1;
  width: 100%;
  height: 100%;
}

#map {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 1;
  background-color: var(--bg-primary);
}

/* Overriding Leaflet default dark theme styling */
.leaflet-container {
  font-family: var(--font-sans) !important;
}

.leaflet-control-zoom {
  border: 1px solid var(--border-color) !important;
  box-shadow: 0 4px 20px rgba(0,0,0,0.5) !important;
}

.leaflet-top.leaflet-left {
  top: 95px !important;
  left: 15px !important;
}

.leaflet-bar a {
  background-color: var(--bg-card) !important;
  color: var(--text-main) !important;
  border-bottom: 1px solid var(--border-color) !important;
  transition: all 0.2s ease;
}

.leaflet-bar a:hover {
  background-color: var(--bg-card-hover) !important;
  color: var(--color-cyan) !important;
}

.leaflet-control-attribution {
  background: rgba(10, 12, 16, 0.8) !important;
  color: var(--text-muted) !important;
  font-size: 0.65rem !important;
}

/* Sidebar overlay style */
.sidebar {
  position: absolute;
  top: 95px;
  left: auto;
  right: 15px;
  bottom: 15px;
  width: 360px;
  z-index: 1000;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  pointer-events: none; /* Let clicks pass through empty spaces to map */
}

.sidebar-content {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  gap: 15px;
  pointer-events: auto; /* Re-enable clicks for sidebar content */
  overflow-y: auto;
  padding-right: 2px;
}

.sidebar-toggle {
  position: absolute;
  left: -32px;
  right: auto;
  top: 50%;
  transform: translateY(-50%);
  width: 32px;
  height: 60px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-right: none;
  border-radius: 8px 0 0 8px;
  color: var(--color-cyan);
  cursor: pointer;
  pointer-events: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: -4px 4px 20px rgba(0,0,0,0.4);
  transition: all 0.2s ease;
  z-index: 1001;
}

.sidebar-toggle:hover {
  color: #fff;
  background-color: var(--bg-card-hover);
  box-shadow: var(--glow-cyan);
}

.sidebar.collapsed {
  transform: translateX(375px);
}

.sidebar .sidebar-toggle i {
  transform: rotate(180deg);
  transition: transform 0.2s ease;
}

.sidebar.collapsed .sidebar-toggle i {
  transform: rotate(0deg);
}

/* Sidebar Cards */
.control-card {
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 18px;
  box-shadow: 0 4px 25px rgba(0,0,0,0.4);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.control-card h3 {
  font-family: var(--font-mono);
  font-size: 1rem;
  letter-spacing: 1.5px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  padding-bottom: 8px;
  color: var(--color-cyan);
  display: flex;
  align-items: center;
  gap: 8px;
}

.control-card h3 i {
  font-size: 0.95rem;
}

.panel-tip {
  font-size: 0.72rem;
  color: var(--text-muted);
  line-height: 1.3;
}

/* Status Button Grid */
.status-selector-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

.status-btn {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 6px;
  padding: 10px 8px;
  color: var(--text-main);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 0.75rem;
  font-weight: 500;
  transition: all 0.2s ease;
}

.status-btn i {
  font-size: 1.1rem;
}

/* Status colors and actives */
.status-btn.btn-normal:hover, .status-btn.btn-normal.active {
  border-color: var(--color-normal);
  background: rgba(16, 185, 129, 0.1);
  color: var(--color-normal);
  box-shadow: 0 0 8px rgba(16, 185, 129, 0.2);
}

.status-btn.btn-help:hover, .status-btn.btn-help.active {
  border-color: var(--color-help);
  background: rgba(245, 158, 11, 0.1);
  color: var(--color-help);
  box-shadow: 0 0 8px rgba(245, 158, 11, 0.2);
}

.status-btn.btn-combat:hover, .status-btn.btn-combat.active {
  border-color: var(--color-combat);
  background: rgba(239, 68, 68, 0.15);
  color: var(--color-combat);
  box-shadow: 0 0 8px rgba(239, 68, 68, 0.3);
}

.status-btn.btn-rescue:hover, .status-btn.btn-rescue.active {
  border-color: var(--color-rescue);
  background: rgba(255, 0, 85, 0.18);
  color: var(--color-rescue);
  box-shadow: 0 0 10px rgba(255, 0, 85, 0.4);
  animation: pulse-border 1.5s infinite;
}

/* Control Actions */
.control-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 5px;
}

.primary-btn {
  width: 100%;
  background: linear-gradient(135deg, #00f0ff, #0077ff);
  border: none;
  border-radius: 6px;
  padding: 12px;
  color: var(--text-dark);
  font-weight: 700;
  font-family: var(--font-sans);
  font-size: 0.88rem;
  letter-spacing: 1px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.2s ease;
  box-shadow: 0 4px 15px rgba(0, 240, 255, 0.3);
}

.primary-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(0, 240, 255, 0.5);
  filter: brightness(1.1);
}

.primary-btn:active {
  transform: translateY(1px);
}

.toggle-container {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 2px;
}

/* Switch Styles */
.switch {
  position: relative;
  display: inline-block;
  width: 38px;
  height: 20px;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(255,255,255,0.1);
  transition: .4s;
  border: 1px solid rgba(255,255,255,0.08);
}

.slider:before {
  position: absolute;
  content: "";
  height: 12px;
  width: 12px;
  left: 3px;
  bottom: 3px;
  background-color: var(--text-muted);
  transition: .4s;
}

input:checked + .slider {
  background-color: rgba(0, 240, 255, 0.2);
  border-color: var(--color-cyan);
}

input:checked + .slider:before {
  transform: translateX(18px);
  background-color: var(--color-cyan);
  box-shadow: 0 0 6px var(--color-cyan);
}

.slider.round {
  border-radius: 20px;
}

.slider.round:before {
  border-radius: 50%;
}

.switch-label {
  font-size: 0.72rem;
  color: var(--text-main);
  font-weight: 500;
}

/* Tabs for Team / Markers List */
.tab-container {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 250px;
}

.tab-headers {
  display: flex;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

.tab-header {
  flex: 1;
  background: none;
  border: none;
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 0.8rem;
  padding: 10px 0;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
  text-align: center;
}

.tab-header.active {
  color: var(--color-cyan);
  font-weight: 600;
}

.tab-header.active::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 0;
  width: 100%;
  height: 2px;
  background-color: var(--color-cyan);
  box-shadow: var(--glow-cyan);
}

.tab-contents {
  flex: 1;
  margin-top: 10px;
  overflow-y: auto;
  max-height: 250px;
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
}

/* Quick Add button */
.quick-add-bar {
  display: flex;
  width: 100%;
}

.toggle-mode-btn {
  width: 100%;
  background: rgba(0, 240, 255, 0.05);
  border: 1px dashed var(--color-cyan);
  color: var(--color-cyan);
  padding: 8px;
  border-radius: 6px;
  font-size: 0.75rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all 0.2s ease;
  font-family: var(--font-sans);
}

.toggle-mode-btn:hover, .toggle-mode-btn.active {
  background: rgba(0, 240, 255, 0.15);
  border-style: solid;
  color: #fff;
  box-shadow: var(--glow-cyan);
}

/* Team & Marker List styling */
.empty-state {
  text-align: center;
  padding: 25px 0;
  color: var(--text-muted);
  font-size: 0.75rem;
  font-style: italic;
}

.team-list, .markers-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.list-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.04);
  border-radius: 6px;
  transition: all 0.2s ease;
}

.list-item:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255,255,255,0.1);
}

.item-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0; /* Ensures overflow text-ellipsis works */
}

.status-indicator-bar {
  width: 4px;
  height: 24px;
  border-radius: 2px;
}

.item-meta {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.item-title {
  font-size: 0.78rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.item-subtitle {
  font-size: 0.65rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.item-actions {
  display: flex;
  gap: 6px;
}

.action-icon-btn {
  background: none;
  border: 1px solid rgba(255,255,255,0.1);
  color: var(--text-muted);
  width: 26px;
  height: 26px;
  border-radius: 4px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.72rem;
  transition: all 0.2s ease;
}

.action-icon-btn:hover {
  border-color: var(--color-cyan);
  color: var(--color-cyan);
  box-shadow: 0 0 5px rgba(0, 240, 255, 0.2);
}

.action-icon-btn.delete-btn:hover {
  border-color: var(--color-rescue);
  color: var(--color-rescue);
  box-shadow: 0 0 5px rgba(255, 0, 85, 0.2);
}

/* Modals styling */
.custom-modal {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(5, 7, 10, 0.6);
  z-index: 2000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  pointer-events: auto;
}

.custom-modal.active {
  display: flex;
}

.modal-content {
  width: 100%;
  max-width: 420px;
  animation: slide-up 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  overflow: hidden;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}

.modal-header h3 {
  font-family: var(--font-mono);
  font-size: 1rem;
  color: var(--color-cyan);
  letter-spacing: 1px;
}

.close-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.4rem;
  cursor: pointer;
  transition: color 0.2s;
}

.close-btn:hover {
  color: #fff;
}

.modal-body {
  padding: 20px;
}

.form-group {
  margin-bottom: 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-group label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-main);
  letter-spacing: 0.5px;
}

.form-group input[type="text"], .form-group textarea {
  background: rgba(0,0,0,0.3);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  padding: 10px 12px;
  color: var(--text-main);
  font-size: 0.8rem;
  outline: none;
  font-family: var(--font-sans);
  transition: border-color 0.2s;
}

.form-group input[type="text"]:focus, .form-group textarea:focus {
  border-color: var(--color-cyan);
  box-shadow: 0 0 6px rgba(0, 240, 255, 0.15);
}

/* Marker Type Grid in Modal */
.marker-type-selector {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

.type-option {
  position: relative;
  cursor: pointer;
}

.type-option input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.type-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 6px;
  font-size: 0.72rem;
  font-weight: 500;
  background: rgba(255,255,255,0.02);
  border: 1px solid rgba(255,255,255,0.06);
  color: var(--text-muted);
  transition: all 0.2s ease;
}

.type-option input:checked + .type-badge {
  color: #fff;
  border-color: currentColor;
  background: rgba(255, 255, 255, 0.05);
}

/* Custom Marker Option colors */
.badge-nato-friend { color: #1e90ff; }   /* Blue */
.badge-nato-enemy { color: #e0185a; }    /* Pink-Red */
.badge-nato-neutral { color: #228b22; }  /* Dark Green */
.badge-nato-unknown { color: #e6ac00; }  /* Yellow-Gold */
.badge-target { color: #38bdf8; }     /* Blue */
.badge-enemy { color: #ef4444; }      /* Red */
.badge-danger { color: #f59e0b; }     /* Orange/Yellow */
.badge-rally { color: #10b981; }      /* Green */
.badge-note { color: #a855f7; }       /* Purple */

.type-option input:checked + .badge-nato-friend { box-shadow: 0 0 8px rgba(0, 180, 216, 0.3); }
.type-option input:checked + .badge-nato-enemy { box-shadow: 0 0 8px rgba(255, 107, 139, 0.3); }
.type-option input:checked + .badge-nato-neutral { box-shadow: 0 0 8px rgba(16, 185, 129, 0.3); }
.type-option input:checked + .badge-nato-unknown { box-shadow: 0 0 8px rgba(251, 191, 36, 0.3); }
.type-option input:checked + .badge-target { box-shadow: 0 0 8px rgba(56, 189, 248, 0.3); }
.type-option input:checked + .badge-enemy { box-shadow: 0 0 8px rgba(239, 68, 68, 0.3); }
.type-option input:checked + .badge-danger { box-shadow: 0 0 8px rgba(245, 158, 11, 0.3); }
.type-option input:checked + .badge-rally { box-shadow: 0 0 8px rgba(16, 185, 129, 0.3); }
.type-option input:checked + .badge-note { box-shadow: 0 0 8px rgba(168, 85, 247, 0.3); }

/* NATO Map Markers styling */
.custom-tactical-marker-nato {
  background: none !important;
  border: none !important;
}
.nato-marker-wrapper {
  display: flex;
  justify-content: center;
  align-items: center;
  filter: drop-shadow(0 0 5px rgba(0, 0, 0, 0.8));
  transition: transform 0.2s ease;
}
.nato-marker-wrapper:hover {
  transform: scale(1.2);
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 20px;
}

.cancel-btn {
  background: none;
  border: 1px solid rgba(255,255,255,0.1);
  color: var(--text-muted);
  padding: 10px 16px;
  border-radius: 6px;
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.cancel-btn:hover {
  border-color: rgba(255,255,255,0.2);
  color: #fff;
}

.submit-btn {
  background: linear-gradient(135deg, var(--color-cyan), #0077ff);
  border: none;
  color: var(--text-dark);
  padding: 10px 20px;
  border-radius: 6px;
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 4px 10px rgba(0, 240, 255, 0.2);
}

.submit-btn:hover {
  filter: brightness(1.1);
  box-shadow: 0 4px 15px rgba(0, 240, 255, 0.4);
}

/* Login Screen Overlay */
.login-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(6, 8, 12, 0.9);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.login-modal {
  width: 100%;
  max-width: 400px;
  padding: 30px;
  text-align: center;
}

.login-shield {
  font-size: 3rem;
  color: var(--color-cyan);
  text-shadow: var(--glow-cyan);
  margin-bottom: 15px;
}

.login-header h2 {
  font-family: var(--font-mono);
  font-size: 1.4rem;
  font-weight: 700;
  margin-bottom: 8px;
  letter-spacing: 1px;
}

.login-header p {
  font-size: 0.78rem;
  color: var(--text-muted);
  line-height: 1.4;
  margin-bottom: 24px;
}

.login-body {
  display: flex;
  flex-direction: column;
  gap: 12px;
  text-align: left;
}

.login-body label {
  font-size: 0.72rem;
  color: var(--text-muted);
}

.login-btn {
  margin-top: 10px;
  font-size: 0.95rem;
}

.divider {
  display: flex;
  align-items: center;
  text-align: center;
  margin: 15px 0;
  color: var(--text-muted);
  font-size: 0.7rem;
  letter-spacing: 1px;
  font-family: var(--font-mono);
}

.divider::before, .divider::after {
  content: '';
  flex: 1;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}

.divider::before { margin-right: 15px; }
.divider::after { margin-left: 15px; }

.line-btn {
  background: #06C755;
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 12px;
  font-weight: 700;
  font-size: 0.88rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  transition: all 0.2s ease;
  box-shadow: 0 4px 10px rgba(6, 199, 85, 0.2);
}

.line-btn:hover {
  background: #05b04b;
  box-shadow: 0 4px 15px rgba(6, 199, 85, 0.4);
  transform: translateY(-1px);
}

.line-btn:active {
  transform: translateY(1px);
}

/* Custom Tactical DivIcon Leaflet Marker styles */
.tactical-marker-user {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.user-marker-pin {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid #ffffff;
  box-shadow: 0 0 10px rgba(0,0,0,0.5);
  z-index: 10;
  box-sizing: border-box;
}

/* 白心點 (White Center Dot) */
.user-marker-center-dot {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 4px;
  height: 4px;
  background-color: #ffffff;
  border-radius: 50%;
  box-shadow: 0 0 2px rgba(255, 255, 255, 0.95), 0 0 1px rgba(0, 0, 0, 0.6);
  pointer-events: none;
  z-index: 12;
}

.user-marker-pin::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 4px;
  height: 4px;
  background-color: #ffffff;
  border-radius: 50%;
  box-shadow: 0 0 2px rgba(255, 255, 255, 0.95), 0 0 1px rgba(0, 0, 0, 0.6);
  pointer-events: none;
  z-index: 12;
}

.user-marker-label {
  position: absolute;
  top: -22px;
  background: rgba(10, 12, 16, 0.85);
  border: 1px solid rgba(255,255,255,0.15);
  color: var(--text-main);
  padding: 2px 6px;
  border-radius: 3px;
  font-family: var(--font-mono);
  font-size: 0.65rem;
  white-space: nowrap;
  box-shadow: 0 2px 8px rgba(0,0,0,0.4);
  pointer-events: none;
}

/* Pulsing radar ripples on status */
.pulse-ripple {
  position: absolute;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  animation: pulse-ripple 2s infinite ease-out;
  opacity: 0;
  pointer-events: none;
  z-index: 5;
}

/* Assign marker colors based on status */
.status-normal .user-marker-pin { background-color: var(--color-normal); box-shadow: 0 0 8px var(--color-normal); }
.status-normal .user-marker-label { border-color: var(--color-normal); }

.status-help .user-marker-pin { background-color: var(--color-help); box-shadow: 0 0 8px var(--color-help); }
.status-help .user-marker-label { border-color: var(--color-help); }
.status-help .pulse-ripple { border: 2px solid var(--color-help); animation-duration: 2.2s; }

.status-combat .user-marker-pin { background-color: var(--color-combat); box-shadow: 0 0 10px var(--color-combat); }
.status-combat .user-marker-label { border-color: var(--color-combat); }
.status-combat .pulse-ripple { border: 2px solid var(--color-combat); animation-duration: 1.5s; }

.status-rescue .user-marker-pin { background-color: rgba(10, 16, 26, 0.95); border-color: var(--color-rescue); box-shadow: 0 0 12px var(--color-rescue); }
.status-rescue .user-marker-label { border-color: var(--color-rescue); font-weight: 700; color: #fff; }
.status-rescue .pulse-ripple {
  border: 3px solid var(--color-rescue);
  animation: pulse-ripple-rescue 1s infinite ease-out;
}

/* 求救狀態時在閃爍中心顯示半透明紅色三角形驚嘆號圖標 */
.status-rescue::after {
  content: '\f071'; /* FontAwesome fa-triangle-exclamation */
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-family: 'Font Awesome 6 Free';
  font-weight: 900;
  font-size: 30px; /* 放大 3 倍 (10px -> 30px) */
  color: var(--color-rescue);
  z-index: 15;
  pointer-events: none;
  animation: sos-pulse 1s infinite ease-in-out;
  text-shadow: 0 0 8px rgba(255, 0, 85, 0.8), 0 0 2px #000;
}

@keyframes sos-pulse {
  0%, 100% {
    transform: translate(-50%, -50%) scale(0.95);
    opacity: 0.7;
  }
  50% {
    transform: translate(-50%, -50%) scale(1.15);
    opacity: 0.95;
  }
}

.status-offline .user-marker-pin { background-color: #888888; box-shadow: 0 0 8px #888888; }
.status-offline .user-marker-label { border-color: #888888; color: #888888; }
.status-offline .pulse-ripple { display: none; }

/* Custom Map Marker styles for added points (Targets, Enemies, etc.) */
.tactical-marker-point {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  filter: drop-shadow(0px 2px 4px rgba(0,0,0,0.8));
}

.marker-point-target { color: #38bdf8; text-shadow: 0 0 8px rgba(56, 189, 248, 0.6); }
.marker-point-enemy { color: #ef4444; text-shadow: 0 0 8px rgba(239, 68, 68, 0.6); }
.marker-point-danger { color: #f59e0b; text-shadow: 0 0 8px rgba(245, 158, 11, 0.6); }
.marker-point-rally { color: #10b981; text-shadow: 0 0 8px rgba(16, 185, 129, 0.6); }
.marker-point-note { color: #a855f7; text-shadow: 0 0 8px rgba(168, 85, 247, 0.6); }

/* Keyframes animations */
@keyframes pulse {
  0% { transform: scale(0.95); opacity: 0.8; }
  50% { transform: scale(1.1); opacity: 1; }
  100% { transform: scale(0.95); opacity: 0.8; }
}

@keyframes blink {
  0%, 100% { opacity: 0.4; }
  50% { opacity: 1; }
}

@keyframes pulse-border {
  0%, 100% { border-color: rgba(255, 0, 85, 0.5); }
  50% { border-color: rgba(255, 0, 85, 1); box-shadow: 0 0 12px rgba(255, 0, 85, 0.5); }
}

@keyframes pulse-ripple {
  0% { transform: scale(0.4); opacity: 0; }
  25% { opacity: 0.8; }
  100% { transform: scale(2.8); opacity: 0; }
}

@keyframes pulse-ripple-rescue {
  0% { transform: scale(1.2); opacity: 0; }
  25% { opacity: 0.8; }
  100% { transform: scale(8.4); opacity: 0; }
}

@keyframes slide-up {
  from { transform: translateY(20px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

@keyframes slide-down {
  from { transform: translateY(-20px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

/* Mobile Responsive Adjustments */
@media (max-width: 768px) {
  .tactical-header {
    top: 10px;
    left: 10px;
    right: 10px;
    height: 36px;
    padding: 0;
  }
  
  .status-widget {
    position: absolute !important;
    top: 0 !important;
    right: 0 !important;
    left: auto !important;
    transform: none !important;
    height: 18px !important;
    padding: 0 6px !important;
    border-radius: 4px !important;
    font-size: 0.5rem !important;
    gap: 3px !important;
  }
  
  .logo-widget {
    height: 18px;
    padding: 0 6px;
    border-radius: 4px;
  }
  
  .leaflet-top.leaflet-left {
    top: 60px !important;
    left: 10px !important;
  }

  .logo h1 {
    font-size: 0.5rem;
    letter-spacing: 0.5px;
  }
  
  .logo i {
    font-size: 0.5rem;
  }
  
  .sidebar {
    top: auto;
    left: 10px;
    right: 10px;
    bottom: 10px;
    width: calc(100% - 20px);
    max-height: 60%;
    transform: translateY(0);
    transition: transform 0.3s ease;
  }
  
  .sidebar.collapsed {
    transform: translateY(calc(100% - 15px));
  }
  
  .sidebar-toggle {
    left: auto;
    right: 15px;
    top: -24px;
    width: 50px;
    height: 24px;
    border-radius: 8px 8px 0 0;
    border: 1px solid var(--border-color);
    border-bottom: none;
    transform: none;
  }
  
  /* Mobile map switcher overrides moved to the bottom of the file to guarantee correct cascading order */
  
  .sidebar.collapsed .sidebar-toggle i {
    transform: rotate(-90deg);
  }
  
  .sidebar-toggle i {
    transform: rotate(90deg);
  }
  
  .sidebar-content {
    flex-direction: column;
    height: 100%;
    gap: 10px;
    overflow-y: auto;
    overflow-x: hidden;
  }
  
  .control-card {
    min-width: 100%;
    width: 100%;
    flex-shrink: 0;
    padding: 12px;
    gap: 8px;
    height: auto;
    overflow-y: visible;
  }
  
  .control-card h3 {
    padding-bottom: 5px;
  }

  .status-selector-grid {
    gap: 5px;
  }

  .status-btn {
    padding: 6px 4px;
    font-size: 0.7rem;
  }

  .tab-container {
    min-height: auto;
  }
}

/* ==========================================================================
   8. Enhanced Features (Chat, Simulator, Ruler, Geofence Alert)
   ========================================================================== */

/* Chat Container Styles */
.chat-container {
  display: flex;
  flex-direction: column;
  height: 250px;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 8px;
  overflow: hidden;
}

.chat-messages {
  flex: 1;
  padding: 10px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.chat-bubble {
  display: flex;
  flex-direction: column;
  max-width: 85%;
  padding: 8px 10px;
  border-radius: 8px;
  font-size: 0.75rem;
  line-height: 1.4;
  position: relative;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.chat-bubble-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 15px;
  font-family: var(--font-mono);
  font-size: 0.65rem;
  margin-bottom: 4px;
}

.chat-username {
  font-weight: 700;
  color: var(--color-cyan);
}

.chat-time {
  color: var(--text-muted);
}

.chat-text {
  color: var(--text-main);
  word-break: break-all;
}

/* Chat bubble statuses with neon borders */
.chat-bubble.msg-normal {
  border-left: 3px solid var(--color-normal);
}

.chat-bubble.msg-help {
  border-left: 3px solid var(--color-help);
  background: rgba(245, 158, 11, 0.03);
  box-shadow: inset 0 0 5px rgba(245, 158, 11, 0.05);
}

.chat-bubble.msg-combat {
  border-left: 3px solid var(--color-combat);
  background: rgba(239, 68, 68, 0.04);
  box-shadow: inset 0 0 5px rgba(239, 68, 68, 0.08);
}

.chat-bubble.msg-rescue {
  border-left: 3px solid var(--color-rescue);
  background: rgba(255, 0, 85, 0.05);
  box-shadow: 0 0 8px rgba(255, 0, 85, 0.1), inset 0 0 8px rgba(255, 0, 85, 0.1);
  animation: pulse-border 1.5s infinite;
}

/* Chat Input Bar */
.chat-input-area {
  display: flex;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  background: rgba(10, 12, 16, 0.9);
}

#chat-input {
  flex: 1;
  background: transparent;
  border: none;
  padding: 10px 12px;
  color: var(--text-main);
  font-size: 0.78rem;
  outline: none;
}

.chat-send-btn {
  background: transparent;
  border: none;
  color: var(--color-cyan);
  padding: 0 15px;
  cursor: pointer;
  transition: all 0.2s;
}

.chat-send-btn:hover {
  color: #fff;
  text-shadow: var(--glow-cyan);
}

/* GPS Simulator Styling */
.simulator-divider {
  height: 1px;
  background: rgba(255, 255, 255, 0.06);
  margin: 10px 0;
}

.simulator-title {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: 0.5px;
  margin-bottom: 2px;
}

/* Ruler Mode active state */
.toggle-mode-btn.ruler-btn.active {
  background: rgba(56, 189, 248, 0.15);
  border: 1px solid #38bdf8;
  color: #38bdf8;
  box-shadow: 0 0 8px rgba(56, 189, 248, 0.3);
}

/* Geofence Alert Overlay Screen Visual Effect */
.geofence-alarm-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  z-index: 9999;
  box-shadow: inset 0 0 80px rgba(255, 0, 85, 0);
  transition: all 0.3s ease;
}

.geofence-alarm-overlay.active {
  animation: geofence-flash 1.5s infinite alternate ease-in-out;
}

@keyframes geofence-flash {
  0% {
    box-shadow: inset 0 0 30px rgba(255, 0, 85, 0.2);
    background: rgba(255, 0, 85, 0.02);
  }
  100% {
    box-shadow: inset 0 0 90px rgba(255, 0, 85, 0.85);
    background: rgba(255, 0, 85, 0.06);
  }
}

/* Custom Tactical Ruler Leaflet Popup styles */
.ruler-popup {
  font-size: 0.7rem;
  font-family: var(--font-mono);
  color: #38bdf8;
  text-shadow: 0 0 4px rgba(56, 189, 248, 0.4);
}

/* ============================================================
   Map Layer Switcher Panel
   ============================================================ */
.map-layer-switcher {
  position: absolute;
  bottom: 40px;
  left: 15px;
  right: auto;
  z-index: 1001;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
}

.layer-switcher-toggle {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--color-cyan);
  font-size: 1.1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 4px 20px rgba(0,0,0,0.5), var(--glow-cyan);
  transition: all 0.25s ease;
}

.layer-switcher-toggle:hover {
  background: var(--bg-card-hover);
  transform: translateY(-2px);
  box-shadow: 0 6px 25px rgba(0,0,0,0.6), 0 0 15px rgba(0, 240, 255, 0.4);
}

.layer-switcher-toggle.active {
  background: rgba(0, 240, 255, 0.15);
  border-color: var(--color-cyan);
}

@keyframes slide-right {
  from {
    opacity: 0;
    transform: translateX(-15px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* Layer panel popup */
.layer-panel {
  display: none;
  flex-direction: column;
  gap: 10px;
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 14px;
  min-width: 220px;
  box-shadow: 0 8px 40px rgba(0,0,0,0.6), 0 0 0 1px rgba(0,240,255,0.05);
  animation: slide-right 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  position: absolute;
  left: 50px;
  bottom: 0;
  z-index: 1005;
}

/* Digital Indicator HUD Panel */
.digital-indicator-panel {
  position: absolute;
  bottom: 40px;
  left: 70px;
  z-index: 1002;
  width: 250px;
  padding: 12px;
  font-family: var(--font-mono);
  display: none;
  flex-direction: column;
  gap: 8px;
  border-radius: 10px;
  background: rgba(10, 16, 26, 0.9);
  border: 1px solid var(--border-color);
  box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.5), var(--glow-cyan);
  animation: slide-right 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.digital-indicator-panel.open {
  display: flex;
}

.indicator-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.8rem;
  color: var(--color-cyan);
  border-bottom: 1px solid rgba(0, 240, 255, 0.15);
  padding-bottom: 6px;
  font-weight: bold;
}

.indicator-close-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 1.1rem;
  cursor: pointer;
  line-height: 1;
}

.indicator-close-btn:hover {
  color: var(--color-rescue);
}

.indicator-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.72rem;
  line-height: 1.5;
}

.indicator-row.row-coords {
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
}

.indicator-label {
  color: var(--text-muted);
}

.indicator-value {
  color: var(--text-main);
  font-weight: bold;
}

.map-control-btn.success-flash {
  background: rgba(16, 185, 129, 0.3) !important;
  border-color: var(--color-normal) !important;
  color: var(--color-normal) !important;
  box-shadow: 0 0 15px rgba(16, 185, 129, 0.6) !important;
}

.layer-panel.open {
  display: flex;
}

.layer-panel-title {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--color-cyan);
  letter-spacing: 1.5px;
  text-transform: uppercase;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(0,240,255,0.1);
  display: flex;
  align-items: center;
  gap: 6px;
}

.layer-options {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.layer-option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 8px;
  background: rgba(255,255,255,0.02);
  border: 1px solid rgba(255,255,255,0.06);
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: left;
  width: 100%;
}

.layer-option:hover {
  background: rgba(0, 240, 255, 0.06);
  border-color: rgba(0, 240, 255, 0.2);
}

.layer-option.active {
  background: rgba(0, 240, 255, 0.1);
  border-color: var(--color-cyan);
  box-shadow: 0 0 10px rgba(0, 240, 255, 0.15);
}

.layer-preview {
  width: 42px;
  height: 32px;
  border-radius: 5px;
  flex-shrink: 0;
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,0.12);
}

.layer-preview .preview-grid {
  position: absolute;
  inset: 0;
  background-image: 
    linear-gradient(rgba(255,255,255,0.07) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.07) 1px, transparent 1px);
  background-size: 10px 10px;
}

.layer-preview .preview-dot {
  position: absolute;
  bottom: 5px;
  right: 5px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--color-cyan);
  box-shadow: 0 0 4px var(--color-cyan);
}

.layer-preview-dark {
  background: linear-gradient(135deg, #0d1117 0%, #161b22 50%, #0d1117 100%);
}
.layer-preview-dark .preview-grid {
  background-image: 
    linear-gradient(rgba(0,240,255,0.12) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0,240,255,0.12) 1px, transparent 1px);
}

.layer-preview-color {
  background: linear-gradient(135deg, #e8f4f8 0%, #d4e8c2 40%, #c6d9f0 100%);
}
.layer-preview-color .preview-grid {
  background-image: 
    linear-gradient(rgba(100,120,140,0.2) 1px, transparent 1px),
    linear-gradient(90deg, rgba(100,120,140,0.2) 1px, transparent 1px);
}
.layer-preview-color .preview-dot {
  background: #e25822;
  box-shadow: 0 0 4px #e25822;
}

.layer-preview-satellite {
  background: linear-gradient(135deg, #1a3a2a 0%, #2d4a3e 35%, #1e2d1e 60%, #3a5a2a 100%);
}
.layer-preview-satellite .preview-grid {
  background-image: 
    linear-gradient(rgba(255,255,255,0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.05) 1px, transparent 1px);
}
.layer-preview-satellite::before {
  content: '';
  position: absolute;
  top: 4px;
  left: 6px;
  width: 16px;
  height: 10px;
  background: rgba(255,255,255,0.15);
  border-radius: 2px;
}
.layer-preview-satellite .preview-dot {
  background: #ffcc00;
  box-shadow: 0 0 4px #ffcc00;
}

.layer-preview-topo {
  background: linear-gradient(155deg, #f0e6cc 0%, #d9c9a3 30%, #c4b380 60%, #e8d5a3 100%);
}
.layer-preview-topo .preview-grid {
  background-image: 
    linear-gradient(rgba(120,80,20,0.15) 1px, transparent 1px),
    linear-gradient(90deg, rgba(120,80,20,0.15) 1px, transparent 1px);
  background-size: 8px 8px;
}
.layer-preview-topo::before {
  content: '';
  position: absolute;
  top: 8px;
  left: 4px;
  border-left: 10px solid transparent;
  border-right: 10px solid transparent;
  border-bottom: 14px solid rgba(100,70,20,0.5);
}
.layer-preview-topo .preview-dot {
  background: #cc3322;
  box-shadow: 0 0 4px #cc3322;
}

.layer-preview-hybrid {
  background: linear-gradient(135deg, #1a3020 0%, #223828 40%, #1e2e1e 100%);
}
.layer-preview-hybrid::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 40%;
  background: linear-gradient(to top, rgba(255,255,255,0.06), transparent);
}
.layer-preview-hybrid .preview-dot {
  background: #00aaff;
  box-shadow: 0 0 4px #00aaff;
}

.layer-label {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.layer-name {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-main);
}

.layer-option.active .layer-name {
  color: var(--color-cyan);
}

.layer-desc {
  font-size: 0.62rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

.layer-current-label {
  font-size: 0.68rem;
  color: var(--color-normal);
  font-family: var(--font-mono);
  display: flex;
  align-items: center;
  gap: 5px;
  padding-top: 6px;
  border-top: 1px solid rgba(255,255,255,0.05);
}

.leaflet-tile-pane {
  transition: opacity 0.4s ease;
}

body.map-mode-color .leaflet-bar a {
  background-color: rgba(255, 255, 255, 0.95) !important;
  color: #1a1a2e !important;
  border-bottom: 1px solid rgba(0,0,0,0.1) !important;
}

body.map-mode-color .leaflet-bar a:hover {
  background-color: #f0f4ff !important;
  color: #0077ff !important;
}

body.map-mode-color .leaflet-control-attribution {
  background: rgba(255, 255, 255, 0.85) !important;
  color: #444 !important;
}

body.map-mode-satellite .leaflet-bar a,
body.map-mode-topo .leaflet-bar a,
body.map-mode-hybrid .leaflet-bar a {
  background-color: rgba(20, 30, 20, 0.9) !important;
}

/* Map Control Buttons */
.map-control-btn {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--color-cyan);
  font-size: 1.1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 4px 20px rgba(0,0,0,0.5), var(--glow-cyan);
  transition: all 0.25s ease;
}


.map-control-btn:hover {
  background: var(--bg-card-hover);
  transform: translateY(-2px);
  box-shadow: 0 6px 25px rgba(0,0,0,0.6), 0 0 15px rgba(0, 240, 255, 0.4);
}

.map-control-btn.active {
  background: rgba(0, 240, 255, 0.15);
  border-color: var(--color-cyan);
  color: #fff;
  animation: pulse-border 2s infinite;
}

@keyframes pulse-border {
  0% {
    box-shadow: 0 0 12px rgba(0, 240, 255, 0.5), inset 0 0 6px rgba(0, 240, 255, 0.3);
  }
  50% {
    box-shadow: 0 0 20px rgba(0, 240, 255, 0.8), inset 0 0 10px rgba(0, 240, 255, 0.5);
  }
  100% {
    box-shadow: 0 0 12px rgba(0, 240, 255, 0.5), inset 0 0 6px rgba(0, 240, 255, 0.3);
  }
}

/* Collapsible Cards */
.card-header {
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  user-select: none;
  width: 100%;
}

.card-toggle-icon {
  font-size: 0.8rem;
  color: var(--color-cyan);
  transition: transform 0.3s ease;
  padding: 4px;
}

.control-card.collapsed {
  gap: 0;
  padding-bottom: 12px;
}

.control-card.collapsed .card-body {
  display: none;
}

.control-card.collapsed .card-toggle-icon {
  transform: rotate(-90deg);
}

.control-card.collapsed h3 {
  border-bottom: none;
  padding-bottom: 0;
}

/* Mobile responsive overrides placed at the end to prevent desktop style overrides */
@media (max-width: 768px) {
  .map-layer-switcher {
    bottom: auto;
    top: 150px !important;
    left: 10px !important;
    right: auto !important;
    align-items: flex-start !important;
  }
  
  .layer-panel {
    position: absolute !important;
    left: 50px !important;
    top: auto !important;
    bottom: 0 !important;
    animation: slide-right 0.25s cubic-bezier(0.16, 1, 0.3, 1) !important;
  }

  .digital-indicator-panel {
    bottom: auto !important;
    top: 150px !important;
    left: 60px !important;
    width: 220px !important;
  }
}

/* Mobile Landscape Layout Optimization */
@media (max-width: 950px) and (orientation: landscape), (max-height: 500px) and (orientation: landscape) {
  /* Header Panel as Right-side Bar */
  .tactical-header {
    top: 10px !important;
    bottom: 10px !important;
    right: 10px !important;
    left: auto !important;
    width: 140px !important;
    height: auto !important;
    flex-direction: column !important;
    justify-content: flex-start !important;
    align-items: center !important;
    padding: 0 !important;
    gap: 12px !important;
  }
  
  .status-widget {
    position: fixed !important;
    top: 10px !important;
    right: 10px !important;
    left: auto !important;
    bottom: auto !important;
    width: auto !important;
    height: 18px !important;
    padding: 0 6px !important;
    border-radius: 4px !important;
    z-index: 2001 !important;
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    justify-content: center !important;
    font-size: 0.5rem !important;
    gap: 3px !important;
  }

  .logo-widget {
    position: fixed !important;
    top: 10px !important;
    left: 10px !important;
    right: auto !important;
    bottom: auto !important;
    width: auto !important;
    height: 18px !important;
    padding: 0 6px !important;
    border-radius: 4px !important;
    z-index: 2001 !important;
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    justify-content: center !important;
  }
  
  .logo {
    flex-direction: row !important;
    align-items: center !important;
    gap: 3px !important;
    text-align: left !important;
  }
  
  .logo h1 {
    font-size: 0.5rem !important;
    letter-spacing: 0.5px !important;
  }
  .logo i {
    font-size: 0.5rem !important;
  }
  
  .logo .sub-title {
    display: none !important;
  }
  
  .connection-status {
    margin-top: 5px !important;
    font-size: 0.7rem !important;
    padding: 4px 8px !important;
  }
  
  .user-info {
    align-items: center !important;
    text-align: center !important;
  }
  
  .user-name {
    max-width: 160px !important;
    font-size: 0.75rem !important;
  }
  
  .gps-status-badge {
    display: block !important;
  }

  /* Right Collapsible Sidebar */
  .sidebar {
    top: 36px !important;
    left: auto !important;
    right: 10px !important;
    bottom: 10px !important;
    width: 320px !important;
    height: auto !important;
    max-height: calc(100% - 46px) !important;
    transform: translateX(0) !important;
  }
  
  .sidebar.collapsed {
    transform: translateX(335px) !important;
  }
  
  .sidebar-toggle {
    left: -32px !important;
    right: auto !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
    width: 32px !important;
    height: 60px !important;
    border-radius: 8px 0 0 8px !important;
    border: 1px solid var(--border-color) !important;
    border-right: none !important;
  }
  
  .sidebar .sidebar-toggle i {
    transform: rotate(180deg) !important;
  }
  
  .sidebar.collapsed .sidebar-toggle i {
    transform: rotate(0deg) !important;
  }
  
  .sidebar-content {
    height: 100% !important;
    overflow-y: auto !important;
  }
  
  /* Map Controls repositioned to Left Side (since sidebar is on right) */
  .leaflet-top.leaflet-left {
    top: 36px !important;
    left: 10px !important;
    right: auto !important;
  }
  
  .map-layer-switcher {
    flex-direction: row !important;
    bottom: 10px !important;
    top: auto !important;
    left: 10px !important;
    right: auto !important;
    gap: 6px !important;
  }
  
  .layer-panel {
    position: absolute !important;
    left: 0 !important;
    bottom: 50px !important;
    top: auto !important;
    animation: slide-up 0.25s cubic-bezier(0.16, 1, 0.3, 1) !important;
  }

  .digital-indicator-panel {
    position: absolute !important;
    left: 0 !important;
    bottom: 50px !important;
    top: auto !important;
    width: 220px !important;
    animation: slide-up 0.25s cubic-bezier(0.16, 1, 0.3, 1) !important;
  }
  
  /* Compact Login Modal for landscape */
  .login-modal {
    padding: 15px !important;
    max-height: 90% !important;
    overflow-y: auto !important;
  }
  
  .login-shield {
    font-size: 2rem !important;
    margin-bottom: 8px !important;
  }
  
  .login-header h2 {
    font-size: 1.1rem !important;
    margin-bottom: 4px !important;
  }
  
  .login-header p {
    margin-bottom: 10px !important;
  }
  
  .divider {
    margin: 8px 0 !important;
  }
}

@keyframes border-glow-flash {
  0% {
    box-shadow: 0 4px 25px rgba(0,0,0,0.4);
    border-color: var(--border-color);
  }
  30% {
    box-shadow: 0 0 18px rgba(0, 240, 255, 0.6);
    border-color: var(--color-cyan);
  }
  100% {
    box-shadow: 0 4px 25px rgba(0,0,0,0.4);
    border-color: var(--border-color);
  }
}

.control-card.highlight-flash {
  animation: border-glow-flash 1.5s ease-in-out;
}

/* ============================================================
   隱藏地圖文字標籤與後續功能標籤模式
   ============================================================ */
body.hide-labels .user-marker-label,
body.hide-labels .ruler-popup,
body.hide-labels .ind-callsign-label {
  display: none !important;
}

/* ============================================================
   浮動資訊圖標與對齊
   ============================================================ */
.tactical-info-btn {
  position: absolute;
  top: -14px;
  right: -14px;
  width: 28px;
  height: 28px;
  background: rgba(10, 16, 26, 0.95) !important;
  border: 1.5px solid rgba(0, 240, 255, 0.7) !important;
  border-radius: 50% !important;
  color: var(--color-cyan) !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  font-size: 16px !important;
  cursor: pointer !important;
  box-shadow: 0 0 8px rgba(0, 240, 255, 0.5) !important;
  transition: opacity 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease !important;
  z-index: 1000 !important;
  pointer-events: none !important;
  opacity: 0 !important;
}

/* 父容器有 .show-info 時才顯示資訊按鈕 */
.show-info > .tactical-info-btn {
  pointer-events: auto !important;
  opacity: 1 !important;
}

.tactical-info-btn:hover {
  transform: scale(1.2) !important;
  background: var(--color-cyan) !important;
  color: var(--text-dark) !important;
  box-shadow: 0 0 14px var(--color-cyan) !important;
}

.tactical-info-btn i {
  font-size: 16px !important;
  pointer-events: none !important;
}

.nato-marker-wrapper, .tactical-marker-point, .tactical-marker-user {
  position: relative !important;
}

/* 登入畫面警語區塊 */
.login-warning-box {
  background: rgba(255, 0, 85, 0.08);
  border: 1.5px solid rgba(255, 0, 85, 0.45);
  border-radius: 6px;
  padding: 10px 14px;
  margin-bottom: 18px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  box-shadow: 0 0 10px rgba(255, 0, 85, 0.15);
}

.login-warning-box .warning-icon {
  color: var(--color-rescue);
  font-size: 1.1rem;
  margin-top: 2px;
  animation: warning-flash 1.5s infinite alternate;
}

.login-warning-box .warning-text {
  color: #f1f5f9;
  font-size: 0.78rem;
  line-height: 1.4;
  text-align: left;
}

.login-warning-box .warning-text strong {
  color: var(--color-rescue);
  font-weight: 700;
}

@keyframes warning-flash {
  0% { opacity: 0.4; }
  100% { opacity: 1; text-shadow: 0 0 8px var(--color-rescue); }
}

/* 數位指示器地圖標記 */
/* 外層容器：放大 icon 的點擊範圍與動畫空間 */
.custom-digital-indicator-container {
  width: 64px !important;
  height: 64px !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  overflow: visible !important;
  position: relative !important;
}

.digital-indicator-marker {
  position: relative;
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: visible;
}

/* 地圖標記中心的 SVG 圖示本體，帶霓虹紫發光 */
.digital-indicator-marker svg {
  filter:
    drop-shadow(0 0 4px rgba(233, 213, 255, 1))
    drop-shadow(0 0 10px rgba(216, 180, 254, 0.85))
    drop-shadow(0 0 18px rgba(168, 85, 247, 0.6));
  animation: indicator-svg-glow 1.6s ease-in-out infinite alternate;
  position: relative;
  z-index: 2;
}

@keyframes indicator-svg-glow {
  0%   { filter: drop-shadow(0 0 3px rgba(233, 213, 255, 1)) drop-shadow(0 0 8px rgba(216, 180, 254, 0.7)); }
  100% { filter: drop-shadow(0 0 6px rgba(233, 213, 255, 1)) drop-shadow(0 0 16px rgba(216, 180, 254, 1)) drop-shadow(0 0 28px rgba(168, 85, 247, 0.8)); }
}

/* 標記下方的發佈者呼號標籤（重命名避免與 HUD 面板衝突） */
.ind-callsign-label {
  position: absolute;
  bottom: -22px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(15, 23, 42, 0.97);
  border: 1px solid rgba(216, 180, 254, 0.6);
  color: #e9d5ff;
  padding: 1px 6px;
  border-radius: 3px;
  font-family: 'Share Tech Mono', monospace;
  font-size: 0.65rem;
  font-weight: 700;
  white-space: nowrap;
  box-shadow: 0 2px 8px rgba(0,0,0,0.6), 0 0 8px rgba(216, 180, 254, 0.3);
  pointer-events: none;
  z-index: 3;
  letter-spacing: 0.05em;
}

/* 紫色同心圓波紋閃爍（兩層） */
.indicator-purple-ripple,
.indicator-purple-ripple-2 {
  position: absolute;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  pointer-events: none;
  top: 50%;
  left: 50%;
  transform-origin: center center;
}

.indicator-purple-ripple {
  border: 2px solid rgba(216, 180, 254, 0.85);
  box-shadow: 0 0 10px rgba(216, 180, 254, 0.5), inset 0 0 4px rgba(216, 180, 254, 0.15);
  animation: purple-ripple-pulse 1.4s infinite ease-out;
  z-index: 1;
}

.indicator-purple-ripple-2 {
  border: 1.5px solid rgba(233, 213, 255, 0.55);
  animation: purple-ripple-pulse 1.4s infinite ease-out 0.7s;
  z-index: 1;
}

@keyframes purple-ripple-pulse {
  0% {
    transform: translate(-50%, -50%) scale(0.9);
    opacity: 0.95;
  }
  100% {
    transform: translate(-50%, -50%) scale(3.6);
    opacity: 0;
  }
}

/* 紫色指示線 (虛線流動動畫) */
.digital-indicator-line {
  stroke: #e9d5ff !important;
  stroke-width: 2.5 !important;
  stroke-dasharray: 8, 6;
  stroke-dashoffset: 0;
  animation: dash-flow 1.2s infinite linear;
  filter: drop-shadow(0 0 4px rgba(216, 180, 254, 0.8));
}

@keyframes dash-flow {
  to {
    stroke-dashoffset: -28;
  }
}

/* 當不是暗色地圖時（即非 dark），線條及圖標加上黑邊以提昇可視度 */
body:not(.map-mode-dark) .digital-indicator-marker svg {
  filter: drop-shadow(1px 0px 0px #000) drop-shadow(-1px 0px 0px #000) drop-shadow(0px 1px 0px #000) drop-shadow(0px -1px 0px #000) !important;
  animation: none !important;
}

body:not(.map-mode-dark) .indicator-purple-ripple {
  border: 2px solid rgba(216, 180, 254, 0.95) !important;
  box-shadow: 0 0 0 1px #000, inset 0 0 0 1px #000 !important;
}

body:not(.map-mode-dark) .indicator-purple-ripple-2 {
  border: 1.5px solid rgba(233, 213, 255, 0.8) !important;
  box-shadow: 0 0 0 1px #000, inset 0 0 0 1px #000 !important;
}

body:not(.map-mode-dark) .digital-indicator-line {
  filter: drop-shadow(1px 0px 0px #000) drop-shadow(-1px 0px 0px #000) drop-shadow(0px 1px 0px #000) drop-shadow(0px -1px 0px #000) !important;
}

/* ============================================================
   地理圍欄防禦區警報 (Geofence Overlay Style)
   ============================================================ */
.geofence-alarm-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(25, 10, 0, 0.2);
  z-index: 9998;
  display: none;
  pointer-events: none;
  box-shadow: inset 0 0 80px rgba(245, 158, 11, 0.6);
  animation: geofence-pulse 1.5s infinite alternate;
}
.geofence-alarm-overlay.active {
  display: block;
}
@keyframes geofence-pulse {
  0% { box-shadow: inset 0 0 30px rgba(245, 158, 11, 0.3); }
  100% { box-shadow: inset 0 0 90px rgba(245, 158, 11, 0.85); }
}

/* ============================================================
   緊急求救右上警報框 (SOS Alert Top-Right Panel)
   ============================================================ */
.sos-alarm-overlay {
  position: fixed;
  top: 75px; /* Below the header logo-widget and status-widget */
  right: 15px;
  width: 360px;
  height: auto;
  background: none;
  z-index: 1010; /* Higher than sidebar (z-index: 1000) */
  display: none; /* Controlled by JS class 'active' */
  pointer-events: auto;
  box-shadow: none;
  animation: none;
}

.sos-alarm-overlay.active {
  display: flex;
}

.sos-alarm-content {
  background: rgba(20, 6, 12, 0.95);
  border: 1.5px solid var(--color-rescue);
  border-radius: 10px;
  padding: 18px;
  text-align: center;
  box-shadow: 0 4px 25px rgba(255, 0, 85, 0.65), inset 0 0 10px rgba(255, 0, 85, 0.15);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  width: 100%;
  animation: sos-card-bounce 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.sos-alarm-icon {
  font-size: 2rem;
  color: var(--color-rescue);
  margin-bottom: 8px;
  text-shadow: var(--glow-red);
  animation: sos-icon-spin 1.2s infinite ease-in-out;
}

.sos-alarm-content h2 {
  font-family: var(--font-mono);
  font-size: 1.15rem;
  color: #fff;
  letter-spacing: 1.5px;
  margin-bottom: 6px;
  text-shadow: 0 0 6px rgba(255, 255, 255, 0.4);
}

.sos-alarm-operator-name {
  font-size: 0.82rem;
  color: #f1f5f9;
  margin-bottom: 15px;
  line-height: 1.3;
}

.sos-ack-btn {
  background: linear-gradient(135deg, #ff0055, #990033);
  border: none;
  border-radius: 6px;
  padding: 10px 16px;
  color: #fff;
  font-weight: 700;
  font-size: 0.85rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  box-shadow: 0 3px 10px rgba(255, 0, 85, 0.3);
  transition: all 0.2s ease;
}

.sos-ack-btn:hover {
  transform: translateY(-1.5px);
  box-shadow: 0 5px 15px rgba(255, 0, 85, 0.5);
  filter: brightness(1.1);
}

.sos-ack-btn:active {
  transform: translateY(1px);
}

/* ============================================================
   地圖模式紅光閃爍 (SOS Map Flash Overlay)
   ============================================================ */
.map-flash-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 999; /* Over Leaflet pane but below Leaflet controls */
  pointer-events: none;
  display: none;
  box-shadow: inset 0 0 80px rgba(255, 0, 85, 0.85);
  animation: sos-map-pulse 1.2s infinite alternate;
}

.map-flash-overlay.active {
  display: block;
}

@keyframes sos-map-pulse {
  0% {
    box-shadow: inset 0 0 30px rgba(255, 0, 85, 0.35);
    background: rgba(255, 0, 85, 0.04);
  }
  100% {
    box-shadow: inset 0 0 100px rgba(255, 0, 85, 0.95);
    background: rgba(255, 0, 85, 0.16);
  }
}

@keyframes sos-card-bounce {
  0% { transform: scale(0.6); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

@keyframes sos-icon-spin {
  0%, 100% { transform: scale(1) rotate(0deg); }
  50% { transform: scale(1.15) rotate(15deg); }
}

/* ============================================================
   隊員列表與本機個人卡片，在警告、戰鬥及求救狀態下的閃爍樣式
   ============================================================ */
.list-item.status-card-help,
.profile-widget.status-card-help {
  animation: card-flash-help 2s infinite alternate;
}

.list-item.status-card-combat,
.profile-widget.status-card-combat {
  animation: card-flash-combat 1.5s infinite alternate;
}

.list-item.status-card-rescue,
.profile-widget.status-card-rescue {
  animation: card-flash-rescue 1s infinite alternate;
}

@keyframes card-flash-help {
  0% {
    border-color: rgba(245, 158, 11, 0.25);
    background: rgba(20, 15, 5, 0.95);
    box-shadow: 0 0 3px rgba(245, 158, 11, 0.15);
  }
  100% {
    border-color: rgba(245, 158, 11, 0.8);
    background: rgba(75, 45, 5, 0.95);
    box-shadow: 0 0 14px rgba(245, 158, 11, 0.45), inset 0 0 8px rgba(245, 158, 11, 0.2);
  }
}

@keyframes card-flash-combat {
  0% {
    border-color: rgba(239, 68, 68, 0.3);
    background: rgba(20, 5, 5, 0.95);
    box-shadow: 0 0 3px rgba(239, 68, 68, 0.2);
  }
  100% {
    border-color: rgba(239, 68, 68, 0.9);
    background: rgba(80, 15, 15, 0.95);
    box-shadow: 0 0 18px rgba(239, 68, 68, 0.55), inset 0 0 10px rgba(239, 68, 68, 0.25);
  }
}

@keyframes card-flash-rescue {
  0% {
    border-color: rgba(255, 0, 85, 0.45);
    background: rgba(25, 6, 12, 0.95);
    box-shadow: 0 4px 12px rgba(255, 0, 85, 0.35), inset 0 0 5px rgba(255, 0, 85, 0.15);
  }
  100% {
    border-color: rgba(255, 0, 85, 1);
    background: rgba(80, 10, 25, 0.95);
    box-shadow: 0 4px 28px rgba(255, 0, 85, 0.9), inset 0 0 15px rgba(255, 0, 85, 0.35);
  }
}

/* ============================================================
   右側懸浮緊急救援清單及小卡片 (Floating SOS Cards)
   ============================================================ */
.sos-cards-list {
  position: fixed;
  top: 155px; /* Below header and main alert panel */
  right: 15px;
  width: auto; /* Allow dynamic width */
  max-width: 280px;
  max-height: calc(100% - 200px);
  overflow-y: auto;
  z-index: 1005;
  pointer-events: none; /* Click pass-through */
  display: flex;
  flex-direction: column;
  align-items: flex-end; /* Align all cards to the right side */
  gap: 8px;
}

.sos-card {
  pointer-events: auto; /* Clickable */
  background: rgba(25, 6, 12, 0.95);
  border: 1.2px solid var(--color-rescue);
  border-radius: 6px;
  padding: 6px 10px; /* Compact padding */
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  box-shadow: 0 4px 10px rgba(255, 0, 85, 0.35), inset 0 0 8px rgba(255, 0, 85, 0.1);
  animation: card-flash-rescue 1s infinite alternate;
  cursor: pointer;
  transition: all 0.2s ease;
  width: max-content; /* Fit the content dynamically */
  min-width: 100px;
  max-width: 100%;
}

.sos-card:hover {
  transform: translateX(-4px);
  filter: brightness(1.1);
}

.sos-card-left {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex-grow: 1;
}

.sos-card-title {
  font-family: var(--font-sans);
  font-size: 0.8rem;
  font-weight: 700;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: block;
}

.sos-card-remove-btn {
  background: none;
  border: none;
  color: #888;
  cursor: pointer;
  font-size: 1.1rem;
  line-height: 1;
  padding: 0;
  transition: color 0.2s;
  margin-left: 4px;
}

.sos-card-remove-btn:hover {
  color: #fff;
}

/* 警報解除/離線 變為灰色卡片 */
.sos-card.inactive {
  background: rgba(30, 30, 35, 0.95) !important;
  border-color: #555 !important;
  box-shadow: 0 4px 10px rgba(0,0,0,0.3) !important;
  animation: none !important;
}

.sos-card.inactive .sos-card-title {
  color: #94a3b8 !important;
}

.sos-card.inactive i {
  color: #64748b !important;
  animation: none !important;
}

/* ============================================================
   Leaflet Popup Tactical Dark Theme
   ============================================================ */
.leaflet-popup-content-wrapper, .leaflet-popup-tip {
  background: rgba(15, 23, 42, 0.96) !important;
  backdrop-filter: blur(8px);
  border: 1px solid rgba(0, 240, 255, 0.3) !important;
  color: var(--text-main) !important;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5), 0 0 10px rgba(0, 240, 255, 0.15) !important;
  border-radius: 8px !important;
}

.leaflet-popup-content {
  margin: 12px 16px !important;
  line-height: 1.5;
  font-family: var(--font-sans);
}

.leaflet-popup-close-button {
  color: var(--text-muted) !important;
  font-size: 16px !important;
  padding: 6px 10px 0 0 !important;
}

.leaflet-popup-close-button:hover {
  color: var(--color-rescue) !important;
}

/* ============================================================
   Tactical HUD Visual Upgrades (Premium Theme Expansion)
   ============================================================ */

/* CRT scanlines effect */
.scanlines {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    rgba(18, 16, 16, 0) 50%, 
    rgba(0, 0, 0, 0.25) 50%
  );
  background-size: 100% 4px;
  z-index: 9999;
  pointer-events: none;
  opacity: 0.15;
}

/* Radar Sweep Line effect over map */
#map::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(180deg, rgba(0, 240, 255, 0) 0%, rgba(0, 240, 255, 0.05) 50%, rgba(0, 240, 255, 0) 100%);
  z-index: 2;
  pointer-events: none;
  animation: radar-sweep 6s linear infinite;
}

@keyframes radar-sweep {
  0% { transform: translateY(-100%); }
  100% { transform: translateY(100%); }
}

/* Better Badge Styles */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 12px;
  font-family: var(--font-mono);
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border: 1px solid transparent;
  box-shadow: 0 2px 6px rgba(0,0,0,0.2);
}

.badge-locked {
  background: rgba(16, 185, 129, 0.15);
  color: var(--color-normal);
  border-color: rgba(16, 185, 129, 0.35);
  box-shadow: 0 0 6px rgba(16, 185, 129, 0.15);
}

.badge-searching {
  background: rgba(245, 158, 11, 0.15);
  color: var(--color-help);
  border-color: rgba(245, 158, 11, 0.35);
  animation: blink 1.5s infinite;
  box-shadow: 0 0 6px rgba(245, 158, 11, 0.15);
}

.badge-denied, .badge-error {
  background: rgba(255, 0, 85, 0.15);
  color: var(--color-rescue);
  border-color: rgba(255, 0, 85, 0.35);
  box-shadow: 0 0 6px rgba(255, 0, 85, 0.15);
}

/* Header UI HUD enhancements */
.tactical-header {
  height: 48px;
}

.logo-widget, .status-widget {
  background: rgba(10, 16, 26, 0.88) !important;
  border: 1px solid rgba(0, 240, 255, 0.3) !important;
  box-shadow: 0 4px 15px rgba(0, 240, 255, 0.15) !important;
  height: 32px !important;
  padding: 0 12px !important;
  border-radius: 4px !important;
}

.logo-widget:hover {
  border-color: var(--color-cyan) !important;
  box-shadow: var(--glow-cyan) !important;
  background: rgba(10, 20, 36, 0.95) !important;
}

.logo h1 {
  font-size: 0.85rem !important;
}

.status-widget {
  font-size: 0.72rem !important;
}

/* Sidebar SOS active alert animation */
.sidebar.sos-alert-active {
  animation: sidebar-border-flash 1.5s infinite alternate;
}

@keyframes sidebar-border-flash {
  0% {
    box-shadow: -4px 4px 20px rgba(0,0,0,0.4);
  }
  100% {
    box-shadow: -4px 4px 30px rgba(255, 0, 85, 0.45), inset 0 0 10px rgba(255, 0, 85, 0.15);
    border-left: 1px solid rgba(255, 0, 85, 0.6);
  }
}

/* Map controller buttons glowing styles */
.map-control-btn {
  transition: all 0.2s ease !important;
}
.map-control-btn:hover {
  background: rgba(0, 240, 255, 0.18) !important;
  border-color: var(--color-cyan) !important;
  color: var(--color-cyan) !important;
  box-shadow: var(--glow-cyan) !important;
  transform: scale(1.05);
}
.map-control-btn.active {
  background: rgba(0, 240, 255, 0.25) !important;
  border-color: var(--color-cyan) !important;
  color: #fff !important;
  box-shadow: var(--glow-cyan), inset 0 0 8px rgba(0, 240, 255, 0.3) !important;
}

/* Login screen visual updates */
.login-modal {
  border: 1px solid rgba(0, 240, 255, 0.3) !important;
  box-shadow: 0 15px 50px rgba(0, 0, 0, 0.7), var(--glow-cyan) !important;
  overflow: hidden;
  position: relative;
}

.login-modal::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 3px;
  background: linear-gradient(90deg, var(--color-cyan), #0077ff, var(--color-cyan));
  animation: login-glow-flow 3s linear infinite;
}

@keyframes login-glow-flow {
  0% { background-position: 0% 50%; }
  100% { background-position: 200% 50%; }
}

.login-warning-box {
  background: rgba(255, 0, 85, 0.08) !important;
  border: 1px solid rgba(255, 0, 85, 0.35) !important;
  border-radius: 6px;
  padding: 10px 14px !important;
  color: #ffa3b1;
  text-shadow: 0 0 4px rgba(255, 0, 85, 0.2);
}

.login-warning-box .warning-icon {
  color: var(--color-rescue) !important;
  animation: blink 1s infinite;
}

.login-btn {
  background: linear-gradient(135deg, #00f0ff, #0055cc) !important;
  border-radius: 6px;
  font-family: var(--font-sans);
  text-shadow: 0 1px 2px rgba(0,0,0,0.5);
  transition: all 0.2s ease;
}

.line-btn {
  transition: all 0.2s ease !important;
}
.line-btn:hover {
  background: #06c755 !important;
  box-shadow: 0 0 15px rgba(6, 199, 85, 0.5) !important;
  transform: translateY(-1px);
}

.divider {
  display: flex;
  align-items: center;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.75rem;
  margin: 18px 0;
}
.divider::before, .divider::after {
  content: '';
  flex: 1;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}
.divider:not(:empty)::before {
  margin-right: .5em;
}
.divider:not(:empty)::after {
  margin-left: .5em;
}

/* Custom indicator panel upgrades */
.digital-indicator-panel {
  border: 1px solid rgba(0, 240, 255, 0.25) !important;
  box-shadow: 0 8px 32px rgba(0,0,0,0.5), var(--glow-cyan) !important;
  border-radius: 8px;
}

/* Sound Toggle Control floating widget style */
.sound-toggle-widget {
  position: absolute;
  top: 0;
  right: 65px; /* Offset to the left of WS status widget */
  height: 22px;
  display: flex;
  align-items: center;
  pointer-events: auto;
  transition: all 0.3s ease;
  padding: 0 8px;
  border-radius: 6px;
  z-index: 1001;
  font-family: var(--font-mono);
  font-size: 0.55rem;
  letter-spacing: 0.5px;
  gap: 4px;
  cursor: pointer;
  background: rgba(10, 16, 26, 0.88);
  border: 1px solid rgba(0, 240, 255, 0.3);
  box-shadow: 0 4px 15px rgba(0, 240, 255, 0.15);
  height: 32px !important;
  padding: 0 12px !important;
  border-radius: 4px !important;
}

.sound-toggle-widget:hover {
  border-color: var(--color-cyan);
  box-shadow: var(--glow-cyan);
  background: rgba(10, 20, 36, 0.95);
}

.sound-toggle-widget.sound-off {
  border-color: rgba(255, 0, 85, 0.3);
  color: var(--text-muted);
}

.sound-toggle-widget.sound-off:hover {
  border-color: var(--color-rescue);
  box-shadow: var(--glow-red);
}

/* ==========================================================================
   Tactical SOS Temporary Beacon & War Room Drill-down Views
   ========================================================================== */

/* Tactical SOS Temporary Beacon (15-second pulsating beacon) */
.tactical-sos-temporary-beacon {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  pointer-events: auto;
  cursor: pointer;
}

.sos-beacon-core {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: radial-gradient(circle, #ff0055 0%, #b91c1c 80%);
  border: 2.5px solid #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  font-size: 14px;
  box-shadow: 0 0 20px #ff0055, 0 0 35px rgba(255, 0, 85, 0.8);
  animation: sos-beacon-core-pulse 0.6s infinite alternate ease-in-out;
  z-index: 10;
}

@keyframes sos-beacon-core-pulse {
  0% { transform: scale(0.9); box-shadow: 0 0 15px #ff0055; }
  100% { transform: scale(1.18); box-shadow: 0 0 30px #ff0055, 0 0 50px rgba(255, 0, 85, 0.9); }
}

.sos-beacon-ripple {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  border: 3px solid #ff0055;
  pointer-events: none;
  opacity: 0;
  animation: sos-beacon-wave 1.8s infinite ease-out;
}

.sos-beacon-ripple.ripple-1 { animation-delay: 0s; }
.sos-beacon-ripple.ripple-2 { animation-delay: 0.6s; }
.sos-beacon-ripple.ripple-3 { animation-delay: 1.2s; }

@keyframes sos-beacon-wave {
  0% { width: 30px; height: 30px; opacity: 1; border-width: 3px; }
  100% { width: 140px; height: 140px; opacity: 0; border-width: 1px; }
}

.sos-beacon-tag {
  position: absolute;
  top: -38px;
  background: rgba(15, 23, 42, 0.95);
  border: 1.5px solid #ff0055;
  color: #ffffff;
  padding: 3px 8px;
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  white-space: nowrap;
  box-shadow: 0 0 15px rgba(255, 0, 85, 0.7);
  display: flex;
  align-items: center;
  gap: 6px;
  z-index: 12;
  pointer-events: none;
}

.sos-countdown-badge {
  background: #ff0055;
  color: #ffffff;
  font-weight: 900;
  font-size: 0.68rem;
  padding: 1px 6px;
  border-radius: 3px;
  animation: blink 0.5s infinite;
}

/* War Room User & SOS Card Styles */
.wr-user-card {
  background: rgba(15, 23, 42, 0.75);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: all 0.2s ease;
  position: relative;
  overflow: hidden;
}

.wr-user-card:hover {
  border-color: rgba(0, 240, 255, 0.4);
  background: rgba(22, 32, 48, 0.9);
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.4);
}

.wr-sos-card {
  background: rgba(26, 16, 26, 0.75);
  border: 1px solid rgba(255, 0, 85, 0.25);
  border-radius: 8px;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: all 0.2s ease;
}

.wr-sos-card.is-active-sos {
  border-color: #ff0055;
  background: rgba(45, 12, 28, 0.85);
  box-shadow: 0 0 15px rgba(255, 0, 85, 0.25);
}

.wr-sos-card:hover {
  border-color: var(--color-rescue);
  box-shadow: 0 4px 20px rgba(255, 0, 85, 0.35);
}

.wr-nine-line-box {
  background: rgba(10, 14, 22, 0.92);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 6px;
  padding: 8px 10px;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  line-height: 1.6;
  color: #cbd5e1;
}

.wr-nine-line-box strong {
  color: #38bdf8;
}

/* War Room Unified Tactical Button Styles */
.wr-btn {
  padding: 6px 14px;
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: 5px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all 0.2s ease;
  font-family: var(--font-sans);
  text-decoration: none;
  box-sizing: border-box;
}

.wr-btn:hover {
  transform: translateY(-1px);
  filter: brightness(1.15);
}

.wr-btn:active {
  transform: translateY(1px);
}

.wr-btn-detail {
  background: linear-gradient(135deg, rgba(0, 240, 255, 0.18), rgba(0, 119, 255, 0.25));
  border: 1.5px solid var(--color-cyan);
  color: #fff;
  box-shadow: 0 0 10px rgba(0, 240, 255, 0.2);
}

.wr-btn-detail:hover {
  background: linear-gradient(135deg, rgba(0, 240, 255, 0.3), rgba(0, 119, 255, 0.4));
  box-shadow: 0 0 14px rgba(0, 240, 255, 0.45);
}

.wr-btn-locate {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.2), rgba(0, 240, 255, 0.2));
  border: 1.5px solid #10b981;
  color: #fff;
  box-shadow: 0 0 10px rgba(16, 185, 129, 0.2);
}

.wr-btn-locate:hover {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.35), rgba(0, 240, 255, 0.35));
  box-shadow: 0 0 14px rgba(16, 185, 129, 0.4);
}





/* Only personnel markers button active state */
.map-control-btn#btn-only-personnel-markers.active,
.toggle-mode-btn#btn-only-personnel-sidebar.active {
  background: rgba(16, 185, 129, 0.22) !important;
  border-color: #10b981 !important;
  color: #a7f3d0 !important;
  box-shadow: 0 0 10px rgba(16, 185, 129, 0.35) !important;
}

/* ============================================================
   TAK Multi-Server Management & Connected Servers List
   ============================================================ */
.tak-servers-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.tak-server-card {
  background: rgba(15, 23, 42, 0.75);
  border: 1px solid rgba(0, 240, 255, 0.25);
  border-radius: 8px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: all 0.2s ease;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
}

.tak-server-card:hover {
  border-color: var(--color-cyan);
  box-shadow: 0 6px 18px rgba(0, 240, 255, 0.15);
}

.tak-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.tak-card-title {
  font-weight: 700;
  font-size: 0.88rem;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 6px;
}

.tak-badge {
  font-size: 0.68rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.tak-badge.online {
  background: rgba(16, 185, 129, 0.15);
  border: 1px solid #10b981;
  color: #a7f3d0;
}

.tak-badge.offline {
  background: rgba(255, 0, 85, 0.15);
  border: 1px solid var(--color-rescue);
  color: #fecdd3;
}

.tak-badge.unknown {
  background: rgba(148, 163, 184, 0.15);
  border: 1px solid #64748b;
  color: #cbd5e1;
}

.tak-badge.disabled {
  background: rgba(100, 116, 139, 0.1);
  border: 1px dashed #475569;
  color: #94a3b8;
}

.tak-card-details {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.72rem;
  color: #94a3b8;
  background: rgba(0, 0, 0, 0.25);
  padding: 6px 10px;
  border-radius: 6px;
}

.tak-factions-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 2px;
}

.faction-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 1px 6px;
  border-radius: 3px;
  font-size: 0.65rem;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #e2e8f0;
}

.faction-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  display: inline-block;
}

.tak-card-actions {
  display: flex;
  gap: 6px;
  align-items: center;
  justify-content: flex-end;
  margin-top: 4px;
}

.tak-action-btn {
  padding: 5px 10px;
  font-size: 0.7rem;
  font-weight: 600;
  border-radius: 4px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  transition: all 0.15s ease;
}

.tak-btn-edit {
  background: rgba(0, 240, 255, 0.15);
  border: 1px solid var(--color-cyan);
  color: #bae6fd;
}

.tak-btn-edit:hover {
  background: rgba(0, 240, 255, 0.3);
}

.tak-btn-test {
  background: rgba(16, 185, 129, 0.15);
  border: 1px solid #10b981;
  color: #a7f3d0;
}

.tak-btn-test:hover {
  background: rgba(16, 185, 129, 0.3);
}

.tak-btn-delete {
  background: rgba(255, 0, 85, 0.12);
  border: 1px solid rgba(255, 0, 85, 0.4);
  color: #fecdd3;
}

.tak-btn-delete:hover {
  background: rgba(255, 0, 85, 0.25);
}

.factions-select-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(135px, 1fr));
  gap: 6px;
  max-height: 170px;
  overflow-y: auto;
  padding: 6px;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 6px;
}

.faction-checkbox-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.72rem;
  color: #f1f5f9;
  cursor: pointer;
  padding: 3px 5px;
  border-radius: 4px;
  transition: background 0.15s;
}

.faction-checkbox-label:hover {
  background: rgba(255, 255, 255, 0.08);
}

/* --------------------------------------------------------------------------
   TAK Data Source Circle Indicator ("T" Badge)
   -------------------------------------------------------------------------- */
.user-marker-pin.is-tak {
  width: 17px !important;
  height: 17px !important;
  border-width: 2px !important;
}

.user-marker-pin.is-tak::after,
.user-marker-pin.is-tak .user-marker-center-dot {
  display: none !important;
}

.user-marker-tak-t {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-family: 'Rajdhani', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, monospace, sans-serif;
  font-weight: 900;
  font-size: 11px;
  line-height: 1;
  color: #ffffff;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.95), 0 0 3px #000000;
  pointer-events: none;
  z-index: 15;
  user-select: none;
}

.tactical-marker-tak-circle {
  position: absolute;
  top: -6px;
  right: -6px;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: #0284c7;
  color: #ffffff;
  font-family: 'Rajdhani', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, monospace, sans-serif;
  font-weight: 900;
  font-size: 10px;
  line-height: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1.5px solid #ffffff;
  box-shadow: 0 0 6px rgba(2, 132, 199, 0.9), 0 2px 4px rgba(0,0,0,0.6);
  z-index: 15;
  pointer-events: none;
  user-select: none;
}

/* --------------------------------------------------------------------------
   OwnTracks Data Source Circle Indicator ("OT" Badge)
   -------------------------------------------------------------------------- */
.user-marker-pin.is-ot {
  width: 19px !important;
  height: 19px !important;
  border-width: 2px !important;
}

.user-marker-pin.is-ot::after,
.user-marker-pin.is-ot .user-marker-center-dot {
  display: none !important;
}

.user-marker-ot-t {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-family: 'Rajdhani', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, monospace, sans-serif;
  font-weight: 900;
  font-size: 8.5px;
  letter-spacing: -0.5px;
  line-height: 1;
  color: #ffffff;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.95), 0 0 3px #000000;
  pointer-events: none;
  z-index: 15;
  user-select: none;
}

