/* ========================================
   Dalton — Simulador de Daltonismo AR
   Styles — Quest 3 + Flat Mode
   ======================================== */

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

/* ---------- Reset & Variables ---------- */
:root {
  --bg-dark: #07070c;
  --bg-glass: rgba(12, 12, 20, 0.72);
  --bg-glass-hover: rgba(30, 30, 50, 0.8);
  --bg-item-hover: rgba(255, 255, 255, 0.06);
  --bg-item-active: rgba(99, 102, 241, 0.14);
  --border-glass: rgba(255, 255, 255, 0.08);
  --border-active: rgba(99, 102, 241, 0.45);
  --text-primary: #f0f0f5;
  --text-secondary: rgba(240, 240, 245, 0.6);
  --text-muted: rgba(240, 240, 245, 0.35);
  --accent-blue: #6366f1;
  --accent-purple: #a855f7;
  --accent-pink: #ec4899;
  --accent-gradient: linear-gradient(135deg, #6366f1, #a855f7, #ec4899);
  --shadow-glow: 0 0 30px rgba(99, 102, 241, 0.12);
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-xl: 28px;
  --transition-fast: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-smooth: 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

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

html,
body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg-dark);
  color: var(--text-primary);
  -webkit-font-smoothing: antialiased;
}

.hidden {
  display: none !important;
}

/* ---------- Camera Canvas / Video ---------- */
#camera-canvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: 1;
}

#camera-video {
  display: none;
}

/* =============================================
   LANDING SCREEN
   ============================================= */
.landing-screen {
  position: fixed;
  inset: 0;
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-dark);
  background-image:
    radial-gradient(ellipse at 20% 50%, rgba(99, 102, 241, 0.08) 0%, transparent 60%),
    radial-gradient(ellipse at 80% 50%, rgba(168, 85, 247, 0.06) 0%, transparent 60%);
}

.landing-screen.hidden {
  display: none;
}

.landing-content {
  text-align: center;
  max-width: 440px;
  padding: 2rem;
}

.landing-logo {
  font-size: 4rem;
  font-weight: 900;
  letter-spacing: -0.03em;
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 0.5rem;
  line-height: 1.1;
}

.landing-subtitle {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 1.5rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.landing-desc {
  font-size: 0.95rem;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 2.5rem;
}

.landing-actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: center;
}

/* --- VR Button --- */
.btn-vr {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 16px 36px;
  font-family: inherit;
  font-size: 1.05rem;
  font-weight: 700;
  color: #fff;
  background: var(--accent-gradient);
  border: none;
  border-radius: 100px;
  cursor: pointer;
  box-shadow:
    0 0 40px rgba(99, 102, 241, 0.3),
    0 4px 20px rgba(0, 0, 0, 0.3);
  transition: all var(--transition-fast);
  position: relative;
  overflow: hidden;
}

.btn-vr::before {
  content: '';
  position: absolute;
  inset: -2px;
  border-radius: inherit;
  background: var(--accent-gradient);
  filter: blur(12px);
  opacity: 0.4;
  z-index: -1;
  animation: pulse-glow 2.5s ease-in-out infinite;
}

.btn-vr:hover {
  transform: translateY(-2px) scale(1.03);
  box-shadow:
    0 0 60px rgba(99, 102, 241, 0.4),
    0 8px 30px rgba(0, 0, 0, 0.4);
}

@keyframes pulse-glow {

  0%,
  100% {
    opacity: 0.3;
  }

  50% {
    opacity: 0.6;
  }
}

/* --- Camera Button --- */
.btn-camera {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 28px;
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-secondary);
  background: transparent;
  border: 1px solid var(--border-glass);
  border-radius: 100px;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.btn-camera:hover {
  color: var(--text-primary);
  border-color: rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.04);
}

