/* ============================================================
   ParkViewer — Design System & Styles
   Mary Cummings Park RC Field Explorer
   ============================================================ */

/* ---------- CSS Custom Properties ---------- */
:root {
  /* Color palette */
  --bg-primary: #0a0e17;
  --bg-secondary: #111827;
  --bg-card: rgba(17, 24, 39, 0.85);
  --bg-glass: rgba(17, 24, 39, 0.72);
  --bg-hover: rgba(30, 41, 59, 0.7);

  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;

  --accent-cyan: #00e5ff;
  --accent-amber: #ffd600;
  --accent-orange: #ff9100;
  --accent-red: #ff1744;
  --accent-green: #00e676;
  --accent-blue: #448aff;
  --accent-purple: #d500f9;

  --border-subtle: rgba(148, 163, 184, 0.12);
  --border-accent: rgba(0, 229, 255, 0.3);

  --gradient-header: linear-gradient(135deg, #0a0e17 0%, #1a1f35 50%, #0d1525 100%);
  --gradient-accent: linear-gradient(135deg, #00e5ff, #448aff);
  --gradient-warm: linear-gradient(135deg, #ffd600, #ff9100);

  --shadow-lg: 0 20px 60px rgba(0, 0, 0, 0.5);
  --shadow-glow: 0 0 30px rgba(0, 229, 255, 0.15);

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;

  --transition-fast: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-smooth: 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-spring: 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);

  /* Layout */
  --header-height: 64px;
  --panel-width: 380px;
  --panel-width-mobile: 100%;

  /* Z-index layers */
  --z-map: 1;
  --z-controls: 100;
  --z-panel: 500;
  --z-header: 600;
  --z-overlay: 700;
  --z-toast: 800;
}

/* ---------- Reset & Base ---------- */
*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  overflow: hidden;
  height: 100vh;
  width: 100vw;
}

/* ---------- Custom Scrollbar ---------- */
::-webkit-scrollbar {
  width: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: var(--text-muted);
  border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--text-secondary);
}

/* ---------- App Layout ---------- */
#app {
  display: flex;
  flex-direction: column;
  height: 100vh;
  width: 100vw;
  overflow: hidden;
}

/* ---------- Header ---------- */
.app-header {
  position: relative;
  z-index: var(--z-header);
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--header-height);
  padding: 0 24px;
  background: var(--gradient-header);
  border-bottom: 1px solid var(--border-subtle);
  flex-shrink: 0;
}

.app-header::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--gradient-accent);
  opacity: 0.6;
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.header-logo {
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--gradient-accent);
  border-radius: var(--radius-sm);
  font-size: 20px;
  animation: logoPulse 4s ease-in-out infinite;
}

@keyframes logoPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(0, 229, 255, 0.3); }
  50% { box-shadow: 0 0 20px 4px rgba(0, 229, 255, 0.15); }
}

.header-title {
  display: flex;
  flex-direction: column;
}

.header-title h1 {
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  background: var(--gradient-accent);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: 1.2;
}

.header-title .subtitle {
  font-size: 0.72rem;
  color: var(--text-muted);
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.header-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  background: var(--bg-hover);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
}

.header-btn:hover {
  color: var(--text-primary);
  border-color: var(--border-accent);
  background: rgba(0, 229, 255, 0.08);
}

.header-btn.active {
  color: var(--accent-cyan);
  border-color: var(--accent-cyan);
  background: rgba(0, 229, 255, 0.12);
}

.header-btn .icon {
  font-size: 1rem;
}

.header-btn .kbd {
  font-size: 0.65rem;
  padding: 2px 5px;
  background: rgba(148, 163, 184, 0.15);
  border-radius: 4px;
  color: var(--text-muted);
  font-family: 'SF Mono', 'Consolas', monospace;
}

/* ---------- Main Content Area ---------- */
.app-main {
  position: relative;
  flex: 1;
  display: flex;
  overflow: hidden;
}

