/* ==========================================================================
   Healdeal VR Portal - Main Stylesheet
   Futuristic Glassmorphic HUD, Curved Theater Screen & Quest 3 Optimization
   ========================================================================== */

:root {
  --vr-bg: #030712;
  --vr-primary: #00d2ff;
  --vr-primary-glow: rgba(0, 210, 255, 0.4);
  --vr-secondary: #ec4899;
  --vr-card-bg: rgba(15, 23, 42, 0.75);
  --vr-border: rgba(255, 255, 255, 0.12);
  --vr-text: #f8fafc;
  --vr-text-muted: #94a3b8;
  --font-main: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-font-smoothing: antialiased;
}

body {
  font-family: var(--font-main);
  background-color: var(--vr-bg);
  color: var(--vr-text);
  overflow: hidden;
  height: 100vh;
  width: 100vw;
  user-select: none;
}

#canvasContainer {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
}

/* ==========================================================================
   2D HUD OVERLAY (Visible on Desktop / Quest Browser 2D window)
   ========================================================================== */
#hudOverlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 10;
  pointer-events: none; /* Let clicks pass through to 3D canvas by default */
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 1.25rem;
}

/* When WebXR is active in headset, hide 2D HUD to free resources */
body.xr-active #hudOverlay {
  display: none !important;
}

.hud-interactive {
  pointer-events: auto;
}

/* Top Navigation Bar */
.hud-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  background: rgba(10, 15, 30, 0.75);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--vr-border);
  border-radius: 1.25rem;
  padding: 0.75rem 1.25rem;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5), inset 0 1px 1px rgba(255, 255, 255, 0.1);
}

.hud-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
  color: inherit;
}

