/* VR-Optimized Base Styles */
html, body {
  height: 100%;
  margin: 0;
  background: linear-gradient(135deg, #0a0e27 0%, #1e3c72 50%, #2a5298 100%);
  overflow: hidden;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  font-size: 18px; /* Larger base font for VR readability */
  user-select: none; /* Prevent text selection in VR */
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

#app {
  height: 100%;
}

/* VR-Optimized Step List */
.list-group-item {
  font-size: 0.95rem !important;
  padding: 1rem 1.2rem !important;
  border: 2px solid transparent !important;
  margin-bottom: 0.5rem !important;
  border-radius: 12px !important;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
  cursor: pointer;
  backdrop-filter: blur(10px);
  min-height: auto !important;
  display: flex !important;
  align-items: center !important;
  word-wrap: break-word !important;
  word-break: break-word !important;
  white-space: normal !important;
  overflow-wrap: break-word !important;
  line-height: 1.4 !important;
  max-width: 100% !important;
}

.list-group-item:hover {
  transform: translateX(8px) scale(1.02) !important;
  box-shadow: 0 8px 25px rgba(0, 123, 255, 0.4) !important;
  border-color: #007bff !important;
}

.list-group-item.completed {
  background: linear-gradient(135deg, #28a745 0%, #20c997 100%) !important;
  color: #fff !important;
  box-shadow: 0 4px 15px rgba(40, 167, 69, 0.4) !important;
  border-color: #28a745 !important;
}

.list-group-item.completed::before {
  content: "✓ ";
  font-weight: bold;
  font-size: 1.2em;
  margin-right: 0.5rem;
}

.list-group-item.active {
  background: linear-gradient(135deg, #007bff 0%, #0056b3 100%) !important;
  color: #fff !important;
  box-shadow: 0 6px 20px rgba(0, 123, 255, 0.6) !important;
  border-color: #007bff !important;
  transform: translateX(12px) scale(1.05) !important;
}

.list-group-item.active::before {
  content: "▶ ";
  font-weight: bold;
  font-size: 1.2em;
  margin-right: 0.5rem;
  animation: pulse 2s infinite;
}

.phase-header {
  background: linear-gradient(135deg, #495057 0%, #343a40 100%) !important;
  color: #f8f9fa !important;
  font-weight: 600 !important;
  font-size: 1rem !important;
  cursor: pointer;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  box-shadow: 0 4px 15px rgba(52, 58, 64, 0.3) !important;
  word-wrap: break-word !important;
  word-break: break-word !important;
  white-space: normal !important;
  overflow-wrap: break-word !important;
  line-height: 1.3 !important;
  padding: 1rem 1.2rem !important;
}

.phase-header:hover {
  background: linear-gradient(135deg, #6c757d 0%, #495057 100%) !important;
  transform: translateX(6px) scale(1.01) !important;
}

/* VR-Optimized Video Container */
.video-container {
  position: relative;
  height: 100%;
  background: radial-gradient(ellipse at center, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
  border-radius: 0 20px 20px 0;
  overflow: hidden;
  box-shadow: inset 0 0 50px rgba(0, 123, 255, 0.1);
}

video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: 0 20px 20px 0;
  filter: contrast(1.1) saturate(1.1);
}

/* VR-Optimized Step Banner */
#stepBanner {
  position: absolute;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 11;
  background: linear-gradient(135deg, rgba(0, 123, 255, 0.9) 0%, rgba(0, 86, 179, 0.9) 100%);
  backdrop-filter: blur(15px);
  padding: 1rem 2rem;
  border-radius: 25px;
  font-size: 1.4rem;
  font-weight: 600;
  color: #fff;
  white-space: normal;
  max-width: 90%;
  word-wrap: break-word;
  word-break: break-word;
  overflow-wrap: break-word;
  text-align: center;
  line-height: 1.3;
  border: 2px solid rgba(255, 255, 255, 0.2);
  box-shadow: 0 8px 32px rgba(0, 123, 255, 0.3);
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
  animation: bannerGlow 3s ease-in-out infinite alternate;
}

/* VR-Optimized Countdown */
#countdownOverlay {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 12;
  font-size: 15vw;
  font-weight: 900;
  color: #fff;
  text-shadow: 0 0 30px rgba(0, 123, 255, 0.8), 0 0 60px rgba(0, 123, 255, 0.6);
  display: none;
  animation: countdownPulse 1s ease-in-out infinite;
  font-family: 'Arial Black', sans-serif;
}

/* VR-Optimized Modal Overlays */
.modal-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(0, 0, 0, 0.8) 0%, rgba(26, 26, 46, 0.9) 100%);
  backdrop-filter: blur(20px);
  z-index: 12;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 2rem;
}

.modal-overlay pre {
  color: #fff;
  font-size: 1.6rem;
  font-weight: 500;
  line-height: 1.6;
  white-space: pre-wrap;
  text-align: center;
  border: 3px solid rgba(0, 123, 255, 0.5);
  background: linear-gradient(135deg, rgba(0, 123, 255, 0.1) 0%, rgba(0, 86, 179, 0.1) 100%);
  backdrop-filter: blur(10px);
  padding: 2rem;
  border-radius: 20px;
  max-height: 70%;
  overflow: auto;
  width: 100%;
  max-width: 800px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
}

/* VR-Optimized Debug and System Elements */
#debugOverlay {
  position: absolute;
  bottom: 20px;
  left: 20px;
  z-index: 13;
  background: linear-gradient(135deg, rgba(0, 255, 255, 0.1) 0%, rgba(0, 200, 255, 0.1) 100%);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(0, 255, 255, 0.3);
  color: #00ffff;
  font-size: 0.9rem;
  font-family: 'Courier New', monospace;
  padding: 0.5rem 1rem;
  border-radius: 10px;
  white-space: pre-line;
  display: none;
  pointer-events: none;
  box-shadow: 0 4px 15px rgba(0, 255, 255, 0.2);
}

