/* ═══════════════════════════════════════════════════════════
   R.VISION — Panorama 360° Editor
   Premium dark theme with #57ffff accents
   ═══════════════════════════════════════════════════════════ */

:root {
  --accent: #57ffff;
  --accent-dim: rgba(87, 255, 255, 0.15);
  --accent-glow: rgba(87, 255, 255, 0.3);
  --bg-dark: #0a0e14;
  --bg-panel: rgba(10, 14, 20, 0.92);
  --bg-card: rgba(20, 28, 40, 0.85);
  --text: #e0e6f0;
  --text-dim: rgba(224, 230, 240, 0.55);
  --border: rgba(87, 255, 255, 0.12);
  --radius: 10px;
  --font: 'Outfit', system-ui, -apple-system, sans-serif;
}

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

html, body {
  width: 100%; height: 100%;
  overflow: hidden;
  font-family: var(--font);
  background: var(--bg-dark);
  color: var(--text);
}

#app {
  position: relative;
  width: 100%; height: 100%;
}

/* ─── Header ──────────────────────────── */
#header {
  position: absolute;
  top: 0; left: 0; right: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  background: linear-gradient(180deg, rgba(0,0,0,0.7) 0%, transparent 100%);
  pointer-events: none;
}

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

.header-left, .header-right {
  display: flex; align-items: center; gap: 10px;
}

.logo {
  display: flex; align-items: center; gap: 7px;
  font-weight: 600; font-size: 14px;
  color: var(--accent);
  letter-spacing: 0.3px;
}

.logo svg { opacity: 0.9; stroke: var(--accent); }

.scene-label {
  font-size: 13px;
  color: var(--text-dim);
  font-weight: 400;
}

.coords-display {
  font-size: 11px;
  font-family: 'Courier New', monospace;
  color: var(--accent);
  background: rgba(0,0,0,0.5);
  padding: 4px 10px;
  border-radius: 6px;
  border: 1px solid var(--border);
}

.btn-editor {
  display: flex; align-items: center; gap: 6px;
  padding: 6px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-card);
  color: var(--text-dim);
  font-family: var(--font);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  backdrop-filter: blur(10px);
}

.btn-editor:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-dim);
}

.btn-editor.active {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-dim);
  box-shadow: 0 0 12px rgba(87,255,255,0.15);
}

.btn-editor svg { stroke: currentColor; }

/* ─── Editor Panel ────────────────────── */
.editor-panel {
  position: absolute;
  top: 50px; right: 12px;
  z-index: 100;
  width: 300px;
  max-height: calc(100vh - 120px);
  overflow-y: auto;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  backdrop-filter: blur(20px);
  box-shadow: 0 8px 32px rgba(0,0,0,0.5);
  animation: slideIn 0.25s ease;
}

.editor-panel.hidden { display: none; }

@keyframes slideIn {
  from { opacity: 0; transform: translateX(20px); }
  to   { opacity: 1; transform: translateX(0); }
}

.editor-info {
  font-size: 12px;
  color: var(--accent);
  background: var(--accent-dim);
  padding: 8px 12px;
  border-radius: 8px;
  margin-bottom: 12px;
  border: 1px solid rgba(87,255,255,0.1);
}

.editor-row {
  display: flex; align-items: center; gap: 8px;
  margin-bottom: 12px;
}

.editor-row label {
  font-size: 12px; font-weight: 500;
  color: var(--text-dim);
  white-space: nowrap;
}

.editor-row select {
  flex: 1;
  padding: 5px 8px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-family: var(--font);
  font-size: 12px;
  outline: none;
}

.editor-row select:focus { border-color: var(--accent); }

.editor-portals { margin-bottom: 12px; }

.editor-portals strong {
  display: block;
  font-size: 12px;
  color: var(--text-dim);
  margin-bottom: 6px;
}

.portal-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: 6px 10px;
  background: var(--bg-card);
  border: 1px solid rgba(255,255,255,0.04);
  border-radius: 6px;
  margin-bottom: 4px;
  font-size: 11px;
  color: var(--text);
  transition: all 0.15s;
}

.portal-item:hover {
  border-color: var(--accent);
  background: var(--accent-dim);
}

.portal-item .portal-delete {
  background: none; border: none;
  color: #ff5757;
  cursor: pointer;
  font-size: 14px;
  padding: 2px 4px;
  border-radius: 4px;
  transition: all 0.15s;
}

.portal-item .portal-delete:hover {
  background: rgba(255,87,87,0.15);
}

.editor-actions {
  display: flex; gap: 8px;
}

.btn-export, .btn-import {
  flex: 1;
  padding: 7px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-card);
  color: var(--text);
  font-family: var(--font);
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-export:hover, .btn-import:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* ─── 3D Canvas ───────────────────────── */
#canvas-container {
  position: absolute;
  inset: 0;
  z-index: 1;
  background: var(--bg-dark);
}

#canvas-container canvas {
  display: block;
  width: 100% !important;
  height: 100% !important;
}

/* ─── Loading ─────────────────────────── */
.loading {
  position: absolute;
  inset: 0;
  z-index: 200;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: var(--bg-dark);
  transition: opacity 0.4s ease;
}

.loading.fade-out {
  opacity: 0;
  pointer-events: none;
}

.spinner {
  width: 36px; height: 36px;
  border: 3px solid rgba(87,255,255,0.15);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

.loading-text {
  margin-top: 10px;
  font-size: 13px;
  color: var(--text-dim);
}

/* ─── Thumbnails Bar ──────────────────── */
.thumbs {
  position: absolute;
  bottom: 14px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 100;
  display: flex;
  gap: 5px;
  padding: 6px 10px;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  backdrop-filter: blur(16px);
  box-shadow: 0 4px 20px rgba(0,0,0,0.4);
  max-width: calc(100vw - 32px);
  overflow-x: auto;
}

.thumbs::-webkit-scrollbar { height: 0; }

.thumb-btn {
  min-width: 32px; height: 32px;
  display: flex; align-items: center; justify-content: center;
  border: 1px solid transparent;
  border-radius: 8px;
  background: var(--bg-card);
  color: var(--text-dim);
  font-family: var(--font);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.thumb-btn:hover {
  border-color: rgba(87,255,255,0.3);
  color: var(--text);
  background: rgba(87,255,255,0.08);
}

.thumb-btn.active {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-dim);
  box-shadow: 0 0 10px rgba(87,255,255,0.12);
}

/* ─── Minimap ─────────────────────────── */
.minimap {
  position: absolute;
  bottom: 60px; left: 14px;
  z-index: 100;
  width: 200px;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px;
  backdrop-filter: blur(16px);
}

.minimap.hidden { display: none; }

.minimap-title {
  font-size: 11px;
  color: var(--text-dim);
  margin-bottom: 8px;
  font-weight: 500;
}

/* ─── Crosshair (editor mode) ─────────── */
.crosshair {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  z-index: 50;
  pointer-events: none;
  width: 24px; height: 24px;
}

.crosshair::before, .crosshair::after {
  content: '';
  position: absolute;
  background: var(--accent);
  opacity: 0.6;
}

.crosshair::before {
  width: 1px; height: 24px;
  left: 50%; top: 0;
  transform: translateX(-50%);
}

.crosshair::after {
  width: 24px; height: 1px;
  top: 50%; left: 0;
  transform: translateY(-50%);
}

/* ─── Responsive ──────────────────────── */
@media (max-width: 600px) {
  .editor-panel { width: calc(100vw - 24px); right: 12px; left: 12px; }
  .thumbs { display: none !important; }
}
