/**
 * vr-styles.css — Styles pour l'expérience VR/AR
 */

html, body {
  height: 100%;
  margin: 0;
  background: #181c24;
}

#ui-panel {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 1000;
  background: rgba(30, 34, 44, 0.98);
  color: #fff;
  border-radius: 12px;
  box-shadow: 0 4px 24px #0005;
  padding: 20px;
  min-width: 260px;
  font-family: 'Segoe UI', Arial, sans-serif;
  transition: box-shadow 0.2s;
}

#ui-panel h2 {
  margin: 0 0 10px 0;
  font-size: 1.2em;
}

#ui-panel label {
  display: block;
  margin: 10px 0 2px;
  font-size: 0.98em;
}

#ui-panel input[type=number] {
  width: 60px;
}

#ui-panel .row {
  display: flex;
  gap: 8px;
  align-items: center;
}

#ui-panel .row label {
  flex: 1;
}

#ui-panel .row input {
  flex: 1;
}

#ui-panel .actions {
  margin-top: 12px;
  display: flex;
  gap: 8px;
}

#ui-toggle {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 1100;
  background: #23273a;
  color: #fff;
  border-radius: 50%;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px #0003;
  cursor: pointer;
  font-size: 1.3em;
  border: none;
  outline: none;
}

#joystick-container {
  position: fixed;
  left: 24px;
  bottom: 24px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

#joystick {
  width: 90px;
  height: 90px;
  background: #23273a;
  border-radius: 50%;
  border: 2px solid #4a5060;
  position: relative;
  touch-action: none;
}

#joystick-knob {
  width: 44px;
  height: 44px;
  background: #4a5060;
  border-radius: 50%;
  position: absolute;
  left: 23px;
  top: 23px;
  transition: left 0.05s, top 0.05s;
}

#ab-buttons {
  display: flex;
  gap: 12px;
  margin-top: 10px;
  justify-content: center;
}

.ab-btn {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: #fff;
  border: 2px solid #4a5060;
  font-size: 1.1em;
  font-weight: bold;
  color: #23273a;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px #0002;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  transition: background 0.2s, color 0.2s;
}

.ab-btn:active {
  background: #23273a;
  color: #fff;
}

#origin-marker {
  position: absolute;
  pointer-events: none;
}

/* Mode VR : visibilité UI, clics passent à la scène sauf sur les éléments interactifs */
body.vr-active #vr-ui-overlay {
  visibility: visible !important;
  display: block !important;
}
#vr-ui-overlay {
  visibility: visible;
  pointer-events: auto;
}
#phone-iframe-container, #tv-overlay {
  pointer-events: auto !important;
}
#phone-iframe, #tv-youtube-iframe {
  pointer-events: auto !important;
}
/* En VR / Cardboard : plein écran pour messages et vidéo */
body.vr-active #phone-iframe-container {
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  width: 100vw !important;
  height: 100vh !important;
  max-width: none !important;
  max-height: none !important;
  border-radius: 0 !important;
  transform: none !important;
}
body.vr-active #tv-overlay {
  width: 100vw !important;
  max-width: none !important;
  height: 100vh !important;
  border-radius: 0 !important;
}
body.vr-active #close-phone {
  min-height: 56px !important;
  min-width: 56px !important;
  font-size: 1.4em !important;
  top: 12px !important;
  right: 12px !important;
}
body.vr-active #phone-open-new-tab {
  min-height: 56px !important;
  font-size: 1.15em !important;
  padding: 16px !important;
}
/* Touch optimisé pour Cardboard */
#vr-ui-overlay, #phone-iframe-container, #tv-overlay {
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
/* WebXR DOM Overlay actif (visible dans le casque) */
#vr-ui-overlay:xr-overlay {
  visibility: visible !important;
  display: block !important;
  pointer-events: auto !important;
}

/* Message de bienvenue VR (onboarding) */
#vr-welcome-overlay {
  animation: vrWelcomeFadeIn 0.5s ease;
}
@keyframes vrWelcomeFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* Accessibilité : focus visible au clavier */
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 2px solid #00e5ff;
  outline-offset: 2px;
}
/* Aide clavier VR : plus lisible */
#vr-keyboard-help {
  font-size: 1em;
  line-height: 1.4;
}

@media (max-width: 600px) {
  #ui-panel {
    min-width: 90vw;
    left: 2vw;
    right: 2vw;
  }
  #joystick-container {
    left: 5vw;
  }
}