/* ---------- Map Container ---------- */
#map {
  flex: 1;
  z-index: var(--z-map);
  background: var(--bg-primary);
}

/* ---------- Leaflet Overrides ---------- */
.leaflet-container {
  background: var(--bg-primary) !important;
  font-family: 'Inter', sans-serif !important;
}

.leaflet-control-zoom {
  border: none !important;
  box-shadow: var(--shadow-lg) !important;
}

.leaflet-control-zoom a {
  background: var(--bg-card) !important;
  color: var(--text-primary) !important;
  border: 1px solid var(--border-subtle) !important;
  backdrop-filter: blur(20px) !important;
  width: 36px !important;
  height: 36px !important;
  line-height: 36px !important;
  font-size: 18px !important;
  transition: all var(--transition-fast) !important;
}

.leaflet-control-zoom a:hover {
  background: var(--bg-hover) !important;
  border-color: var(--border-accent) !important;
  color: var(--accent-cyan) !important;
}

.leaflet-control-zoom-in {
  border-radius: var(--radius-sm) var(--radius-sm) 0 0 !important;
}

.leaflet-control-zoom-out {
  border-radius: 0 0 var(--radius-sm) var(--radius-sm) !important;
}

.leaflet-control-layers {
  border: none !important;
  box-shadow: var(--shadow-lg) !important;
  border-radius: var(--radius-sm) !important;
  background: var(--bg-card) !important;
  backdrop-filter: blur(20px) !important;
}

.leaflet-control-layers-toggle {
  width: 36px !important;
  height: 36px !important;
  background-size: 20px 20px !important;
}

.leaflet-control-layers-expanded {
  padding: 10px 14px !important;
  color: var(--text-primary) !important;
  border: 1px solid var(--border-subtle) !important;
}

.leaflet-control-layers label {
  font-size: 0.82rem !important;
  margin-bottom: 4px !important;
}

.leaflet-control-layers-separator {
  border-top-color: var(--border-subtle) !important;
}

.leaflet-control-attribution {
  background: rgba(10, 14, 23, 0.8) !important;
  color: var(--text-muted) !important;
  font-size: 0.65rem !important;
  backdrop-filter: blur(10px) !important;
}

.leaflet-control-attribution a {
  color: var(--text-secondary) !important;
}

.leaflet-popup-content-wrapper {
  background: var(--bg-card) !important;
  color: var(--text-primary) !important;
  border: 1px solid var(--border-subtle) !important;
  border-radius: var(--radius-md) !important;
  box-shadow: var(--shadow-lg) !important;
  backdrop-filter: blur(20px) !important;
}

.leaflet-popup-tip {
  background: var(--bg-card) !important;
  border: 1px solid var(--border-subtle) !important;
}

.leaflet-popup-close-button {
  color: var(--text-muted) !important;
  font-size: 20px !important;
}

.leaflet-popup-close-button:hover {
  color: var(--text-primary) !important;
}

.leaflet-tooltip {
  background: var(--bg-card) !important;
  color: var(--text-primary) !important;
  border: 1px solid var(--border-subtle) !important;
  border-radius: var(--radius-sm) !important;
  box-shadow: var(--shadow-lg) !important;
  backdrop-filter: blur(20px) !important;
  font-family: 'Inter', sans-serif !important;
  font-size: 0.78rem !important;
  font-weight: 500 !important;
  padding: 6px 10px !important;
}

.leaflet-tooltip::before {
  border-top-color: var(--bg-card) !important;
}

/* ---------- Side Panel ---------- */
.side-panel {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: var(--panel-width);
  z-index: var(--z-panel);
  background: var(--bg-glass);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border-left: 1px solid var(--border-subtle);
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform var(--transition-smooth);
  will-change: transform;
}

.side-panel.open {
  transform: translateX(0);
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px;
  border-bottom: 1px solid var(--border-subtle);
  flex-shrink: 0;
}

