/* ==========================================================================
   Dillard University - Psychology in Everyday Life (CSS Stylesheet)
   ========================================================================== */

:root {
  --color-primary: #002d62;         /* Deep Dillard University Blue */
  --color-primary-light: #1a4d8c;
  --color-accent: #d4af37;          /* Academic Gold */
  --color-accent-hover: #b89728;
  --color-bg-dark: #0f172a;         /* Deep Slate Dark */
  --color-bg-card: rgba(15, 23, 42, 0.88);
  --color-surface: #ffffff;
  --color-surface-dim: #f8fafc;
  --color-text-main: #f8fafc;
  --color-text-muted: #94a3b8;
  --color-text-dark: #0f172a;
  --color-border: rgba(255, 255, 255, 0.15);
  --color-success: #10b981;
  --color-warning: #f59e0b;
  --color-danger: #ef4444;
  --color-focus: #38bdf8;

  --font-sans: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --font-serif: Georgia, Cambria, 'Times New Roman', Times, serif;

  --base-font-size: 16px;
  --transition-normal: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --shadow-lg: 0 10px 25px -5px rgba(0, 0, 0, 0.5), 0 8px 10px -6px rgba(0, 0, 0, 0.5);
  --shadow-glow: 0 0 15px rgba(212, 175, 55, 0.35);
}

/* Font Size Modifiers */
body.font-large { --base-font-size: 18px; }
body.font-xlarge { --base-font-size: 20px; }

/* High Contrast Mode */
body.high-contrast {
  --color-primary: #000000;
  --color-primary-light: #222222;
  --color-accent: #ffff00;
  --color-accent-hover: #ffea00;
  --color-bg-dark: #000000;
  --color-bg-card: #000000;
  --color-surface: #000000;
  --color-text-main: #ffffff;
  --color-text-muted: #ffffaa;
  --color-text-dark: #000000;
  --color-border: #ffffff;
  --color-focus: #00ffff;
}

/* Reduced Motion Override */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

body.reduced-motion * {
  transition-duration: 0.01ms !important;
}

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

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  font-family: var(--font-sans);
  font-size: var(--base-font-size);
  color: var(--color-text-main);
  background-color: var(--color-bg-dark);
  user-select: none;
  -webkit-font-smoothing: antialiased;
}

/* Screen reader only utility */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

/* Accessible Skip Link */
.skip-link {
  position: absolute;
  top: -60px;
  left: 20px;
  background: var(--color-accent);
  color: var(--color-primary);
  font-weight: 700;
  padding: 12px 18px;
  z-index: 10000;
  border-radius: var(--radius-sm);
  transition: top var(--transition-normal);
  text-decoration: none;
}
.skip-link:focus {
  top: 20px;
  outline: 3px solid var(--color-focus);
}

/* Focus Indicator for Keyboard Accessibility */
button:focus-visible,
select:focus-visible,
input:focus-visible,
textarea:focus-visible,
a:focus-visible {
  outline: 3px solid var(--color-focus);
  outline-offset: 2px;
}

/* WebGL Fullscreen Canvas */
#webgl-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
  display: block;
}

/* Reticle / Focus Center Marker */
#reticle {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 8px;
  height: 8px;
  background-color: rgba(255, 255, 255, 0.4);
  border: 1px solid rgba(0, 0, 0, 0.5);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
  z-index: 5;
  transition: transform 0.2s, background-color 0.2s;
}

/* UI Container Over 3D Scene */
.ui-container {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 10;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

/* Interactive elements inside HUD must re-enable pointer events */
.hud-top,
.floating-prompt-card,
.evidence-drawer,
.modal-dialog,
.orientation-card,
.captions-bar {
  pointer-events: auto;
}

/* ==========================================================================
   Top HUD Bar
   ========================================================================== */
.hud-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 24px;
  background: linear-gradient(180deg, rgba(15, 23, 42, 0.92) 0%, rgba(15, 23, 42, 0.6) 80%, transparent 100%);
  border-bottom: 1px solid var(--color-border);
  backdrop-filter: blur(8px);
  gap: 16px;
}

.brand-group {
  display: flex;
  flex-direction: column;
}

.university-tag {
  font-size: 0.68rem;
  letter-spacing: 0.12em;
  font-weight: 800;
  color: var(--color-accent);
  text-transform: uppercase;
}

.sim-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--color-text-main);
  letter-spacing: -0.01em;
}

/* Progress Stepper */
.progress-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 1;
  max-width: 440px;
  margin: 0 20px;
}

.progress-bar-container {
  width: 100%;
  height: 8px;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 6px;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--color-primary-light), var(--color-accent));
  transition: width 0.4s ease-out;
}

.stage-badge {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--color-text-muted);
  text-align: center;
}

