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

:root {
  --bg:        #0f1117;
  --bg2:       #161b27;
  --bg3:       #1e2535;
  --border:    #2a3248;
  --accent:    #3b82f6;
  --accent-h:  #60a5fa;
  --text:      #e2e8f0;
  --text-dim:  #8892a4;
  --panel-w:   220px;
  --toolbar-h: 48px;
  --status-h:  28px;
  --radius:    6px;
}

html, body { height: 100%; overflow: hidden; font-family: 'Segoe UI', system-ui, sans-serif; background: var(--bg); color: var(--text); font-size: 13px; }

/* ── Toolbar ──────────────────────────────────────────────────────── */
.toolbar {
  height: var(--toolbar-h);
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; padding: 0 12px;
  gap: 12px; flex-shrink: 0; z-index: 10;
}
.toolbar-left  { display: flex; align-items: center; gap: 8px; min-width: var(--panel-w); }
.toolbar-center{ display: flex; align-items: center; gap: 10px; flex: 1; justify-content: center; }
.toolbar-right { display: flex; align-items: center; gap: 8px; min-width: var(--panel-w); justify-content: flex-end; }

.app-icon  { font-size: 20px; }
.app-title { font-size: 15px; font-weight: 600; letter-spacing: .4px; white-space: nowrap; }
.file-name { color: var(--text-dim); font-size: 12px; max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.url-bar { display: flex; align-items: center; gap: 6px; }
.url-bar[hidden] { display: none; }
.url-input {
  flex: 1; max-width: 340px; min-width: 120px;
  background: var(--bg3); color: var(--text); border: 1px solid var(--border);
  border-radius: 6px; padding: 4px 8px; font-size: 12px; outline: none;
}
.url-input:focus { border-color: var(--accent); }

/* ── Buttons ──────────────────────────────────────────────────────── */
.btn {
  cursor: pointer; border: none; border-radius: var(--radius);
  padding: 5px 12px; font-size: 12px; font-weight: 500; transition: background .15s, opacity .15s;
  user-select: none; white-space: nowrap;
}
.btn-primary  { background: var(--accent);  color: #fff; }
.btn-primary:hover  { background: var(--accent-h); }
.btn-secondary{ background: var(--bg3); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--border); }
.btn:disabled { opacity: .4; cursor: default; pointer-events: none; }

/* ── Main layout ──────────────────────────────────────────────────── */
.app-main {
  display: flex;
  height: calc(100vh - var(--toolbar-h) - var(--status-h));
  overflow: hidden;
}

/* ── Panels ───────────────────────────────────────────────────────── */
.panel {
  width: var(--panel-w);
  background: var(--bg2);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  overflow: hidden; flex-shrink: 0;
}
.panel-right { border-right: none; border-left: 1px solid var(--border); overflow-y: auto; }

.panel-header {
  padding: 8px 12px;
  font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .8px;
  color: var(--text-dim); background: var(--bg3);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  flex-shrink: 0;
}

.badge {
  background: var(--bg); color: var(--text-dim);
  border-radius: 10px; padding: 1px 7px; font-size: 10px;
}

/* ── Zone list ────────────────────────────────────────────────────── */
.zone-all-row {
  padding: 6px 10px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.zones-list {
  flex: 1; overflow-y: auto; padding: 4px 0;
}
.zones-list::-webkit-scrollbar { width: 4px; }
.zones-list::-webkit-scrollbar-track { background: transparent; }
.zones-list::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

.zone-item {
  display: flex; align-items: center; gap: 7px;
  padding: 5px 10px; cursor: pointer;
  border-radius: 0; transition: background .1s;
}
.zone-item:hover { background: var(--bg3); }
.zone-item input[type=checkbox] { accent-color: var(--accent); cursor: pointer; flex-shrink: 0; }
.zone-dot {
  width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0;
}
.zone-label { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; }
.zone-count { color: var(--text-dim); font-size: 11px; flex-shrink: 0; }

/* ── Canvas container ─────────────────────────────────────────────── */
.canvas-container {
  flex: 1; position: relative; overflow: hidden; background: #0a0e18;
}
#gl-canvas {
  display: block; width: 100%; height: 100%;
}

/* ── Drop overlay ─────────────────────────────────────────────────── */
.drop-overlay {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  background: rgba(10,14,24,.92);
  transition: background .2s;
  pointer-events: none;
}
.drop-overlay.drag-active { background: rgba(59,130,246,.18); }
.drop-overlay.hidden { display: none; }

.drop-content { text-align: center; pointer-events: none; }
.drop-icon    { font-size: 52px; margin-bottom: 12px; }
.drop-text    { font-size: 18px; font-weight: 600; margin-bottom: 6px; }
.drop-subtext { color: var(--text-dim); font-size: 13px; }

/* ── Controls hint ────────────────────────────────────────────────── */
.controls-hint {
  position: absolute; bottom: 10px; left: 50%; transform: translateX(-50%);
  background: rgba(0,0,0,.6); color: var(--text-dim);
  padding: 4px 12px; border-radius: 20px; font-size: 11px;
  white-space: nowrap; pointer-events: none;
}

/* ── Loading overlay ──────────────────────────────────────────────── */
.loading-overlay {
  display: none;   /* hidden by default — shown via .visible class */
  position: absolute; inset: 0;
  background: rgba(10,14,24,.75);
  flex-direction: column; align-items: center; justify-content: center; gap: 12px;
}
.loading-overlay.visible { display: flex; }
.loading-text { color: var(--text-dim); font-size: 13px; }
.spinner {
  width: 36px; height: 36px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Legend ───────────────────────────────────────────────────────── */
.legend-list { padding: 8px 12px; display: flex; flex-direction: column; gap: 5px; }
.legend-item { display: flex; align-items: center; gap: 8px; font-size: 12px; }
.legend-dot  { width: 12px; height: 12px; border-radius: 3px; flex-shrink: 0; }

/* ── Surface info ─────────────────────────────────────────────────── */
.surface-info { padding: 8px 12px; }
.info-row { display: flex; gap: 6px; margin-bottom: 5px; font-size: 12px; line-height: 1.4; }
.info-label { color: var(--text-dim); min-width: 80px; flex-shrink: 0; }
.info-value { color: var(--text); word-break: break-word; }
.info-value.highlight { color: var(--accent-h); font-weight: 600; }

/* ── Type filters ─────────────────────────────────────────────────── */
.type-filters-list { padding: 4px 12px 8px; display: flex; flex-direction: column; gap: 4px; }
.type-filter-item {
  display: flex; align-items: center; gap: 7px;
  font-size: 12px; cursor: pointer; padding: 3px 0;
  border-radius: var(--radius); transition: background .1s;
}
.type-filter-item:hover { background: var(--bg3); }
.type-filter-item input { accent-color: var(--accent); cursor: pointer; flex-shrink: 0; }

/* ── Options ──────────────────────────────────────────────────────── */
.options-list { padding: 8px 12px; display: flex; flex-direction: column; gap: 7px; }
.option-item  {
  display: flex; align-items: center; gap: 8px;
  font-size: 12px; cursor: pointer;
}
.option-item input { accent-color: var(--accent); cursor: pointer; }

/* ── Status bar ───────────────────────────────────────────────────── */
.status-bar {
  height: var(--status-h);
  background: var(--bg2); border-top: 1px solid var(--border);
  display: flex; align-items: center; padding: 0 14px;
  gap: 16px; font-size: 11px; color: var(--text-dim); flex-shrink: 0;
}
.stats { margin-left: auto; }

/* ── Empty hints ──────────────────────────────────────────────────── */
.empty-hint {
  color: var(--text-dim); font-size: 11px;
  text-align: center; padding: 14px 8px; line-height: 1.6;
}