.panel-header h2 {
  font-size: 1rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}

.panel-header h2 .icon {
  font-size: 1.1rem;
}

.panel-close {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  cursor: pointer;
  font-size: 1.1rem;
  transition: all var(--transition-fast);
}

.panel-close:hover {
  color: var(--text-primary);
  border-color: var(--accent-red);
  background: rgba(255, 23, 68, 0.1);
}

.panel-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px 20px;
}

/* ---------- Search Input ---------- */
.search-wrapper {
  position: relative;
  margin-bottom: 16px;
}

.search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 0.9rem;
  pointer-events: none;
}

.search-input {
  width: 100%;
  padding: 10px 14px 10px 36px;
  background: var(--bg-hover);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.82rem;
  outline: none;
  transition: all var(--transition-fast);
}

.search-input::placeholder {
  color: var(--text-muted);
}

.search-input:focus {
  border-color: var(--accent-cyan);
  box-shadow: 0 0 0 3px rgba(0, 229, 255, 0.1);
}

/* ---------- Rules Panel ---------- */
.rules-category {
  margin-bottom: 12px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  overflow: hidden;
  transition: all var(--transition-fast);
}

.rules-category:hover {
  border-color: rgba(148, 163, 184, 0.2);
}

.category-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  background: rgba(30, 41, 59, 0.4);
  cursor: pointer;
  user-select: none;
  transition: all var(--transition-fast);
}

.category-header:hover {
  background: rgba(30, 41, 59, 0.7);
}

.category-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  font-weight: 600;
}

.category-title .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.category-chevron {
  font-size: 0.75rem;
  color: var(--text-muted);
  transition: transform var(--transition-fast);
}

.rules-category.expanded .category-chevron {
  transform: rotate(180deg);
}

.category-rules {
  max-height: 0;
  overflow: hidden;
  transition: max-height var(--transition-smooth);
}

.rules-category.expanded .category-rules {
  max-height: 800px;
}

.rule-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 14px;
  border-top: 1px solid var(--border-subtle);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.rule-item:hover {
  background: var(--bg-hover);
}

.rule-item.highlighted {
  background: rgba(0, 229, 255, 0.08);
  border-left: 3px solid var(--accent-cyan);
}

.rule-number {
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(148, 163, 184, 0.1);
  border-radius: 6px;
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--text-muted);
}

.rule-text {
  font-size: 0.8rem;
  line-height: 1.5;
  color: var(--text-secondary);
}

.rule-item:hover .rule-text {
  color: var(--text-primary);
}

/* ---------- Legend Panel ---------- */
.legend-section {
  margin-bottom: 20px;
}

.legend-section-title {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 10px;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.legend-item:hover {
  background: var(--bg-hover);
}

.legend-swatch {
  width: 32px;
  height: 18px;
  border-radius: 4px;
  flex-shrink: 0;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.legend-swatch.line {
  height: 4px;
  border-radius: 2px;
}

.legend-swatch.point {
  width: 18px;
  height: 18px;
  border-radius: 50%;
}

.legend-label {
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-secondary);
}

.legend-item:hover .legend-label {
  color: var(--text-primary);
}

.legend-toggle {
  margin-left: auto;
  width: 36px;
  height: 20px;
  background: rgba(148, 163, 184, 0.2);
  border-radius: 10px;
  border: none;
  cursor: pointer;
  position: relative;
  transition: all var(--transition-fast);
}

.legend-toggle::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  background: var(--text-secondary);
  border-radius: 50%;
  transition: all var(--transition-fast);
}

.legend-toggle.on {
  background: rgba(0, 229, 255, 0.3);
}

.legend-toggle.on::after {
  left: 18px;
  background: var(--accent-cyan);
}

/* ---------- Info Panel ---------- */
.info-section {
  margin-bottom: 20px;
}

.info-section-title {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 10px;
}

.info-card {
  background: rgba(30, 41, 59, 0.4);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  margin-bottom: 10px;
}

