/* ═══════════════════════════════════════════════════════════════════════════
   NavVis Bundle Viewer – Design System
   Farben: Weiß #FFFFFF / Orange #FF6B00 / Dunkelgrau #1A1A1A
   ═══════════════════════════════════════════════════════════════════════════ */

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

:root {
  --orange:       #FF6B00;
  --orange-light: #FF8C35;
  --orange-dark:  #CC5500;
  --orange-dim:   rgba(255, 107, 0, 0.12);
  --white:        #FFFFFF;
  --off-white:    #F7F7F7;
  --gray-100:     #F0F0F0;
  --gray-200:     #E0E0E0;
  --gray-400:     #9E9E9E;
  --gray-600:     #616161;
  --gray-800:     #2A2A2A;
  --black:        #1A1A1A;
  --shadow-sm:    0 2px 8px rgba(0,0,0,0.08);
  --shadow-md:    0 4px 20px rgba(0,0,0,0.12);
  --shadow-lg:    0 8px 40px rgba(0,0,0,0.18);
  --radius-sm:    6px;
  --radius-md:    12px;
  --radius-lg:    20px;
  --transition:   0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

html, body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--off-white);
  color: var(--black);
  line-height: 1.5;
  font-size: 14px;
  height: 100%;
}

/* ── Typography ──────────────────────────────────────────────────────────── */
h1 { font-size: 28px; font-weight: 700; letter-spacing: -0.5px; }
h2 { font-size: 20px; font-weight: 600; }
h3 { font-size: 16px; font-weight: 600; }
p  { color: var(--gray-600); }

/* ── Buttons ──────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background var(--transition), transform var(--transition), box-shadow var(--transition);
  text-decoration: none;
  white-space: nowrap;
}
.btn:active { transform: scale(0.97); }

.btn-primary {
  background: var(--orange);
  color: var(--white);
}
.btn-primary:hover { background: var(--orange-light); box-shadow: 0 4px 16px rgba(255,107,0,0.35); }

.btn-secondary {
  background: var(--white);
  color: var(--black);
  border: 1px solid var(--gray-200);
}
.btn-secondary:hover { background: var(--gray-100); }

.btn-ghost {
  background: transparent;
  color: var(--gray-600);
  padding: 8px 12px;
}
.btn-ghost:hover { background: var(--gray-100); color: var(--black); }

.btn-icon {
  padding: 8px;
  border-radius: 50%;
  background: transparent;
}
.btn-icon:hover { background: var(--orange-dim); color: var(--orange); }

.btn-sm { padding: 6px 14px; font-size: 13px; }

.btn-danger {
  background: #FFF0F0;
  color: #D32F2F;
  border: 1px solid #FFCDD2;
}
.btn-danger:hover { background: #FFCDD2; }

/* ── Cards ────────────────────────────────────────────────────────────────── */
.card {
  background: var(--white);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--gray-100);
  transition: box-shadow var(--transition), transform var(--transition);
}
.card:hover { box-shadow: var(--shadow-md); }

/* ── Inputs ───────────────────────────────────────────────────────────────── */
.input {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-sm);
  font-size: 14px;
  background: var(--white);
  color: var(--black);
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
}
.input:focus {
  border-color: var(--orange);
  box-shadow: 0 0 0 3px var(--orange-dim);
}

/* ── Badge ────────────────────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 99px;
  font-size: 12px;
  font-weight: 500;
}
.badge-orange { background: var(--orange-dim); color: var(--orange-dark); }
.badge-gray   { background: var(--gray-100);   color: var(--gray-600); }
.badge-green  { background: #E8F5E9;            color: #2E7D32; }

/* ── Topbar ───────────────────────────────────────────────────────────────── */
.topbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 60px;
  background: var(--white);
  border-bottom: 1px solid var(--gray-200);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 16px;
  z-index: 100;
  box-shadow: var(--shadow-sm);
}

.topbar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--black);
}

.topbar-logo .logo-icon {
  width: 32px;
  height: 32px;
  background: var(--orange);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 800;
  font-size: 16px;
}

.topbar-logo .logo-text {
  font-size: 16px;
  font-weight: 700;
  color: var(--black);
}

