/* mirage-city — HUD overlay styles */

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

body {
  overflow: hidden;
  background: #1a1a2e;
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  color: #e0e0e0;
}

/* ---- Canvas ---- */

#canvas-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: 0;
}

/* ---- HUD ---- */

#hud {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 10;
}

#hud > * {
  pointer-events: auto;
}

/* ---- Header ---- */

#hud-header {
  position: absolute;
  top: 16px;
  left: 16px;
  display: flex;
  align-items: center;
  gap: 16px;
}

#city-title {
  font-size: 20px;
  font-weight: 600;
  color: #ffffff;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
}

#search-input {
  padding: 8px 16px;
  border: 1px solid #334;
  border-radius: 20px;
  background: rgba(26, 26, 46, 0.85);
  color: #e0e0e0;
  font-size: 14px;
  width: 240px;
  outline: none;
  backdrop-filter: blur(10px);
}

#search-input:focus {
  border-color: #5588cc;
  box-shadow: 0 0 8px rgba(85, 136, 204, 0.3);
}

#search-input::placeholder {
  color: #667;
}

#search-box {
  position: relative;
}

#search-results {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  width: 320px;
  max-height: 360px;
  overflow-y: auto;
  background: rgba(26, 26, 46, 0.96);
  border: 1px solid #334;
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  z-index: 20;
}

#search-results[hidden] {
  display: none;
}

.search-item {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  padding: 8px 14px;
  cursor: pointer;
  font-size: 13px;
  color: #e0e0e0;
}

.search-item:hover,
.search-item.active {
  background: rgba(85, 136, 204, 0.25);
}

.search-name {
  font-family: 'Consolas', 'Menlo', monospace;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.search-meta {
  color: #889;
  font-size: 11px;
  white-space: nowrap;
}

/* ---- Info Panel ---- */

#info-panel, #road-panel {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 300px;
  background: rgba(26, 26, 46, 0.92);
  border: 1px solid #334;
  border-radius: 12px;
  padding: 20px;
  backdrop-filter: blur(12px);
}

#info-panel.hidden, #road-panel.hidden {
  display: none;
}

#info-close, #road-close {
  position: absolute;
  top: 12px;
  right: 12px;
  background: none;
  border: none;
  color: #888;
  font-size: 20px;
  cursor: pointer;
  line-height: 1;
}

#info-close:hover, #road-close:hover {
  color: #fff;
}

#info-name, #road-name {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 8px;
  word-break: break-all;
}

.info-badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 10px;
  font-size: 12px;
  background: rgba(85, 136, 204, 0.2);
  color: #88bbee;
  margin-right: 6px;
  margin-bottom: 12px;
}

.info-badge.hidden {
  display: none;
}

#info-metrics, #road-metrics {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 12px;
}

#info-metrics td, #road-metrics td {
  padding: 4px 0;
  font-size: 13px;
}

#info-metrics td:first-child, #road-metrics td:first-child {
  color: #889;
}

#info-metrics td:last-child, #road-metrics td:last-child {
  text-align: right;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}

#road-endpoints {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  color: #889;
}

#road-endpoints .hud-btn-small {
  margin-top: 0;
}

#road-ops {
  font-size: 12px;
  color: #aab;
  margin-bottom: 10px;
}

#road-links {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

#road-tooltip {
  position: fixed;
  z-index: 20;
  pointer-events: none;
  background: rgba(20, 20, 34, 0.94);
  border: 1px solid #334;
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 12px;
  max-width: 260px;
}

#road-tooltip.hidden {
  display: none;
}

#road-tooltip-label {
  font-weight: 600;
  margin-bottom: 2px;
}

#road-tooltip-path {
  color: #99a;
}

.file-link {
  display: block;
  font-size: 12px;
  color: #5588cc;
  text-decoration: none;
  word-break: break-all;
}

.file-link:hover {
  text-decoration: underline;
}

.file-link.hidden {
  display: none;
}

.hud-btn-small.hidden {
  display: none;
}

.hud-btn.hidden {
  display: none;
}

.hud-btn-small {
  margin-top: 8px;
  padding: 4px 10px;
  font-size: 12px;
}

/* ---- Legend ---- */

#legend {
  position: absolute;
  bottom: 16px;
  left: 16px;
  display: flex;
  gap: 16px;
  background: rgba(26, 26, 46, 0.85);
  padding: 10px 16px;
  border-radius: 10px;
  backdrop-filter: blur(10px);
  border: 1px solid #334;
}

.legend-entry {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
}

.legend-color {
  width: 12px;
  height: 12px;
  border-radius: 3px;
  flex-shrink: 0;
}

.legend-label {
  color: #ccc;
}

.legend-lang {
  color: #667;
  font-size: 11px;
}

/* ---- Controls Hint ---- */

#controls-hint {
  position: absolute;
  bottom: 16px;
  right: 16px;
  display: flex;
  gap: 16px;
  font-size: 12px;
  color: #556;
}

/* ---- Timeline ---- */

#timeline {
  position: absolute;
  bottom: 64px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 8px;
  width: min(560px, calc(100% - 32px));
  background: rgba(26, 26, 46, 0.85);
  padding: 10px 16px;
  border-radius: 10px;
  backdrop-filter: blur(10px);
  border: 1px solid #334;
}

#timeline.hidden {
  display: none;
}

#timeline-play {
  padding: 6px 10px;
  flex-shrink: 0;
}

#timeline-speed {
  background: rgba(26, 26, 46, 0.85);
  border: 1px solid #334;
  border-radius: 8px;
  color: #c0c8de;
  font-size: 12px;
  padding: 4px 6px;
  flex-shrink: 0;
}