/* VR-Optimized Main Menu */
.center-overlay {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #0a0e27 0%, #1e3c72 50%, #2a5298 100%);
  z-index: 9999;
}

/* VR-Optimized Experience Cards */
.experience-card {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.95) 0%, rgba(245, 247, 250, 0.95) 100%);
  backdrop-filter: blur(15px);
  border: 3px solid transparent;
  border-radius: 20px;
  padding: 2rem;
  margin: 1rem;
  min-width: 380px;
  max-width: 450px;
  min-height: 200px;
  cursor: pointer;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
  position: relative;
  overflow: hidden;
}

.experience-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(0, 123, 255, 0.1), transparent);
  transition: left 0.5s;
}

.experience-card:hover::before {
  left: 100%;
}

.experience-card:hover {
  transform: translateY(-8px) scale(1.03);
  box-shadow: 0 20px 60px rgba(0, 123, 255, 0.3);
  border-color: rgba(0, 123, 255, 0.5);
}

.experience-card.selected {
  border-color: #007bff;
  background: linear-gradient(135deg, #e7f3ff 0%, #cce7ff 100%);
  transform: translateY(-8px) scale(1.05);
  box-shadow: 0 25px 70px rgba(0, 123, 255, 0.4);
}

.experience-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(380px, 1fr));
  gap: 2rem;
  max-width: 1400px;
  width: 100%;
  padding: 3rem;
}

.experience-title {
  font-size: 1.8rem;
  font-weight: 700;
  color: #1a365d;
  margin-bottom: 0.8rem;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.experience-description {
  color: #4a5568;
  font-size: 1.1rem;
  line-height: 1.5;
  margin-bottom: 1.5rem;
}

.experience-meta {
  font-size: 1rem;
  color: #718096;
  font-weight: 500;
}

/* VR-Optimized Buttons */
.btn {
  font-size: 1rem !important;
  padding: 0.8rem 1.5rem !important;
  border-radius: 12px !important;
  font-weight: 500 !important;
  min-height: 50px !important;
  min-width: 100px !important;
  border: 2px solid transparent !important;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
  text-transform: none;
  letter-spacing: 0.2px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15) !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
}

.btn:hover {
  transform: translateY(-3px) scale(1.02) !important;
  box-shadow: 0 12px 35px rgba(0, 0, 0, 0.25) !important;
}

.btn:active {
  transform: translateY(-1px) scale(0.98) !important;
}