.topbar-logo .logo-sub {
  font-size: 12px;
  color: var(--gray-400);
  margin-left: 2px;
}

.topbar-spacer { flex: 1; }

/* ── Page Layout ──────────────────────────────────────────────────────────── */
.page-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 80px 24px 40px;
}

/* ── Page Header ──────────────────────────────────────────────────────────── */
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 32px;
  gap: 16px;
}
.page-header-left h1 { margin-bottom: 4px; }

/* ── Upload Zone ──────────────────────────────────────────────────────────── */
.upload-zone {
  border: 2px dashed var(--gray-200);
  border-radius: var(--radius-lg);
  padding: 48px;
  text-align: center;
  cursor: pointer;
  transition: all var(--transition);
  background: var(--white);
  position: relative;
  overflow: hidden;
}
.upload-zone:hover, .upload-zone.drag-over {
  border-color: var(--orange);
  background: var(--orange-dim);
}
.upload-zone input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  width: 100%;
  height: 100%;
}
.upload-icon {
  width: 56px;
  height: 56px;
  background: var(--orange-dim);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
  color: var(--orange);
  font-size: 24px;
}
.upload-zone h3 { margin-bottom: 6px; }
.upload-zone p { font-size: 13px; }

/* ── Progress Bar ─────────────────────────────────────────────────────────── */
.progress-bar {
  height: 4px;
  background: var(--gray-200);
  border-radius: 2px;
  overflow: hidden;
  margin-top: 12px;
}
.progress-bar-fill {
  height: 100%;
  background: var(--orange);
  border-radius: 2px;
  transition: width 0.3s ease;
  width: 0%;
}

/* ── Project Grid ─────────────────────────────────────────────────────────── */
.project-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 20px;
  margin-top: 24px;
}

.project-card {
  cursor: pointer;
  text-decoration: none;
  color: inherit;
  display: block;
  position: relative;
  overflow: hidden;
}
.project-card:hover .card-arrow { transform: translateX(4px); }

.project-card-header {
  padding: 20px;
  border-bottom: 1px solid var(--gray-100);
  display: flex;
  align-items: center;
  gap: 14px;
}

.project-thumb {
  width: 56px;
  height: 56px;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, var(--orange-dim), var(--gray-100));
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
}
.project-thumb img { width: 100%; height: 100%; object-fit: cover; }
.project-thumb-icon { font-size: 24px; color: var(--orange); }

.project-card-title { font-size: 15px; font-weight: 600; margin-bottom: 2px; }
.project-card-id { font-size: 11px; color: var(--gray-400); font-family: monospace; }

.project-card-body {
  padding: 16px 20px;
}

.project-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 14px;
}
.project-stat { display: flex; flex-direction: column; gap: 2px; }
.project-stat-value { font-weight: 600; font-size: 15px; color: var(--black); }
.project-stat-label { font-size: 11px; color: var(--gray-400); text-transform: uppercase; letter-spacing: 0.5px; }

.project-card-footer {
  padding: 12px 20px;
  background: var(--off-white);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  color: var(--gray-400);
}

.card-arrow {
  transition: transform var(--transition);
  color: var(--orange);
}

/* ── Toast ────────────────────────────────────────────────────────────────── */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.toast {
  background: var(--black);
  color: var(--white);
  padding: 12px 18px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 260px;
  animation: slideUp 0.3s ease;
}
.toast.success { border-left: 3px solid #4CAF50; }
.toast.error   { border-left: 3px solid #F44336; }
.toast.info    { border-left: 3px solid var(--orange); }
@keyframes slideUp {
  from { transform: translateY(20px); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}

/* ── Loading Spinner ──────────────────────────────────────────────────────── */
.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid var(--gray-200);
  border-top-color: var(--orange);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Empty State ──────────────────────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 64px 24px;
}
.empty-state-icon {
  width: 80px;
  height: 80px;
  background: var(--gray-100);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 20px;
  font-size: 36px;
  color: var(--gray-400);
}

/* ═══════════════════════════════════════════════════════════════════════════
   VIEWER Styles
   ═══════════════════════════════════════════════════════════════════════════ */

body.viewer-page {
  background: var(--black);
  overflow: hidden;
  height: 100vh;
  user-select: none;
}

/* ── Viewer Canvas ─────────────────────────────────────────────────────────── */
#viewer-canvas {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  display: block;
}

/* ── Hotspot Layer (Boden-Navigation) ────────────────────────────────────── */
#hotspot-layer {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 5;
}