#timeline-scrub {
  flex: 1 1 auto;
  min-width: 0;
}

#timeline-label {
  font-family: 'Consolas', 'Menlo', monospace;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  color: #c0c8de;
  white-space: nowrap;
  flex: 0 0 16ch;
  text-align: right;
  overflow: hidden;
}

#timeline-flows {
  font-family: 'Consolas', 'Menlo', monospace;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  color: #889;
  white-space: nowrap;
  flex: 0 0 10ch;
  text-align: right;
  overflow: hidden;
}

/* ---- HUD Actions ---- */

#hud-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.hud-btn {
  padding: 7px 14px;
  background: rgba(26, 26, 46, 0.85);
  border: 1px solid #334;
  border-radius: 18px;
  color: #c0c8de;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  backdrop-filter: blur(10px);
  transition: all 0.2s ease;
}

.hud-btn.active {
  border-color: #5588cc;
  color: #ffffff;
}

.hud-btn:hover {
  background: rgba(85, 136, 204, 0.25);
  border-color: #5588cc;
  color: #ffffff;
  transform: translateY(-1px);
}

/* ---- Fullscreen Drag Overlay ---- */

.drag-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(15, 15, 30, 0.85);
  backdrop-filter: blur(8px);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.drag-overlay.hidden {
  display: none;
}

.drag-overlay-box {
  border: 2px dashed #5588cc;
  border-radius: 20px;
  padding: 40px 60px;
  text-align: center;
  background: rgba(30, 35, 60, 0.6);
  box-shadow: 0 0 30px rgba(85, 136, 204, 0.3);
}

.drag-overlay-icon {
  font-size: 48px;
  margin-bottom: 12px;
}

.drag-overlay-box h2 {
  color: #ffffff;
  font-size: 22px;
  margin-bottom: 6px;
}

.drag-overlay-box p {
  color: #8899bb;
  font-size: 14px;
}

/* ---- Welcome / Landing Modal ---- */

.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: radial-gradient(circle at 50% 40%, rgba(30, 32, 60, 0.95), rgba(15, 15, 28, 0.98));
  backdrop-filter: blur(16px);
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-backdrop.hidden {
  display: none;
}

.modal-card {
  width: 90%;
  max-width: 480px;
  background: rgba(24, 26, 44, 0.95);
  border: 1px solid rgba(85, 136, 204, 0.25);
  border-radius: 18px;
  padding: 32px;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.6), 0 0 40px rgba(85, 136, 204, 0.1);
  text-align: center;
}

.modal-badge {
  display: inline-block;
  padding: 3px 12px;
  background: rgba(85, 136, 204, 0.15);
  color: #5588cc;
  border: 1px solid rgba(85, 136, 204, 0.3);
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  margin-bottom: 12px;
}

.modal-header h2 {
  font-size: 22px;
  font-weight: 700;
  color: #ffffff;
  margin-bottom: 6px;
}

.modal-subtitle {
  font-size: 13px;
  color: #8899bb;
  margin-bottom: 24px;
}

.drop-zone {
  border: 2px dashed rgba(85, 136, 204, 0.4);
  border-radius: 14px;
  padding: 24px 16px;
  background: rgba(20, 22, 38, 0.5);
  margin-bottom: 20px;
  transition: all 0.2s ease;
}

.drop-zone.dragover {
  border-color: #5588cc;
  background: rgba(85, 136, 204, 0.12);
}

.drop-zone-icon {
  font-size: 32px;
  margin-bottom: 8px;
}

.drop-zone h3 {
  font-size: 15px;
  color: #e0e5f5;
  margin-bottom: 4px;
}

.drop-zone p {
  font-size: 12px;
  color: #7788aa;
  margin-bottom: 14px;
}

.drop-zone code {
  color: #5588cc;
  background: rgba(85, 136, 204, 0.15);
  padding: 1px 5px;
  border-radius: 4px;
  font-family: monospace;
}

.btn-primary {
  display: inline-block;
  padding: 9px 20px;
  background: #3870b8;
  color: #ffffff;
  border: none;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.1s ease;
}

.btn-primary:hover {
  background: #4682cc;
  transform: translateY(-1px);
}

.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 18px;
  background: rgba(40, 44, 70, 0.8);
  border: 1px solid #445;
  color: #d0d8ee;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-secondary:hover {
  background: rgba(60, 66, 100, 0.9);
  border-color: #5588cc;
  color: #ffffff;
}

.modal-divider {
  display: flex;
  align-items: center;
  margin: 18px 0;
  color: #556;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.8px;
}

.modal-divider::before,
.modal-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: #282a44;
}

.modal-divider span {
  padding: 0 12px;
}

.url-input-group {
  display: flex;
  gap: 8px;
}

.url-input-group input {
  flex: 1;
  padding: 9px 14px;
  background: rgba(18, 20, 34, 0.8);
  border: 1px solid #334;
  border-radius: 8px;
  color: #e0e5f5;
  font-size: 13px;
  outline: none;
}

.url-input-group input:focus {
  border-color: #5588cc;
  box-shadow: 0 0 8px rgba(85, 136, 204, 0.3);
}

.modal-error {
  margin-top: 16px;
  padding: 10px 14px;
  background: rgba(220, 60, 60, 0.15);
  border: 1px solid rgba(220, 60, 60, 0.35);
  border-radius: 8px;
  color: #ff8888;
  font-size: 12px;
  text-align: left;
}

.modal-error.hidden {
  display: none;
}