.info-card h4 {
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.info-card p {
  font-size: 0.8rem;
  line-height: 1.55;
  color: var(--text-secondary);
}

.info-stat {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
}

.info-stat + .info-stat {
  border-top: 1px solid var(--border-subtle);
}

.info-stat-icon {
  font-size: 1.1rem;
  width: 24px;
  text-align: center;
}

.info-stat-label {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.info-stat-value {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-left: auto;
}

/* ---------- Popup Content (on map) ---------- */
.popup-content {
  min-width: 200px;
  max-width: 280px;
}

.popup-title {
  font-size: 0.92rem;
  font-weight: 700;
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.popup-badge {
  font-size: 0.65rem;
  padding: 2px 7px;
  border-radius: 4px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.popup-badge.boundary { background: rgba(0, 229, 255, 0.15); color: var(--accent-cyan); }
.popup-badge.runway { background: rgba(255, 214, 0, 0.15); color: var(--accent-amber); }
.popup-badge.restricted { background: rgba(255, 23, 68, 0.15); color: var(--accent-red); }
.popup-badge.station { background: rgba(0, 230, 118, 0.15); color: var(--accent-green); }
.popup-badge.facility { background: rgba(68, 138, 255, 0.15); color: var(--accent-blue); }

.popup-description {
  font-size: 0.8rem;
  line-height: 1.5;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.popup-rules-title {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.popup-rule-ref {
  font-size: 0.75rem;
  color: var(--accent-cyan);
  cursor: pointer;
  display: inline-block;
  padding: 2px 6px;
  margin: 2px;
  background: rgba(0, 229, 255, 0.08);
  border-radius: 4px;
  transition: all var(--transition-fast);
}

.popup-rule-ref:hover {
  background: rgba(0, 229, 255, 0.2);
}

/* ---------- Map Info Overlay ---------- */
.map-info-overlay {
  position: absolute;
  bottom: 40px;
  left: 16px;
  z-index: var(--z-controls);
  background: var(--bg-glass);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 16px;
  box-shadow: var(--shadow-lg);
}

.map-info-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.map-info-item .icon {
  font-size: 0.9rem;
}

.map-info-item strong {
  color: var(--text-primary);
  font-weight: 600;
}

.map-info-divider {
  width: 1px;
  height: 20px;
  background: var(--border-subtle);
}

/* ---------- Pilot Station Markers ---------- */
.station-marker {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  background: var(--accent-green);
  border: 2px solid #fff;
  border-radius: 50%;
  font-size: 0.72rem;
  font-weight: 800;
  color: #0a0e17;
  box-shadow: 0 2px 8px rgba(0, 230, 118, 0.4);
  transition: all var(--transition-fast);
}

.station-marker:hover {
  transform: scale(1.2);
  box-shadow: 0 4px 16px rgba(0, 230, 118, 0.6);
}

.parking-marker {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  background: var(--accent-blue);
  border: 2px solid #fff;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  color: #fff;
  box-shadow: 0 2px 8px rgba(68, 138, 255, 0.4);
}

.board-marker {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  background: var(--accent-purple);
  border: 2px solid #fff;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  color: #fff;
  box-shadow: 0 2px 8px rgba(213, 0, 249, 0.4);
}

/* ---------- Loading Screen ---------- */
.loading-screen {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: var(--bg-primary);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
  transition: opacity 0.6s ease, visibility 0.6s ease;
}

.loading-screen.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.loading-spinner {
  width: 48px;
  height: 48px;
  border: 3px solid var(--border-subtle);
  border-top-color: var(--accent-cyan);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.loading-text {
  font-size: 0.85rem;
  color: var(--text-muted);
  letter-spacing: 0.03em;
}

/* ---------- Directions panel ---------- */
.directions-list {
  padding-left: 0;
  list-style: none;
}

.directions-list li {
  position: relative;
  padding: 6px 0 6px 20px;
  font-size: 0.8rem;
  line-height: 1.5;
  color: var(--text-secondary);
}

.directions-list li::before {
  content: '→';
  position: absolute;
  left: 0;
  color: var(--accent-cyan);
  font-weight: 600;
}

/* ---------- Responsive: Mobile ---------- */
@media (max-width: 768px) {
  .app-header {
    padding: 0 14px;
    height: 54px;
  }

  .header-logo {
    width: 32px;
    height: 32px;
    font-size: 16px;
  }

  .header-title h1 {
    font-size: 0.95rem;
  }

  .header-title .subtitle {
    display: none;
  }

  .header-btn .label {
    display: none;
  }

  .header-btn .kbd {
    display: none;
  }

  .side-panel {
    top: auto;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    max-height: 65vh;
    border-left: none;
    border-top: 1px solid var(--border-subtle);
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    transform: translateY(100%);
  }

  .side-panel.open {
    transform: translateY(0);
  }

  .panel-header {
    padding: 14px 16px;
  }

  .panel-header::before {
    content: '';
    position: absolute;
    top: 8px;
    left: 50%;
    transform: translateX(-50%);
    width: 36px;
    height: 4px;
    background: var(--text-muted);
    border-radius: 2px;
    opacity: 0.5;
  }

  .map-info-overlay {
    bottom: 30px;
    left: 8px;
    right: 8px;
    justify-content: center;
    flex-wrap: wrap;
    gap: 10px;
    padding: 10px 14px;
  }
}

/* ---------- Utility Classes ---------- */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

/* ---------- Animation: fade-in-up ---------- */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.animate-in {
  animation: fadeInUp 0.4s ease-out forwards;
}

/* Runway direction arrows via pattern */
.runway-label {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--bg-primary);
  background: var(--accent-amber);
  padding: 2px 8px;
  border-radius: 4px;
  white-space: nowrap;
}

/* ============================================================
   Editor Mode Styles
   ============================================================ */

/* ---------- Edit Mode Button State ---------- */
.header-btn.edit-active {
  color: #0a0e17;
  border-color: var(--accent-amber);
  background: var(--accent-amber);
  box-shadow: 0 0 16px rgba(255, 214, 0, 0.3);
}

.header-btn.edit-active:hover {
  background: #ffe033;
  border-color: #ffe033;
  color: #0a0e17;
}

/* ---------- Edit Toolbar (bottom bar) ---------- */
.edit-toolbar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: var(--z-toast);
  transform: translateY(100%);
  transition: transform var(--transition-smooth);
  pointer-events: none;
}

.edit-toolbar.visible {
  transform: translateY(0);
  pointer-events: auto;
}

.edit-toolbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 24px;
  background: rgba(17, 24, 39, 0.92);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border-top: 1px solid rgba(255, 214, 0, 0.25);
  box-shadow: 0 -8px 40px rgba(0, 0, 0, 0.5);
}

.edit-toolbar-status {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.edit-pulse {
  width: 10px;
  height: 10px;
  background: var(--accent-amber);
  border-radius: 50%;
  animation: editPulse 1.5s ease-in-out infinite;
}

@keyframes editPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255, 214, 0, 0.5); }
  50% { box-shadow: 0 0 12px 4px rgba(255, 214, 0, 0.25); }
}

.edit-status-text {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--accent-amber);
  letter-spacing: 0.02em;
  transition: color var(--transition-fast);
}

.edit-toolbar-hint {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-align: center;
  flex: 1;
  min-width: 0;
}

.edit-toolbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.edit-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
}