.pano-hotspot {
  position: absolute;
  /* Größe, Opacity, Filter per JS gesetzt (Perspektiv-Skalierung + Hover-State) */
  pointer-events: none;
  user-select: none;
  transition: opacity 0.15s ease, filter 0.15s ease, width 0.1s ease, height 0.1s ease;
  will-change: transform, opacity;
}

/* ── Transition Overlay ───────────────────────────────────────────────────── */
#transition-overlay {
  position: fixed;
  inset: 0;
  background: var(--black);
  opacity: 0;
  pointer-events: none;
  z-index: 50;
  transition: opacity 0.35s ease;
}
#transition-overlay.active { opacity: 1; pointer-events: all; }

/* ── Viewer Header ─────────────────────────────────────────────────────────── */
#viewer-header {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 56px;
  background: linear-gradient(to bottom, rgba(0,0,0,0.7), transparent);
  display: flex;
  align-items: center;
  padding: 0 16px;
  gap: 12px;
  z-index: 200;
}

.viewer-logo {
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
}
.viewer-logo .logo-icon {
  width: 28px; height: 28px;
  background: var(--orange);
  border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 13px; color: white;
}
.viewer-logo .logo-text { color: white; font-weight: 600; font-size: 14px; }

.viewer-project-name {
  color: rgba(255,255,255,0.7);
  font-size: 13px;
  margin-left: 4px;
}
.viewer-project-name::before { content: "/"; margin-right: 8px; color: rgba(255,255,255,0.3); }

#viewer-header .topbar-spacer { flex: 1; }

/* ── View Mode Switcher ───────────────────────────────────────────────────── */
.view-mode-switcher {
  display: flex;
  background: rgba(255,255,255,0.12);
  border-radius: 8px;
  padding: 3px;
  gap: 2px;
  backdrop-filter: blur(8px);
}
.view-mode-btn {
  background: none;
  border: none;
  color: rgba(255,255,255,0.7);
  padding: 6px 12px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 500;
  transition: all var(--transition);
  display: flex;
  align-items: center;
  gap: 6px;
}
.view-mode-btn.active {
  background: var(--orange);
  color: white;
}
.view-mode-btn:hover:not(.active) {
  background: rgba(255,255,255,0.1);
  color: white;
}

/* ── Right Sidebar (Etagen) ───────────────────────────────────────────────── */
#floor-panel {
  position: fixed;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.floor-btn {
  background: rgba(255,255,255,0.1);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 8px;
  color: white;
  padding: 8px 14px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  transition: all var(--transition);
  text-align: left;
  min-width: 80px;
}
.floor-btn:hover { background: rgba(255,255,255,0.2); }
.floor-btn.active {
  background: var(--orange);
  border-color: var(--orange);
}
.floor-btn-name { font-size: 11px; opacity: 0.7; }

/* ── Mini Map (bottom right) ─────────────────────────────────────────────── */
#minimap-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 200;
  transition: all var(--transition);
}

#minimap-container.expanded {
  width: 50vw;
  height: 50vh;
  right: 0; bottom: 0;
}

#minimap {
  width: 260px;
  height: 180px;
  background: rgba(20, 20, 20, 0.85);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: var(--radius-md);
  overflow: hidden;
  position: relative;
  box-shadow: var(--shadow-lg);
}
#minimap-container.expanded #minimap {
  width: 100%;
  height: 100%;
  border-radius: 0;
}

#minimap-map {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

/* Leaflet-Overrides: passt OSM-Karte in dunkles Design ein */
#minimap-map .leaflet-control-attribution {
  background: rgba(0,0,0,0.5) !important;
  color: rgba(255,255,255,0.5) !important;
  font-size: 9px !important;
}
#minimap-map .leaflet-control-attribution a { color: rgba(255,255,255,0.6) !important; }
#minimap-map .leaflet-tile-pane { filter: brightness(0.85) saturate(0.8); }

