/* ============================================================
 *  css/editor.css — Editor-specific styles
 * ============================================================ */

/* ── App-bar (page sub-header) ──────────────────────────────── */
.wm-appbar {
  background: #ffffff;
  border-bottom: 1px solid var(--wm-panel-border);
  box-shadow: var(--wm-panel-shadow);
}

/* ── Panels ─────────────────────────────────────────────────── */
.bg-gradient {
  background: linear-gradient(180deg, rgba(0,168,150,0.04), transparent);
  border-radius: 0.75rem;
}

.panel {
  background: var(--wm-panel-bg);
  border-radius: 0.75rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

/* ── Map & map wrapper ──────────────────────────────────────── */
#map {
  height: calc(100vh - 260px);
  min-height: 600px;
  position: relative;
  touch-action: none;
}

.map-wrap {
  position: relative; /* anchor absolutely-positioned children */
}

/* ── Draw overlay ───────────────────────────────────────────── */
.draw-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  z-index: 10; /* below toolbar (z-index: 20), above map */
  transition:
    opacity 0.2s ease,
    visibility 0.2s ease;
}

.draw-overlay .content {
  background: rgba(255, 255, 255, 0.95);
  border: 1px dashed var(--wm-accent);
  border-radius: 0.75rem;
  padding: 0.75rem 1rem;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.06);
  text-align: center;
  max-width: min(560px, 90%);
}

.draw-overlay.hidden,
.map-wrap #map:hover ~ #drawOverlay {
  opacity: 0;
  visibility: hidden;
}

/* ── Draw toolbar ───────────────────────────────────────────── */
#drawToolbar {
  border-radius: 2rem !important;
  overflow: hidden;
}

.map-wrap #drawToolbar {
  position: absolute;
  top: 0.75rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 20; /* above overlay */
  background: rgba(255, 255, 255, 0.95);
  border: 1px solid rgba(0, 0, 0, 0.12);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.08);
  display: flex;
  gap: 0.25rem;
  padding: 0.25rem;
  pointer-events: auto;
}

#drawToolbar .btn {
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0.35rem 0.55rem;
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

#drawToolbar .btn .ico {
  width: 16px;
  height: 16px;
}

#drawToolbar .btn.active {
  outline: 2px solid rgba(0,168,150,0.33);
}

/* ── Custom map cursors ─────────────────────────────────────── */
#map.cursor-rect,
#map.cursor-rect * {
  cursor:
    url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24'><rect x='4' y='6' width='16' height='12' rx='1' fill='none' stroke='%2300A896' stroke-width='2'/></svg>")
      12 12,
    crosshair !important;
}

#map.cursor-circ,
#map.cursor-circ * {
  cursor:
    url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24'><circle cx='12' cy='12' r='8' fill='none' stroke='%2300A896' stroke-width='2'/></svg>")
      12 12,
    crosshair !important;
}

#map.cursor-poly,
#map.cursor-poly * {
  cursor:
    url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24'><path d='M5 17 L4 8 L12 4 L20 8 L18 18 Z' fill='none' stroke='%2300A896' stroke-width='2'/></svg>")
      12 12,
    crosshair !important;
}

#map.cursor-mark,
#map.cursor-mark * {
  cursor:
    url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24'><path d='M12 22c3-4 6-7.2 6-11a6 6 0 1 0-12 0c0 3.8 3 7 6 11z' fill='none' stroke='%2300A896' stroke-width='2'/><circle cx='12' cy='11' r='2.5' fill='%2300A896'/></svg>")
      12 20,
    pointer !important;
}

/* ── Pro lock ────────────────────────────────────────────── */
.pro-lock {
  position: relative;
  display: block;
}

.pro-lock .pro-veil {
  position: absolute;
  inset: 0;
  background: rgba(255, 255, 255, 0.6);
  border-radius: 0.375rem;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.15s ease;
  pointer-events: none;
  z-index: 10;
}

.pro-lock:hover .pro-veil {
  opacity: 1;
}

.pro-veil .pro-veil-text {
  background: rgba(0, 0, 0, 0.78);
  color: #fff;
  font-size: 0.8rem;
  padding: 0.25rem 0.5rem;
  border-radius: 0.375rem;
  text-align: center;
  max-width: 260px;
}

.pro-lock .form-control,
.pro-lock .form-select,
.pro-lock .form-check {
  position: relative;
  z-index: 1;
}

/* pro-locked state: block controls, veil still shows only on hover */
.pro-lock.pro-locked .pro-veil {
  pointer-events: auto;
}

