/*
 * EduGames - Interactive Learning Games
 * (c) 2025-2026 Prof. N. All rights reserved.
 *
 * File:    styles/components/vr-scene.css
 * Updated: 2026-10-03 19:22
 * Purpose: The Virtual Reality tab (scripts/components/vr-scene.js): the window with the 3D office, its tool buttons, the
 *          speech bubble, full screen. The 2D fallback picture is in vr-room2d.css.
 */

.vs-root {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
}

/* the window: the 3D office (or the 2D picture) fills it */
.vs-stage {
  position: relative;
  width: 100%;
  aspect-ratio: 400 / 250;
  overflow: hidden;
  border-radius: 10px;
  box-shadow: 0 3px 10px var(--shadow-color);
  background: #263043;
  touch-action: pan-y; /* a vertical swipe still scrolls the page; a sideways drag turns the view */
  user-select: none;
  cursor: grab;
}

.vs-stage.vs-dragging {
  cursor: grabbing;
}

/* shown until the office is ready */
.vs-loading {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0;
  color: #fff;
  font-size: 0.9rem;
}

.vs-bubble {
  position: absolute;
  left: 50%;
  top: 82%;
  max-width: 82%;
  transform: translateX(-50%);
  padding: 0.4rem 0.7rem;
  border: 2px solid #2b2b2b;
  border-radius: 12px;
  background: #fffbe6;
  color: #2b2b2b;
  font-size: 0.8rem;
  font-weight: 700;
  line-height: 1.25;
  text-align: center;
  pointer-events: none;
  animation: vs-pop 0.25s ease-out;
}

.vs-bubble::after {
  content: "";
  position: absolute;
  left: 50%;
  top: -9px;
  width: 12px;
  height: 12px;
  background: #fffbe6;
  border-left: 2px solid #2b2b2b;
  border-top: 2px solid #2b2b2b;
  transform: translateX(-50%) rotate(45deg);
}

.vs-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.5rem;
}

.vs-btn {
  margin: 0;
  padding: 0.4rem 0.9rem;
  border: 1px solid var(--border-color, #ccc);
  border-radius: 6px;
  background: var(--bg-card, #fff);
  color: var(--text-primary, #212529);
  font: inherit;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
}

.vs-btn:hover {
  border-color: var(--color-primary, #007bff);
}

.vs-btn:focus-visible {
  outline: 2px solid var(--color-primary, #007bff);
  outline-offset: 2px;
}

.vs-btn[hidden],
.vs-tool[hidden],
.vs-room[hidden],
.vs-tools[hidden],
.vs-hint[hidden] {
  display: none;
}

.vs-room {
  position: absolute;
  inset: 0;
}

.vs-room canvas {
  display: block;
  width: 100%;
  height: 100%;
  outline-offset: -4px;
}

.vs-tools {
  position: absolute;
  top: 6px;
  right: 6px;
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 4px;
  max-width: 70%;
}

.vs-tool {
  margin: 0;
  padding: 0.25rem 0.55rem;
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: 5px;
  background: rgba(20, 26, 44, 0.8);
  color: #fff;
  font: inherit;
  font-size: 0.72rem;
  font-weight: 700;
  cursor: pointer;
}

.vs-tool:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 2px;
}

.vs-tool[aria-pressed="true"] {
  background: #1565c0;
}

.vs-hint {
  position: absolute;
  top: 8px;
  left: 10px;
  margin: 0;
  font-size: 0.72rem;
  color: #fff;
  text-shadow: 0 1px 3px #000;
  pointer-events: none;
}

/* full screen (Cardboard mode) uses the window itself */
.vs-stage:fullscreen {
  width: 100%;
  max-width: none;
  height: 100%;
  aspect-ratio: auto;
  border-radius: 0;
  background: #0b0f1a;
}

@keyframes vs-pop { from { transform: translateX(-50%) scale(0.85); opacity: 0; } to { transform: translateX(-50%) scale(1); opacity: 1; } }

@media (prefers-reduced-motion: reduce) {
  .vs-bubble {
    animation: none;
  }
}

/* page-filling window where the Fullscreen API is missing (for example iPhone) */
.vs-stage.vs-expanded {
  position: fixed;
  inset: 0;
  z-index: 3000;
  width: 100%;
  max-width: none;
  height: 100%;
  aspect-ratio: auto;
  border-radius: 0;
}

.vs-locked {
  overflow: hidden;
}