/* =========================================================
   RESET & ROOT PAGE LOCK
   ========================================================= */

html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
  overflow: hidden;
}

/* =========================================================
   CUSTOM FONT — PIXEL OPERATOR
   ========================================================= */

@font-face {
  font-family: "Pixel Operator";
  src: url("fonts/PixelOperator/PixelOperator.ttf") format("truetype");
  font-weight: normal;
  font-style: normal;
}

/* =========================================================
   GLOBAL THEME & TYPOGRAPHY
   ========================================================= */

html,
body {
  background: #0f1115;
  color: #e6e6e6;
  font-family: "Pixel Operator", monospace;

  /* Pixel font rendering */
  -webkit-font-smoothing: none;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeSpeed;
}

/* Force Leaflet UI to inherit pixel font */
.leaflet-container,
.leaflet-control,
.leaflet-popup-content,
.leaflet-tooltip {
  font-family: inherit;
}

/* =========================================================
   MAP (CRITICAL — DO NOT BREAK)
   ========================================================= */

#map {
  width: 100vw;
  height: 100vh;
  background: #0f1115;
}

.leaflet-container {
  background: #0f1115;
}

/* =========================================================
   SIDEBAR — CONTAINER
   ========================================================= */

.sidebar {
  position: absolute;
  top: 12px;
  left: 12px;
  z-index: 1000;

  width: 260px;
  max-height: calc(100vh - 24px);

  display: flex;
  flex-direction: column;

  background: rgba(20, 20, 20, 0.85);
  color: #fff;
  border-radius: 10px;
  overflow: hidden;

  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(6px);
}

.sidebar.collapsed {
  width: 52px;
}

/* =========================================================
   SIDEBAR — HEADER
   ========================================================= */

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px;
}

.sidebar-title {
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
}

.sidebar.collapsed .sidebar-title {
  display: none;
}

.sidebar-toggle {
  width: 36px;
  height: 32px;
  border-radius: 8px;
  border: none;

  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  font-size: 18px;
  cursor: pointer;
}

/* =========================================================
   SIDEBAR — BODY & SCROLLING
   ========================================================= */

.sidebar-body {
  padding: 10px 12px 12px;
  font-size: 13px;

  overflow-y: auto;
  overflow-x: hidden;
  max-height: calc(100vh - 24px - 52px);
}

.sidebar.collapsed .sidebar-body {
  display: none;
}

/* Scrollbar polish */
.sidebar-body::-webkit-scrollbar {
  width: 10px;
}

.sidebar-body::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.18);
  border-radius: 8px;
}

.sidebar-body::-webkit-scrollbar-track {
  background: transparent;
}

/* =========================================================
   SIDEBAR — ROWS & TEXT HELPERS
   ========================================================= */

.row,
label.row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 0;
  user-select: none;
}

.small {
  font-size: 12px;
  opacity: 0.85;
}

hr {
  border: none;
  border-top: 1px solid rgba(255, 255, 255, 0.18);
  margin: 10px 0;
}

/* =========================================================
   ICON STYLES (LEGEND / TOGGLES)
   ========================================================= */

.legend-icon {
  width: 32px;
  height: 32px;
  flex: 0 0 32px;
}

/* =========================================================
   SIDEBAR BUTTONS (GENERIC)
   ========================================================= */

.sidebar-btn {
  width: 100%;

  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;

  padding: 10px 12px;
  border-radius: 12px;

  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);

  cursor: pointer;
}

.sidebar-btn:hover {
  background: rgba(255, 255, 255, 0.12);
}

/* =========================================================
   REPORT / BUG BUTTON
   ========================================================= */

.bug-btn {
  width: 100%;

  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;

  padding: 10px 12px;
  border-radius: 12px;

  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);

  cursor: pointer;
}

.bug-btn:hover {
  background: rgba(255, 255, 255, 0.10);
}

.bug-icon {
  width: 18px;
  height: 18px;
}

/* Ensure buttons use pixel font */
button,
.report-bug,
.report-bug button {
  font-family: inherit;
}

/* =========================================================
   COORDINATE HUD (BOTTOM RIGHT)
   ========================================================= */