.btn-primary {
  background: linear-gradient(135deg, #007bff 0%, #0056b3 100%) !important;
  border-color: #007bff !important;
}

.btn-primary:hover {
  background: linear-gradient(135deg, #0056b3 0%, #004085 100%) !important;
  box-shadow: 0 12px 35px rgba(0, 123, 255, 0.4) !important;
}

.btn-success {
  background: linear-gradient(135deg, #28a745 0%, #1e7e34 100%) !important;
  border-color: #28a745 !important;
}

.btn-success:hover {
  background: linear-gradient(135deg, #1e7e34 0%, #155724 100%) !important;
  box-shadow: 0 12px 35px rgba(40, 167, 69, 0.4) !important;
}

.btn-secondary {
  background: linear-gradient(135deg, #6c757d 0%, #495057 100%) !important;
  border-color: #6c757d !important;
  font-size: 0.9rem !important;
  padding: 0.6rem 1.2rem !important;
  min-height: 40px !important;
}

.btn-secondary:hover {
  background: linear-gradient(135deg, #495057 0%, #343a40 100%) !important;
  box-shadow: 0 8px 25px rgba(108, 117, 125, 0.4) !important;
}

/* Small buttons for sidebar and compact areas */
.btn-sm {
  font-size: 0.8rem !important;
  padding: 0.4rem 0.8rem !important;
  min-height: 32px !important;
  min-width: 60px !important;
}

/* Button group adjustments for better text fit */
.btn-group .btn,
.btn-group-vertical .btn {
  font-size: 0.85rem !important;
  padding: 0.5rem 1rem !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
}

/* VR-Optimized Change Experience Button */
#changeExpBtn {
  position: absolute !important;
  top: 20px !important;
  left: 20px !important;
  z-index: 10 !important;
  backdrop-filter: blur(10px) !important;
  background: linear-gradient(135deg, rgba(108, 117, 125, 0.9) 0%, rgba(73, 80, 87, 0.9) 100%) !important;
  border: 2px solid rgba(255, 255, 255, 0.2) !important;
  border-radius: 12px !important;
  padding: 0.75rem 1.25rem !important;
  font-size: 1rem !important;
  min-height: 50px !important;
}

#changeExpBtn:hover {
  transform: translateY(-2px) scale(1.05) !important;
  background: linear-gradient(135deg, rgba(73, 80, 87, 0.9) 0%, rgba(52, 58, 64, 0.9) 100%) !important;
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3) !important;
}

/* VR-Optimized Continue Button */
#subContinue {
  font-size: 1.4rem !important;
  padding: 1.5rem 3rem !important;
  min-height: 80px !important;
  border-radius: 20px !important;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

/* VR-Optimized Sidebar */
.col-3.col-md-3.col-lg-2 {
  background: linear-gradient(180deg, #212529 0%, #343a40 50%, #495057 100%) !important;
  border-radius: 20px 0 0 20px;
  backdrop-filter: blur(20px);
  box-shadow: inset 0 0 50px rgba(0, 0, 0, 0.2);
  padding: 1rem !important;
  height: 100vh !important;
  max-height: 100vh !important;
  overflow: hidden !important;
  position: fixed !important;
  left: 0 !important;
  top: 0 !important;
  z-index: 10 !important;
  display: flex !important;
  flex-direction: column !important;
  width: 480px !important;
}

/* Adjust main content to account for fixed sidebar */
.col-9.col-md-9.col-lg-10 {
  margin-left: 480px !important;
  width: calc(100% - 480px) !important;
  height: 100vh !important;
  max-height: 100vh !important;
  overflow: hidden !important;
}

/* Header area in sidebar */
.col-3.col-md-3.col-lg-2 > .d-flex {
  flex-shrink: 0 !important;
  margin-bottom: 1rem !important;
}

/* Progress indicator in sidebar */
.col-3.col-md-3.col-lg-2 > .mt-4 {
  flex-shrink: 0 !important;
  margin-top: 1rem !important;
}

/* Ensure step list takes remaining height and is scrollable */
#stepList {
  flex: 1 !important;
  overflow-y: auto !important;
  overflow-x: hidden !important;
  margin: 0 !important;
  padding-right: 0.5rem !important;
}

/* Custom scrollbar for step list */
#stepList::-webkit-scrollbar {
  width: 8px;
}

#stepList::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
  margin: 4px;
}

#stepList::-webkit-scrollbar-thumb {
  background: rgba(0, 123, 255, 0.6);
  border-radius: 4px;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

#stepList::-webkit-scrollbar-thumb:hover {
  background: rgba(0, 123, 255, 0.8);
}

/* Animations */
@keyframes pulse {
  0% { opacity: 1; }
  50% { opacity: 0.7; }
  100% { opacity: 1; }
}

