﻿*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --accent: #10b981;
  --accent-hover: #059669;
  --bg-dark: #0f172a;
  --bg-panel: #1e293b;
  --bg-card: #334155;
  --text: #f8fafc;
  --text-muted: #94a3b8;
  --border: #475569;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg-dark);
  color: var(--text);
}

/* ============================================
   LOADER
   ============================================ */
#loader {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: var(--bg-dark);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
  transition: opacity 0.5s ease;
}

#loader.done {
  opacity: 0;
  pointer-events: none;
}

.loader-spinner {
  width: 44px;
  height: 44px;
  border: 4px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

#loader-text {
  font-size: 14px;
  color: var(--text-muted);
}

#loader-progress {
  width: 200px;
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  overflow: hidden;
}

#loader-bar {
  width: 0%;
  height: 100%;
  background: var(--accent);
  border-radius: 2px;
  transition: width 0.3s ease;
}

/* ============================================
   VIEWER
   ============================================ */
#viewer-wrap {
  position: relative;
  width: 100%;
  height: 100%;
}

#panorama {
  width: 100%;
  height: 100%;
}

/* ============================================
   PANELLUM LOADER ANPASSUNG
   ============================================ */
.pnlm-load-box {
  background: rgba(15,23,42,0.9) !important;
  border-radius: 12px !important;
  padding: 20px 28px !important;
  box-shadow: 0 8px 32px rgba(0,0,0,0.4) !important;
  border: 1px solid rgba(42,66,96,0.4) !important;
  backdrop-filter: blur(10px) !important;
}

.pnlm-load-box .pnlm-load-button {
  background: var(--accent) !important;
  border: none !important;
  border-radius: 8px !important;
  padding: 10px 20px !important;
  color: white !important;
  font-family: inherit !important;
  font-size: 14px !important;
  font-weight: 600 !important;
  cursor: pointer !important;
  transition: background 0.2s !important;
}

.pnlm-load-box .pnlm-load-button:hover {
  background: var(--accent-hover) !important;
}

.pnlm-load-box .pnlm-load-progress-bar {
  background: var(--accent) !important;
  border-radius: 3px !important;
  height: 4px !important;
  box-shadow: 0 0 8px rgba(16,185,129,0.5) !important;
}

.pnlm-load-box .pnlm-load-progress-background {
  background: var(--border) !important;
  border-radius: 3px !important;
  height: 4px !important;
}

/* ============================================
   HEADER / WHITE-LABEL
   ============================================ */
#header {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  padding: 16px 24px;
  pointer-events: none;
  display: flex;
  justify-content: center;
}

#logo {
  height: 48px;
  width: auto;
  object-fit: contain;
  filter: drop-shadow(0 2px 8px rgba(0,0,0,0.5));
}

/* ============================================
   PITCH/YAW ANZEIGE ( fuer Hardcoding )
   ============================================ */
#coords {
  position: absolute;
  top: 16px;
  right: 16px;
  z-index: 100;
  display: flex;
  gap: 20px;
  padding: 10px 16px;
  background: rgba(15,23,42,0.85);
  border-radius: 10px;
  border: 1px solid rgba(71,85,105,0.4);
  backdrop-filter: blur(10px);
  font-family: 'SF Mono', 'Fira Code', 'Cascadia Code', monospace;
  font-size: 13px;
  color: var(--text-muted);
  pointer-events: none;
  user-select: none;
}

#coords strong {
  color: var(--accent);
  min-width: 55px;
  display: inline-block;
}

/* ============================================
   FLOOR BADGE
   ============================================ */
#floor-badge {
  position: absolute;
  bottom: 24px;
  left: 20px;
  z-index: 100;
  padding: 8px 16px;
  background: rgba(15,23,42,0.85);
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  border: 1px solid rgba(42,66,96,0.4);
  backdrop-filter: blur(8px);
  display: none;
}

#floor-badge.visible {
  display: block;
}

/* ============================================
   MODALS
   ============================================ */