.landing-hint {
  margin-top: 1.5rem;
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* =============================================
   ERROR SCREEN
   ============================================= */
.error-screen {
  position: fixed;
  inset: 0;
  z-index: 999;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: var(--bg-dark);
  padding: 2rem;
  text-align: center;
}

.error-screen.visible {
  display: flex;
}

.error-icon {
  font-size: 4rem;
  margin-bottom: 1.5rem;
}

.error-title {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 0.75rem;
}

.error-message {
  font-size: 0.95rem;
  color: var(--text-secondary);
  max-width: 400px;
  line-height: 1.6;
}

/* =============================================
   LOADING OVERLAY
   ============================================= */
.loading-overlay {
  position: fixed;
  inset: 0;
  z-index: 600;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: var(--bg-dark);
  transition: opacity 0.5s ease;
}

.loading-overlay.fade-out {
  opacity: 0;
  pointer-events: none;
}

.loading-spinner {
  width: 36px;
  height: 36px;
  border: 3px solid var(--border-glass);
  border-top-color: var(--accent-blue);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin-bottom: 1rem;
}

.loading-text {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

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

/* =============================================
   OVERLAY (DOM Overlay in VR / normal overlay in flat)
   ============================================= */
.overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  pointer-events: none;
}

.overlay>* {
  pointer-events: auto;
}

/* ---------- Top Badge ---------- */
.current-mode-badge {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 100;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 16px;
  background: var(--bg-glass);
  backdrop-filter: blur(20px) saturate(1.3);
  -webkit-backdrop-filter: blur(20px) saturate(1.3);
  border: 1px solid var(--border-glass);
  border-radius: 100px;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.015em;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35);
  pointer-events: none;
}

.badge-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #22c55e;
  animation: pulse-dot 2s ease-in-out infinite;
}

@keyframes pulse-dot {

  0%,
  100% {
    opacity: 1;
    transform: scale(1);
  }

  50% {
    opacity: 0.5;
    transform: scale(0.75);
  }
}

/* ---------- Info Tooltip ---------- */
.info-tooltip {
  position: fixed;
  top: 64px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 100;
  max-width: min(88vw, 420px);
  padding: 10px 16px;
  background: var(--bg-glass);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  font-size: 0.75rem;
  color: var(--text-secondary);
  line-height: 1.5;
  text-align: center;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition-smooth);
  pointer-events: none;
}

.info-tooltip.visible {
  opacity: 1;
  visibility: visible;
}

/* =============================================
   COLLAPSIBLE MENU
   ============================================= */

.menu-backdrop {
  position: fixed;
  inset: 0;
  z-index: 90;
  background: rgba(0, 0, 0, 0.35);
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition-smooth);
}

.menu-backdrop.open {
  opacity: 1;
  visibility: visible;
}

/* --- Trigger button --- */
.menu-trigger {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 110;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 24px;
  background: var(--bg-glass);
  backdrop-filter: blur(24px) saturate(1.4);
  -webkit-backdrop-filter: blur(24px) saturate(1.4);
  border: 1px solid var(--border-glass);
  border-radius: 100px;
  cursor: pointer;
  box-shadow: var(--shadow-glow), 0 6px 24px rgba(0, 0, 0, 0.45);
  transition: all var(--transition-fast);
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  font-family: inherit;
  color: var(--text-primary);
}

.menu-trigger:hover {
  border-color: rgba(255, 255, 255, 0.15);
  transform: translateX(-50%) translateY(-2px);
}

.menu-trigger.open {
  border-color: var(--border-active);
}

.trigger-icon {
  font-size: 1.15rem;
  line-height: 1;
}

.trigger-text {
  font-size: 0.85rem;
  font-weight: 600;
  white-space: nowrap;
}

.trigger-chevron {
  font-size: 0.7rem;
  color: var(--text-secondary);
  transition: transform var(--transition-smooth);
  margin-left: 2px;
}

.menu-trigger.open .trigger-chevron {
  transform: rotate(180deg);
}

/* --- Dropdown --- */
.menu-dropdown {
  position: fixed;
  bottom: 90px;
  left: 50%;
  transform: translateX(-50%) translateY(12px);
  z-index: 105;
  width: min(92vw, 380px);
  background: var(--bg-glass);
  backdrop-filter: blur(28px) saturate(1.4);
  -webkit-backdrop-filter: blur(28px) saturate(1.4);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-lg);
  padding: 8px;
  box-shadow: var(--shadow-glow), 0 12px 48px rgba(0, 0, 0, 0.55);
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition-smooth);
  pointer-events: none;
  max-height: 70vh;
  overflow-y: auto;
}

