/* =====================================================
   Site Map → Full Map (immersive)
   ===================================================== */

/* Root takes the entire shell viewport area */
.fmap-root {
  position: absolute;
  inset: 0;
  display: grid;
  grid-template-columns: 320px 1fr;
  background: radial-gradient(ellipse at center, #0b1525 0%, #050a14 100%);
  color: var(--lt);
  overflow: hidden;
  z-index: 1;
}
body[dir="rtl"] .fmap-root { grid-template-columns: 320px 1fr; }
body[dir="rtl"] .fmap-side { border-inline-end: 1px solid var(--b2); border-inline-start: none; }

/* Sidebar */
.fmap-side {
  background: rgba(8, 14, 26, 0.94);
  border-inline-end: 1px solid var(--b2);
  display: flex; flex-direction: column;
  overflow: hidden;
}
.fmap-side-head {
  padding: 14px 16px; border-bottom: 1px solid var(--b3);
  background: linear-gradient(180deg, rgba(6,182,212,0.08), transparent);
}
.fmap-side-title {
  font-size: 14px; font-weight: 800; color: var(--lt);
  letter-spacing: 0.4px; margin-bottom: 2px;
}
.fmap-side-sub {
  font-size: 10px; color: var(--md); letter-spacing: 0.5px; text-transform: uppercase;
}

.fmap-legend {
  padding: 10px 14px; display: flex; flex-wrap: wrap; gap: 6px 12px;
  border-bottom: 1px solid var(--b3); background: rgba(0,0,0,0.2);
}
.fmap-legend-item {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 10px; color: var(--md);
}
.fmap-legend-dot {
  width: 9px; height: 9px; border-radius: 50%;
  box-shadow: 0 0 6px rgba(0,0,0,0.5);
}

/* Region list */
.fmap-region-list {
  flex: 1; overflow-y: auto; padding: 6px;
}
.fmap-region-list::-webkit-scrollbar { width: 6px; }
.fmap-region-list::-webkit-scrollbar-thumb { background: var(--b1); border-radius: 3px; }

.fmap-region-item {
  display: flex; align-items: center; gap: 10px;
  width: 100%; padding: 9px 12px;
  background: transparent; border: 1px solid transparent;
  border-radius: 4px; cursor: pointer; color: var(--lt);
  font-family: inherit; font-size: 12px; text-align: start;
  margin-bottom: 3px; transition: all 0.15s;
}
.fmap-region-item:hover {
  background: rgba(6, 182, 212, 0.08);
  border-color: rgba(6, 182, 212, 0.3);
}
.fmap-region-item.active {
  background: rgba(6, 182, 212, 0.16);
  border-color: var(--or);
}
.fmap-region-item.drillable .fmap-region-name::after {
  content: ' •';
  color: var(--or);
}
.fmap-region-dot {
  width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0;
  box-shadow: 0 0 8px currentColor;
}
.fmap-region-name {
  flex: 1; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.fmap-region-cnt {
  font-family: monospace; font-size: 11px; font-weight: 700;
  background: var(--bg3); padding: 2px 8px; border-radius: 8px;
  color: var(--or); min-width: 32px; text-align: center;
}
.fmap-region-drill {
  color: var(--or); font-size: 14px; flex-shrink: 0;
}

.fmap-side-foot {
  padding: 10px 14px; border-top: 1px solid var(--b3);
  display: flex; gap: 8px; background: rgba(0,0,0,0.3);
}
.fmap-btn {
  flex: 1; padding: 8px 12px; border-radius: 3px;
  font-size: 11px; font-weight: 600; letter-spacing: 0.4px;
  cursor: pointer; font-family: inherit;
  border: 1px solid var(--b1); background: var(--bg3); color: var(--lt);
  transition: all 0.15s;
}
.fmap-btn.primary {
  background: var(--or); color: #0b1220; border-color: var(--or); font-weight: 700;
}
.fmap-btn.primary:hover { background: #22d3ee; }
.fmap-btn.ghost:hover { background: var(--bg2); border-color: var(--or); }

/* Canvas area */
.fmap-canvas-wrap {
  position: relative; display: flex; flex-direction: column;
  background: radial-gradient(circle at 30% 40%, #0a1830 0%, #050a14 70%);
  overflow: hidden;
}

.fmap-toolbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 18px; border-bottom: 1px solid var(--b3);
  background: rgba(0, 0, 0, 0.55); backdrop-filter: blur(8px);
  z-index: 5;
}

.fmap-bread { display: flex; align-items: center; gap: 8px; font-size: 12px; }
.fmap-bread-item {
  padding: 4px 10px; border-radius: 3px; cursor: pointer; color: var(--md);
  font-weight: 600; letter-spacing: 0.3px; transition: all 0.15s;
}
.fmap-bread-item:hover { color: var(--or); }
.fmap-bread-item.active {
  color: var(--lt); background: var(--bg3); cursor: default;
}
.fmap-bread-sep { color: var(--md); font-size: 14px; }

.fmap-stats { display: flex; gap: 12px; font-size: 11px; color: var(--md); }
.fmap-stat b { color: var(--lt); margin-inline-end: 4px; font-size: 14px; }
.fmap-stat.good b { color: #22c55e; }
.fmap-stat.bad  b { color: #ef4444; }

.fmap-canvas {
  flex: 1; position: relative;
  background: transparent;
}

/* Leaflet container — make it transparent so our gradient shows */
.fmap-canvas .leaflet-container {
  background: transparent !important;
}

/* Custom tooltip styling */
.fmap-tooltip.leaflet-tooltip {
  background: rgba(8, 14, 26, 0.96);
  border: 1px solid var(--or);
  border-radius: 4px;
  color: var(--lt);
  padding: 0;
  box-shadow: 0 8px 24px rgba(0,0,0,0.5);
}
.fmap-tooltip.leaflet-tooltip::before { display: none; }
.fmap-tip { padding: 10px 12px; min-width: 160px; font-family: 'Tahoma', system-ui, sans-serif; }
.fmap-tip-name { font-size: 13px; font-weight: 800; margin-bottom: 6px; color: var(--or); }
.fmap-tip-row {
  display: flex; justify-content: space-between; gap: 12px;
  font-size: 11px; padding: 2px 0;
}
.fmap-tip-row span { color: var(--md); }
.fmap-tip-row b { color: var(--lt); font-family: monospace; }
.fmap-tip-row.good b { color: #22c55e; }
.fmap-tip-row.bad  b { color: #ef4444; }
.fmap-tip-hint {
  margin-top: 6px; padding-top: 6px;
  border-top: 1px dashed var(--b2);
  font-size: 9px; color: var(--md); text-transform: uppercase; letter-spacing: 0.4px;
  text-align: center;
}

/* Loaders */
.fmap-loader, .fmap-loader-sm {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  color: var(--md); font-size: 12px; letter-spacing: 0.5px; text-transform: uppercase;
}
.fmap-loader-sm { position: static; padding: 24px; }
.fmap-empty { padding: 30px 20px; text-align: center; color: var(--md); font-size: 11px; }
.fmap-error { padding: 60px 20px; text-align: center; color: #ef4444; }

/* Light theme adjustments */
body.light .fmap-root {
  background: radial-gradient(ellipse at center, #e0e7ff 0%, #cbd5e1 100%);
  color: #0f172a;
}
body.light .fmap-side { background: rgba(255,255,255,0.96); }
body.light .fmap-canvas-wrap {
  background: radial-gradient(circle at 30% 40%, #dbeafe 0%, #cbd5e1 70%);
}
body.light .fmap-toolbar { background: rgba(255,255,255,0.85); }
body.light .fmap-region-cnt { background: #e2e8f0; color: #0891b2; }
body.light .fmap-region-item.active { background: rgba(6,182,212,0.18); }
body.light .fmap-tooltip.leaflet-tooltip { background: rgba(255,255,255,0.97); color: #0f172a; }

/* Native fullscreen handling */
.fmap-root:fullscreen,
.fmap-root:-webkit-full-screen {
  background: radial-gradient(ellipse at center, #050a14 0%, #000 100%);
}
.fmap-root:fullscreen .fmap-canvas-wrap,
.fmap-root:-webkit-full-screen .fmap-canvas-wrap {
  background: radial-gradient(circle at 30% 40%, #0a1830 0%, #000 80%);
}