:root {
  --bg-color: #f8fafc;
  --panel-bg: rgba(255, 255, 255, 0.8);
  --panel-border: rgba(0, 0, 0, 0.1);
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --accent: #3b82f6;
  --accent-hover: #2563eb;
  --danger: #ef4444;
}

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

body {
  margin: 0;
  overflow: hidden;
  background-color: var(--bg-color);
  font-family: 'Inter', sans-serif;
  color: var(--text-primary);
}

#viewer-canvas {
  width: 100vw;
  height: 100vh;
  display: block;
}

/* Loader */
.loader-container {
  position: absolute;
  top: 0; left: 0; width: 100%; height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  background-color: var(--bg-color);
  z-index: 100;
  transition: opacity 0.5s ease;
}

.spinner {
  width: 50px;
  height: 50px;
  border: 3px solid rgba(0,0,0,0.1);
  border-radius: 50%;
  border-top-color: var(--accent);
  animation: spin 1s ease-in-out infinite;
  margin-bottom: 20px;
}

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

.loader-text {
  font-size: 1rem;
  color: var(--text-secondary);
  letter-spacing: 1px;
}

/* UI Elements */
.ui-container {
  position: absolute;
  top: 0; left: 0; width: 100%; height: 100%;
  pointer-events: none;
  z-index: 10;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 24px;
}

.glass-panel {
  background: var(--panel-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--panel-border);
  border-radius: 16px;
  padding: 16px 24px;
  pointer-events: auto;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

/* Hamburger Menu Button */
.menu-btn {
  position: absolute;
  top: 24px;
  left: 24px;
  background: white;
  border: 1px solid var(--panel-border);
  border-radius: 12px;
  padding: 10px;
  cursor: pointer;
  z-index: 2000;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  pointer-events: auto;
}
.menu-btn:hover {
  transform: scale(1.05);
  box-shadow: 0 6px 16px rgba(0,0,0,0.15);
}

/* Side Menu */
.side-menu {
  position: absolute;
  top: 0;
  left: -320px;
  width: 320px;
  height: 100%;
  background: white;
  z-index: 3000;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 4px 0 24px rgba(0,0,0,0.15);
  padding: 30px;
  display: flex;
  flex-direction: column;
  pointer-events: auto;
}
.side-menu.open {
  transform: translateX(320px);
}
.menu-overlay {
  position: absolute;
  top: 0; left: 0; width: 100%; height: 100%;
  background: rgba(0,0,0,0.3);
  backdrop-filter: blur(2px);
  z-index: 2500;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
}
.menu-overlay.show {
  opacity: 1;
  pointer-events: auto;
}

.menu-header {
  margin-bottom: 24px;
}
.menu-header h2 {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text-primary);
}
.project-info {
  font-size: 0.75rem;
  color: var(--text-secondary);
  font-family: monospace;
  margin-top: 5px;
}

.positions-list {
  flex: 1;
  overflow-y: auto;
  margin: 0 -10px;
  padding: 0 10px;
}
.position-item {
  padding: 14px;
  margin-bottom: 10px;
  border-radius: 12px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.2s;
}
.position-item:hover {
  background: #f1f5f9;
}
.position-item.active {
  background: var(--accent);
  color: white;
}
.position-item.active .pos-meta {
  color: rgba(255, 255, 255, 0.8);
}

.pos-name {
  font-weight: 600;
  font-size: 1rem;
  margin-bottom: 3px;
}
.pos-meta {
  font-size: 0.75rem;
  color: var(--text-secondary);
}

/* Title and UI */
.header h1 {
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: 4px;
}

.project-title-container {
  position: absolute;
  top: 24px;
  left: 96px; /* Увеличен отступ от гамбургера */
  text-align: left;
  pointer-events: none;
  z-index: 5;
  height: 50px;
  display: flex;
  align-items: center;
}

.project-title-container h1 {
  font-size: 1.4rem;
  font-weight: 700;
  color: #5c463a;
  margin-bottom: 0;
  text-shadow: 0 0 10px white, 0 0 20px white;
}

.bottom-controls {
  position: absolute;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 12px;
  padding: 12px;
  border-radius: 999px;
  pointer-events: auto;
}

.btn {
  display: flex;
  align-items: center;
  gap: 8px;
  background: transparent;
  border: none;
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 500;
  padding: 10px 20px;
  border-radius: 999px;
  border: 1px solid transparent;
  cursor: pointer;
  outline: none;
  transition: all 0.2s ease;
}

.btn.primary {
  background: var(--accent);
}

@media (hover: hover) {
  .btn.primary:hover {
    background: var(--accent-hover);
  }
}

.btn.secondary {
  background: rgba(0, 0, 0, 0.05);
  padding: 10px 14px;
}

@media (hover: hover) {
  .btn.secondary:hover {
    background: rgba(0, 0, 0, 0.1);
  }
}

.btn.active-hide {
  background: rgba(239, 68, 68, 0.15);
  color: #991b1b;
  border: 1px solid rgba(239, 68, 68, 0.4);
}

.btn.active-toggle {
  background: var(--accent);
  color: white;
}

@media (hover: hover) {
  .btn.active-toggle:hover {
    background: var(--accent-hover);
  }
}

.nav-controls-group {
  display: flex;
  gap: 6px;
  margin-left: 4px;
}

.bottom-controls {
  gap: 12px;
  padding: 6px 12px !important;
}

.v-divider {
  width: 1px;
  height: 24px;
  background: rgba(0,0,0,0.1);
  margin: 0 4px;
}

.nav-btn {
  padding: 8px !important;
  width: 38px;
  height: 38px;
  justify-content: center;
}

.nav-btn.active {
  background: var(--accent) !important;
  color: #fff !important;
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}
.nav-btn svg {
  color: inherit; /* Ensure icon uses parent color (white when active) */
}

/* Hide navigation mode buttons on mobile */
@media (max-width: 600px) {
  .nav-controls-group, .v-divider {
    display: none !important;
  }
}

.btn svg {
  flex-shrink: 0;
}

/* Desktop Adaptive: Sidebar always open */
@media (min-width: 1024px) {
  .side-menu {
    left: 0;
    transform: none !important;
    box-shadow: 1px 0 10px rgba(0,0,0,0.05);
    border-right: 1px solid var(--panel-border);
  }
  .menu-btn {
    display: none !important;
  }
  .menu-overlay {
    display: none !important;
  }
  .project-title-container {
    display: none !important; /* На десктопе заголовок не нужен, он есть в списке */
  }
  .nav-tools {
    left: calc(50% + 160px);
  }
  .bottom-controls {
    /* Offset controls to center relative to the remaining space */
    left: calc(50% + 160px); 
  }
}

.top-right-logo {
  position: absolute;
  top: 24px;
  right: 24px;
  max-width: 150px;
  max-height: 50px;
  z-index: 1000;
  filter: drop-shadow(0px 0px 2px rgba(0,0,0,0.5));
  opacity: 0;
  transition: opacity 0.3s ease;
}