.minimap-header {
  position: absolute;
  top: 0; left: 0; right: 0;
  padding: 8px 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: linear-gradient(to bottom, rgba(0,0,0,0.6), transparent);
  z-index: 10;
}
.minimap-title {
  color: white;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.minimap-expand-btn {
  background: none;
  border: none;
  color: rgba(255,255,255,0.7);
  cursor: pointer;
  padding: 2px;
  line-height: 1;
  font-size: 14px;
}
.minimap-expand-btn:hover { color: white; }

/* ── Hotspot Dots ──────────────────────────────────────────────────────────── */
.hotspot {
  position: absolute;
  width: 10px;
  height: 10px;
  background: white;
  border: 2px solid rgba(0,0,0,0.3);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  cursor: pointer;
  transition: all 0.15s ease;
  z-index: 5;
}
.hotspot:hover, .hotspot.active {
  background: var(--orange);
  border-color: white;
  width: 14px;
  height: 14px;
  box-shadow: 0 0 0 3px rgba(255,107,0,0.3);
}

/* Direction indicator on minimap */
.hotspot-dir {
  position: absolute;
  width: 0;
  height: 0;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-bottom: 8px solid var(--orange);
  transform-origin: bottom center;
  top: -12px;
  left: -4px;
}

/* ── Navigation Arrows in Panorama ───────────────────────────────────────── */
#pano-nav {
  position: fixed;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 8px;
  z-index: 200;
}

.nav-arrow {
  background: rgba(255,255,255,0.1);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 50%;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: white;
  font-size: 18px;
  transition: all var(--transition);
}
.nav-arrow:hover {
  background: var(--orange);
  border-color: var(--orange);
  box-shadow: 0 0 0 4px rgba(255,107,0,0.25);
}

/* ── Info Panel ────────────────────────────────────────────────────────────── */
#info-panel {
  position: fixed;
  bottom: 20px;
  left: 20px;
  z-index: 200;
  background: rgba(20,20,20,0.8);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  color: white;
  min-width: 180px;
}
.info-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: rgba(255,255,255,0.7);
  margin-bottom: 4px;
}
.info-row:last-child { margin-bottom: 0; }
.info-value { color: white; font-weight: 500; margin-left: auto; }

/* ── Loading Screen ────────────────────────────────────────────────────────── */
#loading-screen {
  position: fixed;
  inset: 0;
  background: var(--black);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 20px;
  z-index: 1000;
  transition: opacity 0.5s ease;
}
#loading-screen.hidden { opacity: 0; pointer-events: none; }

.loading-logo {
  width: 60px; height: 60px;
  background: var(--orange);
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 28px;
  color: white;
  margin-bottom: 8px;
}
.loading-title { color: white; font-size: 20px; font-weight: 700; }
.loading-subtitle { color: var(--gray-400); font-size: 13px; }

.loading-bar {
  width: 240px;
  height: 3px;
  background: rgba(255,255,255,0.1);
  border-radius: 2px;
  overflow: hidden;
  margin-top: 8px;
}
.loading-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--orange), var(--orange-light));
  border-radius: 2px;
  width: 0%;
  transition: width 0.4s ease;
  position: relative;
}
.loading-bar-fill::after {
  content: '';
  position: absolute;
  top: 0; right: 0;
  width: 30px; height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.4));
  animation: shimmer 1s ease infinite;
}
@keyframes shimmer {
  0% { opacity: 0; }
  50% { opacity: 1; }
  100% { opacity: 0; }
}

/* ── Help Tooltip ──────────────────────────────────────────────────────────── */
.help-tooltip {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(20,20,20,0.8);
  backdrop-filter: blur(8px);
  color: rgba(255,255,255,0.8);
  padding: 8px 16px;
  border-radius: 99px;
  font-size: 12px;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s;
  white-space: nowrap;
}
.help-tooltip.visible { opacity: 1; }

/* ── Scrollbar ─────────────────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--gray-200); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--gray-400); }