/* HUD Button Group */
.hud-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.hud-btn {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--color-border);
  color: var(--color-text-main);
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all var(--transition-normal);
  min-height: 40px;
}

.hud-btn:hover {
  background: rgba(255, 255, 255, 0.18);
  border-color: rgba(255, 255, 255, 0.35);
}

.hud-btn.danger {
  color: #fca5a5;
}
.hud-btn.danger:hover {
  background: rgba(239, 68, 68, 0.25);
  border-color: var(--color-danger);
}

.hud-btn .badge {
  background: var(--color-accent);
  color: var(--color-primary);
  font-size: 0.7rem;
  padding: 2px 6px;
  border-radius: 999px;
  font-weight: 800;
}

/* ==========================================================================
   Floating Prompt Card (Interactive Stage Guide)
   ========================================================================== */
.floating-prompt-card {
  position: absolute;
  bottom: 80px;
  left: 24px;
  width: 480px;
  max-width: calc(100vw - 48px);
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 22px 26px;
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(14px);
  transition: transform var(--transition-normal), opacity var(--transition-normal);
}

.card-stage-eyebrow {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  color: var(--color-accent);
  margin-bottom: 6px;
}

.card-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: #ffffff;
  margin-bottom: 10px;
  line-height: 1.3;
}

.card-text {
  font-size: 0.92rem;
  line-height: 1.55;
  color: #e2e8f0;
  margin-bottom: 12px;
}

.card-objective-box {
  background: rgba(0, 45, 98, 0.4);
  border-left: 3px solid var(--color-accent);
  padding: 8px 12px;
  font-size: 0.84rem;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  color: #cbd5e1;
  margin-bottom: 16px;
}

.card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  padding-top: 14px;
}

.scroll-guidance {
  font-size: 0.78rem;
  color: var(--color-text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
}

/* Buttons */
.btn {
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  transition: all var(--transition-normal);
}

.btn.primary-action {
  background: var(--color-accent);
  color: var(--color-primary);
  border-color: var(--color-accent);
  font-weight: 700;
}
.btn.primary-action:hover {
  background: var(--color-accent-hover);
  box-shadow: var(--shadow-glow);
}

.btn.secondary {
  background: rgba(255, 255, 255, 0.1);
  color: #ffffff;
  border-color: var(--color-border);
}
.btn.secondary:hover {
  background: rgba(255, 255, 255, 0.2);
}

.btn-icon {
  background: transparent;
  border: none;
  color: var(--color-text-muted);
  font-size: 1.2rem;
  cursor: pointer;
  padding: 6px;
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  min-height: 36px;
}
.btn-icon:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.1);
}

/* ==========================================================================
   Closed Captions Bar
   ========================================================================== */
.captions-bar {
  position: absolute;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.2);
  padding: 10px 24px;
  border-radius: var(--radius-md);
  max-width: 720px;
  width: calc(100% - 48px);
  text-align: center;
  backdrop-filter: blur(10px);
  transition: opacity 0.3s;
}

.caption-speaker {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--color-accent);
  margin-right: 8px;
}

.caption-text {
  font-size: 0.95rem;
  color: #f8fafc;
  line-height: 1.4;
}

/* ==========================================================================
   Evidence & Journal Slide-Over Drawer
   ========================================================================== */
.evidence-drawer {
  position: absolute;
  top: 0;
  right: -520px;
  width: 480px;
  max-width: 100vw;
  height: 100%;
  background: #0f172a;
  border-left: 1px solid var(--color-border);
  box-shadow: -10px 0 30px rgba(0, 0, 0, 0.7);
  display: flex;
  flex-direction: column;
  z-index: 100;
  transition: right 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

.evidence-drawer.open {
  right: 0;
}

.drawer-header {
  padding: 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--color-border);
}

.drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
}

.drawer-instruction {
  font-size: 0.85rem;
  color: var(--color-text-muted);
  margin-bottom: 18px;
}

.journal-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.journal-card {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 14px 16px;
}

.journal-card-header {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  color: var(--color-accent);
  font-weight: 700;
  margin-bottom: 6px;
}

.journal-card-title {
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: 6px;
  color: #ffffff;
}

.journal-card-entry {
  font-size: 0.88rem;
  color: #cbd5e1;
  line-height: 1.45;
}

.empty-state {
  text-align: center;
  color: var(--color-text-muted);
  font-size: 0.88rem;
  padding: 40px 10px;
}

.drawer-footer {
  padding: 16px 20px;
  border-top: 1px solid var(--color-border);
  display: flex;
  gap: 10px;
}

/* ==========================================================================
   Modals (Interactive Dialog & Accessibility)
   ========================================================================== */