@keyframes bannerGlow {
  0% { box-shadow: 0 8px 32px rgba(0, 123, 255, 0.3); }
  100% { box-shadow: 0 8px 32px rgba(0, 123, 255, 0.6); }
}

@keyframes countdownPulse {
  0% { transform: translate(-50%, -50%) scale(1); }
  50% { transform: translate(-50%, -50%) scale(1.1); }
  100% { transform: translate(-50%, -50%) scale(1); }
}

/* VR-Specific Responsive Design */
@media (max-width: 1200px) {
  .experience-grid {
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 1.5rem;
    padding: 2rem;
  }
  
  .experience-card {
    min-width: 350px;
    max-width: 400px;
  }
}

@media (orientation: landscape) and (max-height: 800px) {
  .experience-grid {
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    max-height: 60vh;
    overflow-y: auto;
  }
  
  .center-overlay h1 {
    font-size: 2rem;
    margin-bottom: 1rem;
  }
}

/* VR Hand Tracking Optimization */
.btn, .list-group-item, .experience-card {
  touch-action: manipulation;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  -khtml-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
}

/* VR-Optimized Typography */
h1, h2, h3, h4, h5, h6 {
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
  font-weight: 600;
}

.text-white, .text-light {
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
}

/* High Contrast Mode for VR */
.list-group-item, .btn, .experience-card {
  filter: contrast(1.1);
}

/* VR-Optimized Focus States */
.btn:focus, .list-group-item:focus, .experience-card:focus {
  outline: 3px solid rgba(0, 123, 255, 0.6) !important;
  outline-offset: 2px !important;
  box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.3) !important;
}

/* VR-Optimized Loading Overlay */
.center-overlay .spinner-border {
  width: 4rem;
  height: 4rem;
  border-width: 0.5rem;
  filter: drop-shadow(0 0 20px rgba(0, 123, 255, 0.6));
}

#loadingText {
  font-size: 1.4rem;
  font-weight: 600;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
  animation: textPulse 2s ease-in-out infinite;
}

/* VR-Optimized Progress Bar */
.progress {
  background: rgba(0, 0, 0, 0.6) !important;
  backdrop-filter: blur(5px);
  border: 2px solid rgba(255, 255, 255, 0.3) !important;
  border-radius: 6px !important;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.3) !important;
}

.progress-bar {
  transition: width 0.6s ease-in-out;
  box-shadow: 0 0 15px rgba(0, 123, 255, 0.5);
  background: linear-gradient(135deg, #007bff 0%, #28a745 100%) !important;
  border-radius: 4px !important;
  position: relative;
}

.progress-bar::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 50%;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.3) 0%, transparent 100%);
  border-radius: 4px 4px 0 0;
}

/* VR-Optimized Voice Controls */
#voiceToggle {
  backdrop-filter: blur(10px) !important;
  border: 2px solid rgba(255, 255, 255, 0.3) !important;
}

#voiceToggle:hover {
  background: rgba(255, 255, 255, 0.2) !important;
  border-color: rgba(255, 255, 255, 0.5) !important;
}

#voiceStatus {
  backdrop-filter: blur(15px);
}

#voiceIndicator {
  transition: all 0.3s ease;
  animation: voicePulse 2s ease-in-out infinite;
}

/* VR-Optimized Video Time Remaining */
#videoTimeRemaining {
  backdrop-filter: blur(15px) !important;
  border: 2px solid rgba(255, 255, 255, 0.2) !important;
  border-radius: 15px !important;
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.4) !important;
}

#timeRemainingText {
  font-size: 1.5rem !important;
  font-weight: 700 !important;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5) !important;
  letter-spacing: 0.5px !important;
}

/* VR-Optimized Icons */
.fas, .far {
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.3));
}

/* Additional VR-Specific Animations */
@keyframes textPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}

@keyframes voicePulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.1); }
}

/* VR-Optimized Viewport Adjustments */
@media (max-width: 768px) {
  .col-3.col-md-3.col-lg-2 {
    position: fixed;
    top: 0;
    left: -100%;
    height: 100vh;
    width: 400px;
    z-index: 1000;
    transition: left 0.3s ease;
  }
  
  .col-3.col-md-3.col-lg-2.show {
    left: 0;
  }
  
  .col-9.col-md-9.col-lg-10 {
    width: 100%;
    margin-left: 0;
  }
  
  #stepBanner {
    top: 80px;
