@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;600;800&display=swap');

:root {
  --font-primary: 'Outfit', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --color-bg: rgba(10, 10, 12, 0.4);
  --color-border: rgba(255, 255, 255, 0.12);
  --color-accent-blue: #00f2fe;
  --color-accent-purple: #4facfe;
  --color-accent-red: #ff3366;
  --color-text-primary: #ffffff;
  --color-text-secondary: rgba(255, 255, 255, 0.7);
  --glow-shadow: 0 0 15px rgba(0, 242, 254, 0.4);
}

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

body {
  font-family: var(--font-primary);
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  position: relative;
  background-color: #000;
  color: var(--color-text-primary);
  user-select: none;
  -webkit-user-select: none;
}

/* Ocultar elementos innecesarios de A-Frame por defecto */
.a-enter-vr {
  display: none !important;
}

/* Interfaz Principal (HUD) */
#hud-container {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 10;
  pointer-events: none; /* Permite clicks a través de la UI para la escena AR */
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 24px;
}

/* Todo lo interactivo en el HUD debe reactivar los punteros */
.interactive {
  pointer-events: auto;
}

/* Panel Superior: Instrucciones e Indicador de Estado */
#top-panel {
  align-self: center;
  max-width: 90%;
  width: 420px;
  background: var(--color-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--color-border);
  border-radius: 20px;
  padding: 16px 24px;
  box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
  text-align: center;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  animation: slideDown 0.6s cubic-bezier(0.19, 1, 0.22, 1);
}

#status-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.08);
  padding: 6px 12px;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 8px;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.badge-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: var(--color-accent-red);
  animation: pulseRed 2s infinite;
}

.badge-dot.scanning {
  background-color: var(--color-accent-blue);
  animation: pulseBlue 1.5s infinite;
}

.badge-dot.ready {
  background-color: #00ff66;
  animation: pulseGreen 1.5s infinite;
  box-shadow: 0 0 10px #00ff66;
}

#instruction-text {
  font-size: 1rem;
  font-weight: 500;
  line-height: 1.4;
  color: var(--color-text-primary);
}

.language-selector {
  display: inline-flex;
  gap: 8px;
  margin-bottom: 12px;
  justify-content: center;
  flex-wrap: wrap;
}

.language-btn {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--color-text-secondary);
  font-family: var(--font-primary);
  font-weight: 600;
  font-size: 0.82rem;
  padding: 8px 12px;
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.2s ease;
  outline: none;
}

.language-btn.active {
  color: var(--color-text-primary);
  background: linear-gradient(135deg, var(--color-accent-purple), var(--color-accent-blue));
  box-shadow: var(--glow-shadow);
  border-color: rgba(255, 255, 255, 0.2);
}

.language-btn:hover {
  background: rgba(255, 255, 255, 0.1);
}

/* Panel Inferior: Controles de Selección y Reset */
#bottom-panel {
  align-self: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  margin-top: auto;
  margin-bottom: 16px;
  width: 100%;
  max-width: 480px;
  animation: slideUp 0.6s cubic-bezier(0.19, 1, 0.22, 1);
}

/* Selector de Formas (Cubo / Esfera) */
.shape-selector-container {
  background: var(--color-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--color-border);
  border-radius: 24px;
  padding: 6px;
  display: flex;
  gap: 4px;
  width: 100%;
  box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
  position: relative;
  overflow: hidden;
}

.shape-btn {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--color-text-secondary);
  font-family: var(--font-primary);
  font-size: 1rem;
  font-weight: 600;
  padding: 14px 20px;
  border-radius: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  outline: none;
}

.shape-btn svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
  transition: transform 0.3s ease;
}

.shape-btn.active {
  color: var(--color-text-primary);
  background: linear-gradient(135deg, var(--color-accent-purple), var(--color-accent-blue));
  box-shadow: var(--glow-shadow);
}

.shape-btn.active svg {
  transform: scale(1.15) rotate(5deg);
}

.shape-btn:hover:not(.active) {
  color: var(--color-text-primary);
  background: rgba(255, 255, 255, 0.05);
}

/* Botones de Control adicionales (Reset) */
.controls-row {
  display: flex;
  gap: 12px;
  width: 100%;
}

.control-btn {
  flex: 1;
  background: var(--color-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--color-border);
  color: var(--color-text-primary);
  font-family: var(--font-primary);
  font-weight: 500;
  font-size: 0.9rem;
  padding: 12px 18px;
  border-radius: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
}

.control-btn svg {
  width: 16px;
  height: 16px;
  fill: currentColor;
}

.control-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.2);
  transform: translateY(-2px);
}

.control-btn:active {
  transform: translateY(0);
}

.control-btn.btn-danger {
  color: #ff4a7d;
  border-color: rgba(255, 74, 125, 0.2);
}

.control-btn.btn-danger:hover {
  background: rgba(255, 74, 125, 0.08);
  border-color: rgba(255, 74, 125, 0.4);
}

/* Animaciones */
@keyframes slideDown {
  from {
    transform: translateY(-30px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

@keyframes slideUp {
  from {
    transform: translateY(30px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

@keyframes pulseRed {
  0% { box-shadow: 0 0 0 0 rgba(255, 51, 102, 0.7); }
  70% { box-shadow: 0 0 0 10px rgba(255, 51, 102, 0); }
  100% { box-shadow: 0 0 0 0 rgba(255, 51, 102, 0); }
}

@keyframes pulseBlue {
  0% { box-shadow: 0 0 0 0 rgba(0, 242, 254, 0.7); }
  70% { box-shadow: 0 0 0 10px rgba(0, 242, 254, 0); }
  100% { box-shadow: 0 0 0 0 rgba(0, 242, 254, 0); }
}

@keyframes pulseGreen {
  0% { box-shadow: 0 0 0 0 rgba(0, 255, 102, 0.7); }
  70% { box-shadow: 0 0 0 10px rgba(0, 255, 102, 0); }
  100% { box-shadow: 0 0 0 0 rgba(0, 255, 102, 0); }
}

/* Ajustes responsivos para visores VR u pantallas pequeñas */
@media (max-width: 480px) {
  #hud-container {
    padding: 16px;
  }
  #top-panel {
    padding: 12px 16px;
  }
  #instruction-text {
    font-size: 0.9rem;
  }
  .shape-btn {
    padding: 12px 14px;
    font-size: 0.9rem;
  }
}