.pro-lock.pro-locked a,
.pro-lock.pro-locked button,
.pro-lock.pro-locked input {
  pointer-events: none;
}

/* Pro veils: visible by default (free tier).
   JS toggles body.is-pro — CSS hides every veil for pro users. */
.pro-veil {
  /* shown for free-tier */
}

body.is-pro .pro-veil:not(.empty-veil),
body.is-pro .pro-badge {
  display: none !important;
}

/* ── Shape lock ──────────────────────────────────────────────── */
.shape-lock {
  position: relative;
  display: block;
}

.shape-lock .shape-veil {
  position: absolute;
  inset: 0;
  background: rgba(255, 255, 255, 0.6);
  border-radius: 0.375rem;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.15s ease;
  z-index: 10;
  pointer-events: none;
}

.shape-lock.shape-locked:hover .shape-veil {
  opacity: 1;
  pointer-events: auto;
}

.shape-veil .shape-veil-text {
  background: rgba(0, 0, 0, 0.78);
  color: #fff;
  font-size: 0.8rem;
  padding: 0.5rem 0.75rem;
  border-radius: 0.375rem;
  text-align: center;
  max-width: 360px;
}

.shape-veil .shape-veil-text a {
  color: #fff;
  text-decoration: underline;
}

.shape-lock .form-control,
.shape-lock .form-select,
.shape-lock .form-check {
  position: relative;
  z-index: 1;
}

.shape-lock.dimmed {
  pointer-events: auto;
}

/* ── Waypoint lock ───────────────────────────────────────────── */
.waypoint-lock {
  position: relative;
  display: block;
}

.waypoint-lock .waypoint-veil {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.6);
  border-radius: 0.375rem;
  opacity: 0;
  transition: opacity 0.15s ease;
  z-index: 10;
  pointer-events: none;
}

.waypoint-veil .waypoint-veil-text {
  background: rgba(0, 0, 0, 0.78);
  color: #fff;
  font-size: 0.8rem;
  padding: 0.5rem 0.75rem;
  border-radius: 0.375rem;
  text-align: center;
  max-width: 360px;
}

.waypoint-lock.waypoint-locked .waypoint-veil {
  opacity: 1;
  pointer-events: auto;
}

@media (hover: hover) {
  .waypoint-lock.waypoint-locked .waypoint-veil {
    opacity: 0;
    pointer-events: none;
  }
  .waypoint-lock.waypoint-locked:hover .waypoint-veil {
    opacity: 1;
    pointer-events: auto;
  }
}

/* ── Interval veil ───────────────────────────────────────────── */
#interval_div {
  position: relative;
}

.interval-veil {
  position: absolute;
  inset: 0;
  background: rgba(255, 255, 255, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 0.375rem;
  z-index: 10;
  pointer-events: auto;
}

.interval-veil .text {
  background: rgba(0, 0, 0, 0.8);
  color: #fff;
  font-size: 0.85rem;
  padding: 0.35rem 0.6rem;
  border-radius: 0.35rem;
  text-align: center;
}

/* ── Sticky / pinned panels ──────────────────────────────────── */
.sticky-panel {
  position: sticky;
  top: 1rem;
}

#keybindsBox {
  position: sticky;
  bottom: 1rem;
  z-index: 5;
}

#folderpanel {
  position: sticky;
  top: 0;
  z-index: 1020;
  max-height: calc(100vh - 8px);
  overflow: auto;
  background: var(--bs-body-bg, #fff);
}

#generateBar {
  position: sticky;
  bottom: 0;
  z-index: 1030;
}

#keybindsPanel {
  z-index: 1010;
}

/* ── Form components ─────────────────────────────────────────── */
.btn-cta {
  padding: 0.9rem 1.2rem;
  font-weight: 600;
}

.controls::placeholder {
  color: #6c757d;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
}

@media (min-width: 1200px) {
  .form-grid {
    grid-template-columns: 1fr 1fr;
  }
}

#fs-advanced .form-grid {
  grid-template-columns: 1fr !important;
}

#fs-advanced .form-grid > [data-name] {
  grid-column: 1 / -1;
}

#tab-settings [data-name="overlap"] {
  grid-column: 1 / -1;
}

#tab-settings [data-name="line-direction"] {
  grid-column: 1 / -1;
}

.range-labels {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
  margin-top: 0.25rem;
}

/* ── Generate button ────────────────────────────────────────── */
#presetGenBtn {
  font-weight: 600;
  letter-spacing: 0.01em;
}