.edit-btn.export {
  background: rgba(0, 229, 255, 0.12);
  color: var(--accent-cyan);
  border-color: rgba(0, 229, 255, 0.3);
}

.edit-btn.export:hover {
  background: rgba(0, 229, 255, 0.22);
  border-color: var(--accent-cyan);
}

.edit-btn.download {
  background: rgba(0, 230, 118, 0.12);
  color: var(--accent-green);
  border-color: rgba(0, 230, 118, 0.3);
}

.edit-btn.download:hover {
  background: rgba(0, 230, 118, 0.22);
  border-color: var(--accent-green);
}

.edit-btn.cancel {
  background: rgba(255, 23, 68, 0.12);
  color: var(--accent-red);
  border-color: rgba(255, 23, 68, 0.3);
}

.edit-btn.cancel:hover {
  background: rgba(255, 23, 68, 0.22);
  border-color: var(--accent-red);
}

/* ---------- Vertex Handles ---------- */
.vertex-handle {
  width: 14px;
  height: 14px;
  background: var(--accent-amber);
  border: 2px solid #fff;
  border-radius: 50%;
  cursor: grab;
  box-shadow: 0 2px 8px rgba(255, 214, 0, 0.5);
  transition: all var(--transition-fast);
}

.vertex-handle:hover {
  transform: scale(1.4);
  box-shadow: 0 4px 16px rgba(255, 214, 0, 0.7);
  background: #ffe033;
}

