:root {
  --bg-primary: #0a0d14;
  --bg-panel: rgba(16, 22, 34, 0.88);
  --bg-card: rgba(24, 32, 48, 0.65);
  --bg-card-hover: rgba(35, 48, 72, 0.85);
  --border-color: rgba(212, 175, 55, 0.22);
  --border-glow: rgba(0, 229, 255, 0.35);
  --gold: #d4af37;
  --gold-bright: #ffd54f;
  --cyan: #00e5ff;
  --text-primary: #f0f4f8;
  --text-secondary: #9aaec4;
  --text-muted: #5e7287;
  --font-heading: 'Cinzel', serif;
  --font-body: 'Plus Jakarta Sans', sans-serif;
  --shadow-panel: 0 8px 32px rgba(0, 0, 0, 0.6);
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
}

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

body, html {
  width: 100%;
  height: 100%;
  overflow: hidden;
  font-family: var(--font-body);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  font-size: 14px;
}

#app-container {
  display: flex;
  width: 100vw;
  height: 100vh;
  position: relative;
}

/* ================= SIDEBAR ================= */
.sidebar {
  width: 390px;
  min-width: 340px;
  height: 100%;
  background: var(--bg-panel);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  z-index: 1000;
  box-shadow: var(--shadow-panel);
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), width 0.3s ease;
}

.sidebar.collapsed {
  transform: translateX(-100%);
  position: absolute;
}

.sidebar-header {
  padding: 16px 20px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}

.brand-title {
  display: flex;
  align-items: center;
  gap: 12px;
}

.viking-symbol {
  font-size: 28px;
  color: var(--gold);
  text-shadow: 0 0 12px rgba(212, 175, 55, 0.5);
  line-height: 1;
}

.brand-title h1 {
  font-family: var(--font-heading);
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 1.5px;
  color: #fff;
  background: linear-gradient(135deg, #ffffff 40%, var(--gold) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.seed-badge {
  font-size: 11px;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 2px;
}

.seed-text {
  color: var(--cyan);
  font-weight: 600;
  letter-spacing: 0.5px;
}

.ver-tag {
  background: rgba(0, 229, 255, 0.12);
  color: var(--cyan);
  border: 1px solid rgba(0, 229, 255, 0.25);
  border-radius: 4px;
  padding: 0 5px;
  font-size: 10px;
}

.sidebar-toggle {
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--gold);
  border-radius: var(--radius-sm);
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
}

.sidebar-toggle:hover {
  background: rgba(212, 175, 55, 0.15);
  border-color: var(--gold);
}

/* ================= SEARCH BOX ================= */
.search-box {
  position: relative;
  padding: 12px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.search-icon {
  position: absolute;
  left: 28px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
}

.search-box input {
  width: 100%;
  background: rgba(8, 12, 18, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-md);
  padding: 9px 34px 9px 36px;
  color: var(--text-primary);
  font-size: 13px;
  font-family: var(--font-body);
  transition: all 0.2s;
}

.search-box input:focus {
  outline: none;
  border-color: var(--cyan);
  box-shadow: 0 0 10px rgba(0, 229, 255, 0.2);
}

.clear-btn {
  position: absolute;
  right: 26px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 14px;
}

/* ================= NAVIGATION TABS ================= */
.nav-tabs {
  display: flex;
  padding: 8px 12px;
  gap: 4px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  background: rgba(10, 14, 22, 0.5);
  overflow-x: auto;
  scrollbar-width: none;
}

.nav-tabs::-webkit-scrollbar {
  display: none;
}

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

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

.nav-tab.active {
  background: rgba(212, 175, 55, 0.15);
  color: var(--gold-bright);
  border: 1px solid rgba(212, 175, 55, 0.3);
}

/* ================= TAB CONTENTS ================= */
.tab-contents {
  flex: 1;
  overflow-y: auto;
  padding: 14px 16px;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.15) transparent;
}

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

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

.section-desc {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.4;
  margin-bottom: 4px;
  background: rgba(0, 0, 0, 0.2);
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  border-left: 2px solid var(--gold);
}

/* Progression List Cards */
.progression-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.boss-card {
  background: var(--bg-card);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  cursor: pointer;
  transition: all 0.25s ease;
  position: relative;
  overflow: hidden;
}

.boss-card::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  width: 4px;
  height: 100%;
  background: var(--boss-color, var(--gold));
  box-shadow: 0 0 8px var(--boss-color, var(--gold));
}

.boss-card:hover {
  background: var(--bg-card-hover);
  border-color: rgba(212, 175, 55, 0.4);
  transform: translateY(-2px);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.4);
}

.boss-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.boss-title-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}