.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  z-index: 500;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-backdrop.active {
  display: flex;
}

.modal-dialog {
  background: #1e293b;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  width: 680px;
  max-width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
}

.modal-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-badge {
  font-size: 0.72rem;
  font-weight: 800;
  color: var(--color-accent);
  text-transform: uppercase;
  margin-bottom: 4px;
}

.modal-title {
  font-size: 1.35rem;
  color: #ffffff;
}

.modal-body {
  padding: 24px;
  line-height: 1.5;
}

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--color-border);
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}

/* Activity Modal Elements */
.activity-prompt {
  font-size: 1rem;
  color: #f1f5f9;
  margin-bottom: 16px;
}

.activity-options-grid {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 20px;
}

.option-card {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  cursor: pointer;
  transition: all var(--transition-normal);
  display: flex;
  align-items: flex-start;
  gap: 12px;
}
.option-card:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.3);
}
.option-card.selected {
  border-color: var(--color-accent);
  background: rgba(212, 175, 55, 0.15);
}

.option-radio {
  margin-top: 3px;
  accent-color: var(--color-accent);
}

.option-content h4 {
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: 4px;
  color: #ffffff;
}

.option-content p {
  font-size: 0.84rem;
  color: #94a3b8;
}

/* Pedagogical 3-Part Feedback Banner */
.feedback-box {
  margin-top: 16px;
  padding: 16px 20px;
  border-radius: var(--radius-md);
  background: rgba(15, 23, 42, 0.85);
  border: 1px solid var(--color-border);
}

.feedback-box.correct { border-left: 4px solid var(--color-success); }
.feedback-box.partial { border-left: 4px solid var(--color-warning); }

.feedback-section {
  margin-bottom: 10px;
  font-size: 0.88rem;
  line-height: 1.45;
}
.feedback-section:last-child {
  margin-bottom: 0;
}
.feedback-section strong {
  display: block;
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 2px;
}
.feedback-identified strong { color: var(--color-success); }
.feedback-context strong { color: var(--color-accent); }
.feedback-premature strong { color: var(--color-warning); }

/* Settings Form Controls */
.setting-group {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 16px;
  margin-bottom: 18px;
}
.setting-legend {
  font-weight: 700;
  color: var(--color-accent);
  font-size: 0.85rem;
  padding: 0 8px;
}
.setting-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  font-size: 0.88rem;
}
.setting-row:last-child { border-bottom: none; }
.setting-row select,
.setting-row input[type="range"] {
  background: #0f172a;
  border: 1px solid var(--color-border);
  color: #ffffff;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
}

/* ==========================================================================
   Orientation Modal (Stage 0)
   ========================================================================== */
.orientation-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(15, 23, 42, 0.95);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 24px;
}

.orientation-overlay.hidden {
  display: none;
}

.orientation-card {
  background: #1e293b;
  border: 1px solid rgba(212, 175, 55, 0.35);
  border-radius: var(--radius-lg);
  max-width: 760px;
  width: 100%;
  padding: 36px 40px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.8);
}

.orient-badge {
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  color: var(--color-accent);
  margin-bottom: 8px;
}

.orientation-card h2 {
  font-size: 1.7rem;
  color: #ffffff;
  margin-bottom: 16px;
  line-height: 1.25;
}

.orient-content p {
  color: #cbd5e1;
  font-size: 0.96rem;
  line-height: 1.6;
  margin-bottom: 20px;
}

.orient-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 20px;
}

.orient-col {
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 16px 20px;
}

.orient-col h4 {
  font-size: 0.95rem;
  color: #ffffff;
  margin-bottom: 10px;
}

.orient-col ul {
  padding-left: 20px;
  color: #94a3b8;
  font-size: 0.85rem;
  line-height: 1.5;
}

.orient-notice {
  background: rgba(0, 45, 98, 0.3);
  border-left: 3px solid var(--color-accent);
  padding: 10px 14px;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-size: 0.82rem;
  color: #cbd5e1;
  margin-bottom: 26px;
}

.orient-actions {
  display: flex;
  gap: 14px;
  justify-content: flex-end;
}

.large-btn {
  padding: 12px 24px;
  font-size: 1rem;
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .hud-top {
    flex-wrap: wrap;
    padding: 10px 14px;
  }
  .progress-wrapper {
    order: 3;
    margin: 8px 0 0 0;
    max-width: 100%;
    width: 100%;
  }
  .floating-prompt-card {
    left: 12px;
    bottom: 90px;
    width: calc(100vw - 24px);
    padding: 16px;
  }
  .orient-grid {
    grid-template-columns: 1fr;
  }
  .captions-bar {
    width: calc(100% - 24px);
  }
  .evidence-drawer {
    width: 100vw;
  }
}