.brand-icon {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 0.75rem;
  background: linear-gradient(135deg, #00d2ff, #3b82f6);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  color: #fff;
  box-shadow: 0 0 15px var(--vr-primary-glow);
}

.brand-info h1 {
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  background: linear-gradient(to right, #fff, #93c5fd);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.brand-info p {
  font-size: 0.75rem;
  color: var(--vr-text-muted);
}

/* Search bar */
.hud-search {
  position: relative;
  max-width: 280px;
  width: 100%;
}

.hud-search input {
  width: 100%;
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid var(--vr-border);
  border-radius: 0.75rem;
  padding: 0.5rem 1rem 0.5rem 2.25rem;
  color: #fff;
  font-size: 0.85rem;
  outline: none;
  transition: all 0.2s ease;
}

.hud-search input:focus {
  border-color: var(--vr-primary);
  box-shadow: 0 0 12px var(--vr-primary-glow);
}

.hud-search i {
  position: absolute;
  left: 0.85rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--vr-text-muted);
  font-size: 0.8rem;
}

/* Action Controls (Sound, Env, VR, Admin) */
.hud-actions {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.hud-btn {
  background: rgba(30, 41, 59, 0.7);
  border: 1px solid var(--vr-border);
  color: #e2e8f0;
  padding: 0.55rem 0.95rem;
  border-radius: 0.75rem;
  font-size: 0.85rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
}

.hud-btn:hover, .hud-btn.active {
  background: rgba(51, 65, 85, 0.8);
  border-color: var(--vr-primary);
  color: #fff;
  box-shadow: 0 0 15px var(--vr-primary-glow);
}

.hud-btn.active {
  background: rgba(0, 210, 255, 0.25);
  border-color: var(--vr-primary);
  color: #00d2ff;
}

/* Passthrough Indicator & Desktop Backing */
.passthrough-indicator {
  position: absolute;
  top: 5.5rem;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(15, 23, 42, 0.85);
  border: 1px solid var(--vr-primary);
  box-shadow: 0 0 25px var(--vr-primary-glow);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  padding: 0.6rem 1.25rem;
  border-radius: 2rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  z-index: 20;
  animation: pulseGlow 2.5s infinite ease-in-out;
  pointer-events: none;
}

.passthrough-indicator.hidden {
  display: none !important;
}

body.passthrough-mode #canvasContainer {
  background: radial-gradient(circle at center, rgba(30, 41, 59, 0.5) 0%, rgba(3, 7, 18, 0.95) 100%);
}

@keyframes pulseGlow {
  0%, 100% { box-shadow: 0 0 15px var(--vr-primary-glow); }
  50% { box-shadow: 0 0 30px rgba(0, 210, 255, 0.7); }
}

.hud-btn.primary {
  background: linear-gradient(135deg, #00d2ff, #0284c7);
  border: none;
  color: #030712;
  font-weight: 700;
  box-shadow: 0 0 20px rgba(0, 210, 255, 0.45);
}

.hud-btn.primary:hover {
  transform: scale(1.03);
  box-shadow: 0 0 30px rgba(0, 210, 255, 0.7);
}

/* Category Filter Bar */
.hud-categories {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  margin-top: 0.75rem;
  flex-wrap: wrap;
}

.cat-pill {
  background: rgba(15, 23, 42, 0.7);
  border: 1px solid var(--vr-border);
  color: var(--vr-text-muted);
  padding: 0.4rem 0.85rem;
  border-radius: 2rem;
  font-size: 0.8rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.cat-pill:hover, .cat-pill.active {
  background: rgba(0, 210, 255, 0.15);
  border-color: var(--vr-primary);
  color: #fff;
  box-shadow: 0 0 12px var(--vr-primary-glow);
}

/* Bottom Bar - Environment & Audio Quick Switcher */
.hud-footer {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
}

.quick-panel {
  background: rgba(10, 15, 30, 0.75);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--vr-border);
  border-radius: 1.25rem;
  padding: 0.75rem 1rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

.env-chips, .snd-chips {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  overflow-x: auto;
  max-width: 480px;
}

.chip-btn {
  background: rgba(30, 41, 59, 0.6);
  border: 1px solid var(--vr-border);
  color: var(--vr-text-muted);
  padding: 0.35rem 0.75rem;
  border-radius: 0.6rem;
  font-size: 0.75rem;
  white-space: nowrap;
  cursor: pointer;
  transition: all 0.2s ease;
}

.chip-btn:hover, .chip-btn.active {
  background: var(--vr-primary);
  color: #030712;
  font-weight: 600;
  box-shadow: 0 0 10px var(--vr-primary-glow);
}

/* Sound volume slider container */
.vol-widget {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--vr-text-muted);
  font-size: 0.8rem;
}

.vol-slider {
  width: 70px;
  accent-color: var(--vr-primary);
  cursor: pointer;
}

/* ==========================================================================
   VIRTUAL THEATER SCREEN MODAL
   ========================================================================== */
#theaterModal {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(2, 6, 23, 0.85);
  backdrop-filter: blur(15px);
  -webkit-backdrop-filter: blur(15px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  animation: fadeIn 0.25s ease forwards;
}

#theaterModal.hidden {
  display: none !important;
}

.theater-window {
  width: 90vw;
  max-width: 1400px;
  height: 82vh;
  background: #090d16;
  border: 2px solid var(--vr-primary);
  border-radius: 1.5rem;
  box-shadow: 0 0 50px rgba(0, 210, 255, 0.3), 0 25px 60px rgba(0, 0, 0, 0.8);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
}

/* Curved screen illusion top and bottom edges */
.theater-header {
  height: 3.5rem;
  background: rgba(15, 23, 42, 0.95);
  border-bottom: 1px solid var(--vr-border);
  padding: 0 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  shrink: 0;
}

.theater-info {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.theater-badge {
  background: var(--vr-primary);
  color: #030712;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 0.2rem 0.5rem;
  border-radius: 0.4rem;
  text-transform: uppercase;
}

.theater-title {
  font-size: 1.1rem;
  font-weight: 600;
  color: #fff;
}

.theater-controls {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.theater-btn {
  background: rgba(30, 41, 59, 0.8);
  border: 1px solid var(--vr-border);
  color: #e2e8f0;
  width: 2.2rem;
  height: 2.2rem;
  border-radius: 0.6rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 0.9rem;
}

.theater-btn:hover {
  background: var(--vr-primary);
  color: #030712;
  box-shadow: 0 0 12px var(--vr-primary-glow);
}

.theater-btn.close-btn:hover {
  background: #ef4444;
  color: #fff;
  border-color: #ef4444;
  box-shadow: 0 0 15px rgba(239, 68, 68, 0.5);
}

.theater-body {
  flex: 1;
  width: 100%;
  height: 100%;
  position: relative;
  background: #000;
}

.theater-body iframe {
  width: 100%;
  height: 100%;
  border: none;
}

/* ==========================================================================
   ANIMATIONS & HELPERS
   ========================================================================== */
@keyframes fadeIn {
  from { opacity: 0; transform: scale(0.97); }
  to { opacity: 1; transform: scale(1); }
}

@media (max-width: 768px) {
  .hud-search {
    display: none;
  }
  .hud-categories {
    display: none;
  }
  .quick-panel {
    max-width: 100%;
  }
  .theater-window {
    width: 96vw;
    height: 90vh;
  }
}