.coord-hud {
  position: fixed;
  bottom: 10px;
  right: 12px;
  z-index: 1000;

  display: flex;
  align-items: center;
  gap: 6px;

  padding: 6px 10px;
  font-size: 12px;

  background: rgba(0, 0, 0, 0.6);
  color: #fff;
  border-radius: 6px;

  pointer-events: none;
}

/* =========================================================
   MAP COORDS STACK CONTAINER
   ========================================================= */

#map-coords-container {
  position: fixed;
  bottom: 16px;
  right: 16px;

  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;

  z-index: 1000;
}

/* =========================================================
   LOADING / TIP OVERLAY
   ========================================================= */

#tip-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;

  display: flex;
  align-items: center;
  justify-content: center;

  background: rgba(0, 0, 0, 0.85);
  opacity: 1;
  transition: opacity 0.4s ease;
}

#tip-overlay.fade-out {
  opacity: 0;
  pointer-events: none;
}

/* Overlay title */
.overlay-title {
  position: absolute;
  top: 18%;
  left: 50%;
  transform: translateX(-50%);

  font-size: 28px;
  font-weight: 600;
  letter-spacing: 0.5px;
  color: #fff;
  text-align: center;

  pointer-events: none;
}

/* Tip box */
.tip-box {
  max-width: 500px;
  padding: 20px 24px;

  font-size: 1.1rem;
  color: #fff;
  text-align: center;

  background: rgba(255, 255, 255, 0.08);
  border-radius: 10px;
}

/* =========================================================
   LOCATION LABELS (MAP POI TEXT)
   ========================================================= */

.location-label {
  --label-scale: 1;

  display: flex;
  align-items: center;
  justify-content: center;

  width: 110px;
  height: 32px;
  padding: 0 6px;

  font-size: 13px;
  font-weight: 600;
  color: #fff;
  text-align: center;

  background: rgba(0, 0, 0, 0.45);
  border-radius: 6px;

  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.65);
  text-shadow:
    1px 1px 2px #000,
    -1px 1px 2px #000,
    1px -1px 2px #000,
    -1px -1px 2px #000;

  pointer-events: none;

  transform: translate(-50%, -50%) scale(var(--label-scale));
  transform-origin: center;
}

/* =========================================================
   BULK ACTION CONTROLS (✓ ✕ ○)
   ========================================================= */

.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.bulk-actions {
  display: inline-flex;
  gap: 6px;
}

.bulk-btn {
  width: 18px;
  height: 18px;

  padding: 0;
  border-radius: 3px;
  border: 1px solid #fff;

  background: transparent;
  color: #fff;

  font: inherit;
  line-height: 16px;
  text-align: center;

  cursor: pointer;
}

.bulk-btn:hover {
  background: rgba(255, 255, 255, 0.12);
}

.bulk-btn:active {
  transform: translateY(1px);
}

/* Flash / pulse toggle button */
.bulk-btn.flash-btn {
  border-radius: 999px;
  font-size: 12px;
  border: 1px solid rgba(255, 255, 255, 0.7);
}

/* =========================================================
   ICON PULSE ANIMATION
   ========================================================= */

.poa-pulse {
  animation: poaPulse 1.5s infinite ease-in-out;
}

@keyframes poaPulse {
  0%   { opacity: 1; }
  50%  { opacity: 0.15; }
  100% { opacity: 1; }
}

/* =========================================================
   CHANGELOG MODAL
   ========================================================= */

.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 99999;

  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;

  background: rgba(0, 0, 0, 0.55);
}

.modal-overlay.is-open {
  display: flex;
}

.modal-card {
  width: min(720px, 100%);
  max-height: 80vh;
  overflow-y: auto;

  background: rgba(20, 20, 20, 0.95);
  color: #fff;

  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;

  padding: 14px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.modal-close {
  background: transparent;
  border: none;
  font-size: 22px;
  color: #fff;
  cursor: pointer;
}

.modal-body {
  padding: 14px 16px;
  font-size: 14px;
}

.changelog-entry + .changelog-entry {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
}

.changelog-meta {
  font-weight: 600;
  margin-bottom: 8px;
}