.menu-dropdown.open {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
  pointer-events: auto;
}

.menu-section-title {
  padding: 8px 12px 6px;
  font-size: 0.62rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}

/* --- Menu items --- */
.menu-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition-fast);
  -webkit-tap-highlight-color: transparent;
}

.menu-item:hover {
  background: var(--bg-item-hover);
}

.menu-item.active {
  background: var(--bg-item-active);
}

.menu-item.active .item-dot {
  box-shadow: 0 0 8px currentColor;
  transform: scale(1.15);
}

.menu-item.active .item-name {
  color: var(--text-primary);
}

.item-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  flex-shrink: 0;
  transition: all var(--transition-fast);
}

.menu-item[data-type="normal"] .item-dot {
  background: linear-gradient(135deg, #22c55e, #3b82f6, #ef4444);
}

.menu-item[data-type="protanopia"] .item-dot {
  background: linear-gradient(135deg, #b5a642, #4a72a0);
}

.menu-item[data-type="deuteranopia"] .item-dot {
  background: linear-gradient(135deg, #c4a747, #4a72a0);
}

.menu-item[data-type="tritanopia"] .item-dot {
  background: linear-gradient(135deg, #cc5555, #55a088);
}

.menu-item[data-type="protanomaly"] .item-dot {
  background: linear-gradient(135deg, #c07050, #5580b0);
}

.menu-item[data-type="deuteranomaly"] .item-dot {
  background: linear-gradient(135deg, #b89050, #5580b0);
}

.menu-item[data-type="tritanomaly"] .item-dot {
  background: linear-gradient(135deg, #c06060, #5090a0);
}

.menu-item[data-type="achromatopsia"] .item-dot {
  background: linear-gradient(135deg, #aaa, #555);
}

.item-name {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-secondary);
  transition: color var(--transition-fast);
}

.item-check {
  margin-left: auto;
  font-size: 0.8rem;
  opacity: 0;
  transition: opacity var(--transition-fast);
}

.menu-item.active .item-check {
  opacity: 1;
}

.menu-divider {
  height: 1px;
  background: var(--border-glass);
  margin: 4px 8px;
}

/* --- Severity slider --- */
.severity-section {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  margin-top: 2px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.02);
  transition: all var(--transition-smooth);
  overflow: hidden;
  max-height: 60px;
  opacity: 1;
}

.severity-section.hidden {
  max-height: 0;
  padding: 0 14px;
  margin-top: 0;
  opacity: 0;
  pointer-events: none;
}

.severity-label {
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  white-space: nowrap;
}

.severity-slider {
  -webkit-appearance: none;
  appearance: none;
  flex: 1;
  height: 3px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.1);
  outline: none;
  cursor: pointer;
}

.severity-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--accent-gradient);
  cursor: pointer;
  box-shadow: 0 0 8px rgba(99, 102, 241, 0.4);
}

.severity-slider::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--accent-blue);
  cursor: pointer;
  border: none;
}

.severity-value {
  font-size: 0.8rem;
  font-weight: 700;
  min-width: 34px;
  text-align: right;
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* --- Exit VR button --- */
.btn-exit-vr {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 120;
  padding: 8px 16px;
  font-family: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-secondary);
  background: var(--bg-glass);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-glass);
  border-radius: 100px;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.btn-exit-vr:hover {
  color: var(--text-primary);
  border-color: rgba(255, 255, 255, 0.2);
}

/* =============================================
   RESPONSIVE
   ============================================= */
@media (max-width: 420px) {
  .landing-logo {
    font-size: 3rem;
  }

  .landing-desc {
    font-size: 0.85rem;
  }

  .menu-dropdown {
    width: 94vw;
    bottom: 82px;
  }

  .menu-trigger {
    bottom: 20px;
    padding: 12px 20px;
  }

  .menu-item {
    padding: 10px 12px;
  }

  .current-mode-badge {
    top: 12px;
    font-size: 0.7rem;
  }
}