.modal {
  position: fixed;
  inset: 0;
  z-index: 500;
  background: rgba(0,0,0,0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(6px);
  animation: fadeIn 0.2s ease;
}

.modal.hidden {
  display: none;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal-content {
  position: relative;
  width: 90%;
  max-width: 440px;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 32px;
  box-shadow: 0 12px 40px rgba(0,0,0,0.5);
  animation: slideUp 0.3s ease;
}

@keyframes slideUp {
  from { transform: translateY(20px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

.modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 8px;
  background: rgba(255,255,255,0.08);
  color: var(--text-muted);
  font-size: 22px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.modal-close:hover {
  background: rgba(255,255,255,0.15);
  color: var(--text);
}

/* ============================================
   ELEVATOR MODAL
   ============================================ */
.elevator-panel {
  text-align: center;
}

.elevator-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 80px;
  height: 80px;
  border-radius: 20px;
  background: rgba(16,185,129,0.15);
  color: white;
  margin-bottom: 16px;
}

.elevator-panel h2 {
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 4px;
}

.elevator-subtitle {
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: 24px;
}

.floor-buttons {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.floor-btn {
  display: flex;
  align-items: center;
  gap: 16px;
  width: 100%;
  padding: 16px 20px;
  border: 2px solid var(--border);
  border-radius: 12px;
  background: var(--bg-dark);
  color: white;
  cursor: pointer;
  transition: all 0.2s;
  text-align: left;
}

.floor-btn:hover {
  border-color: var(--accent);
  background: rgba(16,185,129,0.08);
}

.floor-btn.floor-active {
  border-color: var(--accent);
  background: rgba(16,185,129,0.1);
}

.floor-label {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border-radius: 10px;
  background: var(--primary);
  color: white;
  font-size: 16px;
  font-weight: 700;
  flex-shrink: 0;
}

.floor-btn.floor-active .floor-label {
  background: var(--accent);
  color: white;
}

.floor-name {
  font-size: 15px;
  font-weight: 500;
}

.floor-btn.floor-current {
  opacity: 0.4;
  pointer-events: none;
}

/* ============================================
   INFO MODAL
   ============================================ */
#info-title {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 16px;
}

#info-body {
  font-size: 14px;
  line-height: 1.7;
  color: var(--text-muted);
}

#info-body table {
  width: 100%;
  border-collapse: collapse;
}

#info-body td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}

#info-body td:first-child {
  color: var(--text);
  font-weight: 600;
  width: 40%;
}

/* ============================================
   CUSTOM HOTSPOTS
   ============================================ */
.custom-hs {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 3px 12px rgba(0,0,0,0.5);
  border: 2px solid rgba(255,255,255,0.25);
  transition: all 0.25s;
  position: relative;
  color: white;
}

.custom-hs:hover {
  transform: scale(1.15);
  border-color: white;
  box-shadow: 0 4px 20px rgba(0,0,0,0.6);
}

.custom-hs.type-info { background: rgba(27,58,92,0.9); }
.custom-hs.type-scene { background: rgba(34,197,94,0.9); }
.custom-hs.type-elevator { background: rgba(16,185,129,0.9); }
.custom-hs.type-url { background: rgba(168,85,247,0.9); }

.hs-tooltip {
  position: absolute;
  bottom: calc(100% + 10px);
  left: 50%;
  transform: translateX(-50%);
  padding: 6px 12px;
  background: rgba(0,0,0,0.9);
  color: white;
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
  border-radius: 8px;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s;
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

.hs-tooltip::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 5px solid transparent;
  border-top-color: rgba(0,0,0,0.9);
}

.custom-hs:hover .hs-tooltip {
  opacity: 1;
}

.custom-hs.type-elevator {
  animation: pulse-elevator 2s ease-in-out infinite;
}

@keyframes pulse-elevator {
  0%, 100% { box-shadow: 0 3px 12px rgba(0,0,0,0.5); }
  50% { box-shadow: 0 3px 20px rgba(16,185,129,0.5); }
}

/* ============================================
   AUFZUG BUTTON (immer sichtbar)
   ============================================ */
#elevator-btn {
  position: absolute;
  bottom: 20px;
  right: 20px;
  z-index: 100;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 18px;
  border: none;
  border-radius: 12px;
  background: var(--accent);
  color: white;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(16,185,129,0.4);
  transition: all 0.2s;
}

#elevator-btn:hover {
  background: var(--accent-hover);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(16,185,129,0.5);
}

#elevator-btn svg {
  flex-shrink: 0;
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 768px) {
  #coords {
    font-size: 11px;
    gap: 12px;
    padding: 8px 12px;
  }

  #logo { height: 36px; }
  #header { padding: 10px 16px; }
  .scene-btn { padding: 6px 12px; font-size: 12px; }
  .elevator-panel { padding: 24px 20px; }
}