/* ── Search input group ─────────────────────────────────────── */
.wm-search-group .input-group-text {
  background: #f8fafc;
  border-right: 0;
  color: #94a3b8;
}
.wm-search-group .form-control {
  border-left: 0;
}
.wm-search-group .form-control:focus {
  box-shadow: none;
  border-color: #ced4da;
}

/* ── Help popovers ───────────────────────────────────────────── */
.help-pop {
  cursor: help;
  vertical-align: middle;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.25rem;
  height: 1.25rem;
  border-radius: 50%;
  font-size: 0.8rem;
  color: #6c757d;
  border: 1px solid rgba(108, 117, 125, 0.4);
  margin-left: 0.35rem;
  line-height: 1;
}

.help-pop:hover {
  color: #495057;
  border-color: rgba(73, 80, 87, 0.5);
}

.popover {
  max-width: 360px;
}

.popover .popover-body img {
  width: 100%;
  height: auto;
  border-radius: 0.375rem;
  margin-bottom: 0.5rem;
  display: block;
}

/* ── GM InfoWindow ───────────────────────────────────────────── */
.gm-iw-section {
  margin-top: 0.5rem;
}

.gm-iw-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

/* ── Onboarding overlay ──────────────────────────────────────── */
.onboard {
  position: fixed;
  inset: 0;
  z-index: 2000;
  pointer-events: none;
}

.onboard.hidden {
  display: none;
}

.onboard .mask {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.35);
  pointer-events: auto;
}

.onboard .card {
  position: fixed;
  min-width: 280px;
  max-width: 360px;
  background: #fff;
  border-radius: 0.75rem;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
  padding: 1rem;
  pointer-events: auto;
}

/* ── Overlay chips (KML/KMZ import) ─────────────────────────── */
.overlay-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: #f8f9fa;
  border: 1px solid #e9ecef;
  border-radius: 999px;
  padding: 0.2rem 0.6rem;
  font-size: 0.85rem;
}

.overlay-chip .x {
  cursor: pointer;
}

/* ── Side-panel tabs (pill style) ───────────────────────────── */
#sideTabs {
  border-bottom: 1px solid var(--wm-panel-border);
  padding-bottom: 0.5rem;
  gap: 0.15rem;
}
#sideTabs .nav-link {
  font-size: 0.82rem;
  font-weight: 500;
  color: #475569;
  border-radius: 0.4rem;
  padding: 0.3rem 0.75rem;
  border: none;
}
#sideTabs .nav-link.active {
  color: var(--wm-accent);
  background: #e6f7f5;
  font-weight: 600;
}
#sideTabs .nav-link:hover:not(.active) {
  color: #1e293b;
  background: #f1f5f9;
}

/* ── Keybinds list ───────────────────────────────────────────── */
#keybindsBox ul {
  margin: 0.25rem 0 0 0.5rem;
  padding: 0;
}

#keybindsBox li {
  margin: 0.1rem 0;
}

/* ── Toolbar icon buttons ───────────────────────────────────── */
.wm-btn-icon {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
}

/* ── Badges ──────────────────────────────────────────────────── */
.wm-badge {
  font-size: 0.75rem;
  vertical-align: middle;
}

.pro-badge {
  margin-left: 0.35rem;
}

/* ── Nav tabs ────────────────────────────────────────────────── */
.nav-tabs .nav-link {
  font-weight: 600;
}

/* ── Flight path preview styles ──────────────────────────────── */
.preview-straight {
  stroke-color: #6c757d;
  stroke-opacity: 0.5;
  stroke-weight: 1;
}

.preview-curved {
  stroke-color: #00A896;
  stroke-opacity: 0.9;
  stroke-weight: 2;
}

/* ── Utility ─────────────────────────────────────────────────── */
.hide {
  display: none !important;
}

.dimmed {
  opacity: 0.5;
  pointer-events: none;
}

.search-hit {
  outline: 2px solid rgba(0,168,150,0.2);
  border-radius: 0.375rem;
}

/* ── Pulse animation (onboarding highlight) ──────────────────── */
.pulse {
  animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(0, 168, 150, 0.35);
  }
  70% {
    box-shadow: 0 0 0 12px rgba(0, 168, 150, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(0, 168, 150, 0);
  }
}

/* ── Mobile refinements ─────────────────────────────────────── */
@media (max-width: 575.98px) {
  #drawToolbar .btn .btn-label {
    display: none;
  }
  #drawToolbar .btn {
    padding: 0.4rem 0.6rem;
  }
  .wm-hide-xs {
    display: none !important;
  }
}