.vertex-handle:active {
  cursor: grabbing;
}

.vertex-handle.active {
  background: var(--accent-cyan);
  box-shadow: 0 2px 12px rgba(0, 229, 255, 0.6);
  border-color: #fff;
}

/* ---------- Coordinates Panel ---------- */
.coords-panel {
  position: fixed;
  top: calc(var(--header-height) + 16px);
  right: 16px;
  z-index: var(--z-overlay);
  width: 280px;
  max-height: 400px;
  background: rgba(17, 24, 39, 0.92);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  transform: translateX(120%);
  transition: transform var(--transition-smooth);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.coords-panel.visible {
  transform: translateX(0);
}

.coords-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-subtle);
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-primary);
  flex-shrink: 0;
}

.coords-close {
  width: 26px;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.9rem;
  transition: all var(--transition-fast);
}

.coords-close:hover {
  color: var(--text-primary);
  border-color: var(--accent-red);
  background: rgba(255, 23, 68, 0.1);
}

.coords-body {
  flex: 1;
  overflow-y: auto;
  padding: 12px 16px;
}

.coords-title {
  font-size: 0.85rem;
  font-weight: 700;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-primary);
}

.coords-type {
  font-size: 0.65rem;
  padding: 2px 7px;
  background: rgba(255, 214, 0, 0.15);
  color: var(--accent-amber);
  border-radius: 4px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.coords-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 5px 0;
  border-bottom: 1px solid rgba(148, 163, 184, 0.06);
  font-size: 0.75rem;
}

.coords-label {
  color: var(--text-muted);
  font-weight: 600;
  min-width: 28px;
}

.coords-value {
  font-family: 'SF Mono', 'Consolas', 'Menlo', monospace;
  color: var(--accent-cyan);
  font-size: 0.72rem;
}

/* ---------- Toast Notification ---------- */
.edit-toast {
  position: fixed;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  z-index: 9999;
  padding: 12px 24px;
  background: rgba(17, 24, 39, 0.95);
  backdrop-filter: blur(20px);
  border: 1px solid var(--border-accent);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 0.85rem;
  font-weight: 600;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
  opacity: 0;
  transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  pointer-events: none;
}

.edit-toast.visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ---------- Edit Mode: Dim map-info overlay ---------- */
.edit-mode-active .map-info-overlay {
  opacity: 0.3;
  pointer-events: none;
}

/* ---------- Edit Mode Responsive ---------- */
@media (max-width: 768px) {
  .edit-toolbar-hint {
    display: none;
  }

  .edit-toolbar-inner {
    padding: 10px 14px;
    gap: 10px;
  }

  .edit-btn .label-text {
    display: none;
  }

  .coords-panel {
    right: 8px;
    left: 8px;
    width: auto;
    top: auto;
    bottom: 70px;
    max-height: 240px;
  }
}