.boss-tier-badge {
  font-family: var(--font-heading);
  font-size: 11px;
  font-weight: 700;
  color: var(--boss-color, var(--gold));
  background: rgba(0, 0, 0, 0.35);
  padding: 2px 6px;
  border-radius: 4px;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.boss-name {
  font-weight: 700;
  font-size: 13px;
  color: #fff;
}

.boss-biome {
  font-size: 11px;
  color: var(--text-secondary);
}

.boss-dist {
  font-size: 11px;
  font-weight: 600;
  color: var(--cyan);
  background: rgba(0, 229, 255, 0.1);
  padding: 2px 7px;
  border-radius: 12px;
}

.boss-details {
  font-size: 11px;
  color: var(--text-secondary);
  line-height: 1.4;
  border-top: 1px solid rgba(255, 255, 255, 0.04);
  padding-top: 6px;
}

.boss-detail-row {
  display: flex;
  gap: 4px;
}

.boss-detail-label {
  color: var(--text-muted);
  min-width: 68px;
}

.boss-detail-val {
  color: #d1dce6;
}

/* Cards List for Traders */
.cards-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.trader-card {
  background: var(--bg-card);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-md);
  padding: 12px;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  flex-direction: column;
  gap: 6px;
  position: relative;
}

.trader-card::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  width: 4px;
  height: 100%;
  background: var(--card-accent, var(--gold));
}

.trader-card:hover {
  background: var(--bg-card-hover);
  border-color: rgba(255, 255, 255, 0.2);
  transform: translateY(-2px);
}

/* Filter Controls */
.filter-controls {
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: rgba(0, 0, 0, 0.2);
  padding: 12px;
  border-radius: var(--radius-md);
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.filter-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.filter-label {
  flex: 1;
  font-weight: 500;
  font-size: 12px;
}

.badge {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-secondary);
  font-size: 11px;
  padding: 2px 7px;
  border-radius: 10px;
  font-weight: 600;
}

.sub-filter {
  display: flex;
  gap: 12px;
  padding-left: 36px;
  font-size: 11px;
  color: var(--text-secondary);
  margin-top: -2px;
  margin-bottom: 4px;
}

.sub-filter label {
  display: flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
}

/* Toggle Switch */
.toggle-switch {
  position: relative;
  display: inline-block;
  width: 32px;
  height: 18px;
}

.toggle-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.15);
  transition: .3s;
  border-radius: 20px;
}

.slider:before {
  position: absolute;
  content: "";
  height: 12px;
  width: 12px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: .3s;
  border-radius: 50%;
}

input:checked + .slider {
  background-color: var(--cyan);
}

input:checked + .slider:before {
  transform: translateX(14px);
}

/* Recommended picks */
.top-farming-picks h4 {
  font-family: var(--font-heading);
  font-size: 12px;
  color: var(--gold);
  margin: 8px 0 6px;
  letter-spacing: 0.5px;
}

.mini-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.mini-card {
  background: var(--bg-card);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  transition: all 0.2s;
}

.mini-card:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-glow);
}

.mini-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.mini-title {
  font-weight: 600;
  font-size: 12px;
}

.mini-sub {
  font-size: 11px;
  color: var(--text-secondary);
}

/* ================= FOOTER ================= */
.sidebar-footer {
  padding: 12px 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.07);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.action-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 12px;
  border-radius: var(--radius-md);
  font-family: var(--font-body);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  border: none;
}

.primary-action {
  background: linear-gradient(135deg, #1b3a4b 0%, #007791 100%);
  color: #fff;
  border: 1px solid var(--border-glow);
}

.primary-action:hover {
  background: linear-gradient(135deg, #224d63 0%, #0099bb 100%);
  box-shadow: 0 0 12px rgba(0, 229, 255, 0.4);
}

.secondary-action {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-secondary);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.secondary-action:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

/* ================= MAP WRAPPER ================= */
.map-wrapper {
  flex: 1;
  height: 100%;
  position: relative;
  background-color: #06080d;
}

#map {
  width: 100%;
  height: 100%;
  background-color: #06080d;
}

/* Floating HUDs */
.hud-overlay {
  position: absolute;
  bottom: 24px;
  right: 24px;
  background: rgba(12, 17, 26, 0.85);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-md);
  padding: 8px 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  z-index: 999;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5);
  pointer-events: none;
}

.hud-item {
  display: flex;
  align-items: center;
  gap: 6px;
}

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

.hud-value {
  font-family: monospace;
  font-size: 12px;
  font-weight: 700;
  color: var(--cyan);
}

.hud-divider {
  width: 1px;
  height: 14px;
  background: rgba(255, 255, 255, 0.15);
}

/* Biome Legend */
.legend-overlay {
  position: absolute;
  top: 18px;
  right: 18px;
  background: rgba(12, 17, 26, 0.85);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-md);
  padding: 8px 12px;
  z-index: 999;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5);
}

.legend-title {
  font-family: var(--font-heading);
  font-size: 10px;
  font-weight: 700;
  color: var(--gold);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.legend-items {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  max-width: 320px;
}

.legend-pill {
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: 600;
  color: #fff;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
}

/* ================= CUSTOM POPUPS & MARKERS ================= */
.leaflet-popup-content-wrapper {
  background: rgba(14, 20, 30, 0.95) !important;
  backdrop-filter: blur(12px) !important;
  border: 1px solid var(--gold) !important;
  border-radius: var(--radius-md) !important;
  color: var(--text-primary) !important;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.7) !important;
  padding: 0 !important;
  overflow: hidden;
}

.leaflet-popup-tip {
  background: rgba(14, 20, 30, 0.95) !important;
  border: 1px solid var(--gold) !important;
}

.custom-popup {
  padding: 14px 16px;
  min-width: 220px;
  max-width: 280px;
  font-family: var(--font-body);
}

.popup-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  padding-bottom: 6px;
}

.popup-title {
  font-family: var(--font-heading);
  font-size: 13px;
  font-weight: 700;
  color: #fff;
}

.popup-biome {
  font-size: 10px;
  padding: 2px 5px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-secondary);
}

.popup-body {
  font-size: 12px;
  line-height: 1.4;
  color: var(--text-secondary);
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 10px;
}

.popup-stat {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  font-size: 11px;
}

.popup-stat-label {
  color: var(--text-muted);
  white-space: nowrap;
  flex-shrink: 0;
}

.popup-stat-val {
  color: #fff;
  font-weight: 600;
}

.popup-btn {
  width: 100%;
  padding: 6px 10px;
  background: rgba(212, 175, 55, 0.15);
  border: 1px solid var(--gold);
  border-radius: var(--radius-sm);
  color: var(--gold-bright);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all 0.2s;
}

.popup-btn:hover {
  background: rgba(212, 175, 55, 0.3);
  box-shadow: 0 0 10px rgba(212, 175, 55, 0.3);
}

/* Custom Marker Pin Icons */
.valheim-marker {
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.8);
  transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.valheim-marker:hover {
  transform: scale(1.35) translateY(-3px);
  z-index: 10000 !important;
}

.marker-inner {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  font-size: 14px;
}

/* Pulse animation for spawn & closest boss */
@keyframes marker-pulse {
  0% { box-shadow: 0 0 0 0 rgba(0, 229, 255, 0.7); }
  70% { box-shadow: 0 0 0 14px rgba(0, 229, 255, 0); }
  100% { box-shadow: 0 0 0 0 rgba(0, 229, 255, 0); }
}

.pulse-marker {
  animation: marker-pulse 2s infinite;
}

/* Override leaflet div icon default box */
.leaflet-div-icon {
  background: transparent !important;
  border: none !important;
}

/* ========================================================
   DEATH PINS & LIVE TELEMETRY STYLES
   ======================================================== */
.death-marker {
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  box-shadow: 0 0 12px rgba(255, 51, 102, 0.85);
  cursor: pointer;
  transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.death-marker:hover {
  transform: scale(1.4) translateY(-3px);
  z-index: 10000 !important;
}

.death-marker-inner {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  font-size: 15px;
  background: #2b040e;
  border: 2px solid #ff3366;
  text-shadow: 0 0 8px rgba(255, 51, 102, 0.8);
}

@keyframes death-pulse {
  0% { box-shadow: 0 0 0 0 rgba(255, 51, 102, 0.9); }
  70% { box-shadow: 0 0 0 18px rgba(255, 51, 102, 0); }
  100% { box-shadow: 0 0 0 0 rgba(255, 51, 102, 0); }
}

.death-pulse {
  animation: death-pulse 1.8s infinite;
}

.death-card {
  background: rgba(43, 4, 14, 0.6);
  border: 1px solid rgba(255, 51, 102, 0.4);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  margin-bottom: 8px;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.death-card:hover {
  background: rgba(255, 51, 102, 0.15);
  border-color: #ff3366;
  transform: translateX(4px);
  box-shadow: 0 0 12px rgba(255, 51, 102, 0.3);
}

.death-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.death-card-player {
  font-family: "Cinzel", serif;
  font-weight: 700;
  color: #ff5577;
  font-size: 0.95rem;
}

.death-card-time {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.death-card-cause {
  font-size: 0.85rem;
  color: var(--text-light);
}

.death-card-coords {
  font-size: 0.75rem;
  color: #ff88a3;
  font-family: monospace;
}
