/* ===== DESIGN TOKENS ===== */
:root {
  --bg-0: #000000;
  --bg-1: #0c0c10;
  --bg-2: #1a1a1f;
  --silver: #c8c8d0;
  --txt: #f5f5f7;
  --muted: #a0a3aa;
  --radius: 16px;
  --shadow: 0 8px 30px rgba(0, 0, 0, .25);
  --fast: 150ms;
  --ease: cubic-bezier(.2, .8, .2, 1);
}

html,
body {
  height: auto;
  background: var(--bg-0);
  color: var(--txt);
  overflow: auto;
}

body {
  font-family: Arial, sans-serif;
  position: relative;
  text-align: center;
  padding: 20px;
}

.container {
  max-width: 800px;
  margin: auto;
}

video,
canvas {
  width: 100%;
  max-height: 400px;
  margin-bottom: 10px;
}

.controls button {
  margin: 5px;
  padding: 10px;
  font-size: 16px;
}

#feedback {
  margin-top: 20px;
  padding: 10px;
  border: 1px solid #ccc;
  background-color: #fff;
}


/* Old sidebar styles removed - replaced with new lessons-bar */


/* Header Styling */
#header {
  display: flex;
  align-items: center;
  justify-content: center;
  background: #000;
  padding: 15px;
  border-bottom: 3px solid #f1c40f;
}

#logo {
  height: 50px;
  margin-right: 15px;
}

#header h1 {
  font-size: 20px;
  color: #f1c40f;
  font-family: Arial, sans-serif;
}

/* Container Layout */
.container {
  max-width: 800px;
  margin: 80px auto;
  padding: 20px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

/* Card Styling */
.card {
  background: rgba(255, 255, 255, 0.03);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 16px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(5px);
}

/* Responsive Video/Canvas */
video,
canvas {
  width: 100%;
  height: auto;
  border-radius: 10px;
}

/* ===== RESPONSIVE DESIGN ===== */
@media (max-width: 1024px) {
  .workspace {
    flex-direction: column;
  }

  #lessons-bar {
    width: 100%;
    order: -1;
    /* Move to top on tablet */
  }

  #lessons-bar.collapsed {
    width: 100%;
    height: 60px;
  }

  #lessons-bar.collapsed .lesson-list {
    display: none;
  }
}

@media (max-width: 768px) {
  .workspace {
    flex-direction: column;
  }

  #lessons-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    height: 60px;
    z-index: 100;
    border-right: none;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
  }

  #lessons-bar.collapsed {
    height: 60px;
  }

  #lessons-bar.collapsed .lesson-list {
    display: none;
  }

  .main-content {
    padding-bottom: 80px;
    /* Space for bottom lessons bar */
  }

  .container {
    margin-left: 0;
    max-width: 100%;
  }
}

/* ===== WORKSPACE LAYOUT ===== */
.workspace {
  display: flex;
  flex-direction: row;
  /* Coach notes on right, lessons on left */
  align-items: flex-start;
  min-height: calc(100vh - 80px);
  gap: 0;
  overflow: auto;
}

.main-content {
  flex: 1;
  min-width: 0;
  /* Prevents flex item from overflowing */
}

/* ===== LESSONS SIDEBAR ===== */
#lessons-bar {
  width: 280px;
  background: rgba(255, 255, 255, 0.03);
  border-right: 1px solid rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(10px);
  transition: width 0.3s ease-in-out, opacity 0.3s ease-in-out;
  overflow: hidden;
  position: relative;
  max-height: 100vh;
  overflow-y: auto;
}

#lessons-bar.collapsed {
  width: 60px;
}

#toggle-lessons {
  width: 100%;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--txt);
  padding: 12px 16px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  transition: all 0.3s ease-in-out;
  border-radius: 0;
  text-align: left;
}

#toggle-lessons:hover {
  background: rgba(255, 255, 255, 0.08);
}

#lessons-bar.collapsed #toggle-lessons {
  text-align: center;
  padding: 12px 8px;
}

.lesson-list {
  padding: 20px;
  opacity: 1;
  transition: opacity 0.3s ease-in-out;
}

#lessons-bar.collapsed .lesson-list {
  opacity: 0;
  pointer-events: none;
}

.lesson-list h2 {
  margin-bottom: 16px;
  font-size: 18px;
  color: var(--silver);
  font-weight: 600;
}

.lesson-item {
  width: 100%;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--txt);
  padding: 12px 16px;
  margin-bottom: 8px;
  cursor: pointer;
  font-size: 14px;
  text-align: left;
  border-radius: var(--radius);
  transition: all 0.2s ease-in-out;
}

.lesson-item:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.15);
  transform: translateX(2px);
}

/* ===== ANIMATED BACKGROUND ===== */
.bg-animated {
  position: fixed;
  inset: -10%;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(60% 60% at 70% 30%, rgba(200, 200, 208, .12), transparent 60%),
    radial-gradient(70% 70% at 20% 80%, rgba(255, 255, 255, .08), transparent 65%),
    linear-gradient(180deg, var(--bg-0), var(--bg-1) 60%, var(--bg-2));
  filter: blur(40px) saturate(1.1);
  animation: floatGrad 14s var(--ease) infinite alternate;
}

@keyframes floatGrad {
  0% {
    transform: translate3d(0, 0, 0) scale(1.02);
  }

  100% {
    transform: translate3d(-2%, 2%, 0) scale(1.05);
  }
}

/* ===== SPLASH SCREEN ===== */
#splash {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(0, 0, 0, .55);
  backdrop-filter: blur(6px);
  transition: opacity var(--fast) var(--ease), visibility var(--fast) var(--ease);
  z-index: 1000;
}

#splash .splash-inner {
  text-align: center;
}

#splash h1 {
  margin-top: 12px;
  letter-spacing: .12em;
  font-weight: 700;
  color: var(--txt);
}

.logo-spin {
  width: 88px;
  height: 88px;
  display: block;
  margin: 0 auto;
  animation: spin 2.5s linear infinite;
  filter: drop-shadow(0 6px 20px rgba(0, 0, 0, .45));
}

.logo-fallback {
  width: 88px;
  height: 88px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: linear-gradient(145deg, #1d1d21, #09090c);
  font-weight: 900;
  font-size: 34px;
  color: var(--silver);
  animation: spin 2.5s linear infinite;
}

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

/* Hide splash when app is ready */
.app-ready #splash {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

/* === Overlay & Stage Fix === */
#stage {
  position: relative;
  border-radius: 12px;
  overflow: hidden;
  background: #000;
}

#video {
  width: 100%;
  height: auto;
  display: block;
}

#overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  /* allows clicking buttons */
  z-index: 10;
  /* makes overlay appear above video */
}

/* ===== PRODUCTION SCAFFOLDING STYLES ===== */

/* Rudi Brand Palette */
:root {
  --rudi-tan: #f3efe7;
  --rudi-black: #111;
  --rudi-gold: #c7a008;
  --rudi-gold-light: #d4b020;
  --rudi-gold-dark: #b8940a;
}

/* Session Controls */
.session-btn {
  padding: 12px 20px;
  margin: 5px;
  border: none;
  border-radius: var(--radius);
  font-weight: 600;
  font-size: 16px;
  cursor: pointer;
  transition: all var(--fast) var(--ease);
}

.session-btn.primary {
  background: var(--rudi-gold);
  color: var(--rudi-black);
}

.session-btn.primary:hover:not(:disabled) {
  background: var(--rudi-gold-light);
  transform: translateY(-2px);
}

.session-btn.secondary {
  background: rgba(255, 255, 255, 0.1);
  color: var(--txt);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.session-btn.secondary:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.2);
}

.session-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.demo-btn {
  padding: 10px 16px;
  margin: 5px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border: none;
  border-radius: var(--radius);
  font-weight: 500;
  cursor: pointer;
  transition: all var(--fast) var(--ease);
}

.demo-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

/* Settings Button */
.settings-btn {
  position: absolute;
  top: 20px;
  right: 20px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--fast) var(--ease);
  font-size: 18px;
}

.settings-btn:hover {
  background: rgba(255, 255, 255, 0.2);
  transform: rotate(90deg);
}

/* Coach Notes Sidebar */
#coach-notes-bar {
  width: 280px;
  background: var(--rudi-tan);
  color: var(--rudi-black);
  border-left: 1px solid rgba(0, 0, 0, 0.1);
  backdrop-filter: blur(10px);
  transition: width 0.3s ease-in-out, opacity 0.3s ease-in-out;
  overflow: hidden;
  position: relative;
  max-height: 100vh;
  overflow-y: auto;
}

#coach-notes-bar.collapsed {
  width: 60px;
}

#coach-notes-bar #toggle-coach-notes {
  width: 100%;
  padding: 12px;
  background: var(--rudi-gold);
  color: var(--rudi-black);
  border: none;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
}

#coach-notes-bar.collapsed #toggle-coach-notes {
  writing-mode: vertical-rl;
  text-orientation: mixed;
}

.coach-notes-content {
  padding: 20px;
  opacity: 1;
  transition: opacity 0.3s ease-in-out;
}

#coach-notes-bar.collapsed .coach-notes-content {
  opacity: 0;
  pointer-events: none;
}

.coach-notes-content h2 {
  margin: 0 0 20px 0;
  color: var(--rudi-black);
  font-size: 18px;
  font-weight: 600;
}

.metric {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

.metric:last-child {
  border-bottom: none;
}

.metric-label {
  font-weight: 500;
  color: var(--rudi-black);
}

.metric-value {
  font-weight: 600;
  color: var(--rudi-gold-dark);
}

.grade-display {
  font-size: 18px;
  font-weight: 700;
  padding: 4px 8px;
  border-radius: 4px;
  background: var(--rudi-gold);
  color: var(--rudi-black);
}

/* Hit Counter Display */
.hit-counter-display {
  font-size: 48px;
  font-weight: 700;
  color: var(--rudi-gold);
  text-align: center;
  padding: 20px;
  background: rgba(199, 160, 8, 0.1);
  border-radius: var(--radius);
  border: 2px solid var(--rudi-gold);
  transition: transform 0.2s ease;
}

.hit-counter-display.hit-pop {
  transform: scale(1.2);
  background: rgba(199, 160, 8, 0.2);
}

/* Settings Modal */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(5px);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: all var(--fast) var(--ease);
}

.modal.show {
  opacity: 1;
  visibility: visible;
}

.modal-content {
  background: var(--rudi-tan);
  color: var(--rudi-black);
  border-radius: var(--radius);
  padding: 0;
  max-width: 500px;
  width: 90%;
  max-height: 80vh;
  overflow-y: auto;
  transform: scale(0.9);
  transition: transform var(--fast) var(--ease);
}

.modal.show .modal-content {
  transform: scale(1);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

.modal-header h2 {
  margin: 0;
  color: var(--rudi-black);
}

.close-btn {
  background: none;
  border: none;
  font-size: 24px;
  cursor: pointer;
  color: var(--rudi-black);
  padding: 0;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-body {
  padding: 20px;
}

.setting-group {
  margin-bottom: 20px;
}

.setting-group label {
  display: block;
  margin-bottom: 8px;
  font-weight: 500;
  color: var(--rudi-black);
}

.setting-group input[type="range"] {
  width: 100%;
  margin-bottom: 8px;
}

.setting-group input[type="checkbox"] {
  margin-right: 8px;
}

.setting-group span {
  font-weight: 600;
  color: var(--rudi-gold-dark);
}

.modal-footer {
  padding: 20px;
  border-top: 1px solid rgba(0, 0, 0, 0.1);
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

.btn-primary {
  background: var(--rudi-gold);
  color: var(--rudi-black);
  border: none;
  padding: 10px 20px;
  border-radius: var(--radius);
  font-weight: 600;
  cursor: pointer;
  transition: all var(--fast) var(--ease);
}

.btn-primary:hover {
  background: var(--rudi-gold-light);
}

.btn-secondary {
  background: rgba(0, 0, 0, 0.1);
  color: var(--rudi-black);
  border: 1px solid rgba(0, 0, 0, 0.2);
  padding: 10px 20px;
  border-radius: var(--radius);
  font-weight: 600;
  cursor: pointer;
  transition: all var(--fast) var(--ease);
}

.btn-secondary:hover {
  background: rgba(0, 0, 0, 0.2);
}

/* Responsive Design for Coach Notes */
@media (max-width: 1024px) {
  #coach-notes-bar {
    width: 100%;
    order: -1;
    border-left: none;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
  }

  #coach-notes-bar.collapsed {
    width: 100%;
    height: 60px;
  }

  #coach-notes-bar.collapsed .coach-notes-content {
    display: none;
  }
}

@media (max-width: 768px) {
  #coach-notes-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    height: 60px;
    z-index: 100;
    border-bottom: none;
    border-top: 1px solid rgba(0, 0, 0, 0.1);
  }

  #coach-notes-bar.collapsed {
    height: 60px;
  }

  #coach-notes-bar.collapsed .coach-notes-content {
    display: none;
  }

  .main-content {
    padding-bottom: 80px;
  }
}

/* ===== DEMO SCAFFOLDING STYLES ===== */

/* Demo Module Base */
.demo-module {
  background: var(--rudi-tan);
  color: var(--rudi-black);
  border-radius: var(--radius);
  padding: 20px;
  margin: 20px 0;
  border: 1px solid rgba(0, 0, 0, 0.1);
  box-shadow: var(--shadow);
}

.module-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 15px;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

.module-header h3 {
  margin: 0;
  color: var(--rudi-black);
  font-size: 18px;
  font-weight: 600;
}

/* Lesson Module */
#lesson-selector {
  padding: 8px 12px;
  border: 1px solid rgba(0, 0, 0, 0.2);
  border-radius: 6px;
  background: white;
  color: var(--rudi-black);
  font-size: 14px;
}

.lesson-content {
  min-height: 100px;
  padding: 15px;
  background: rgba(255, 255, 255, 0.5);
  border-radius: 6px;
  border: 1px solid rgba(0, 0, 0, 0.1);
}

.lesson-content p {
  margin: 0;
  line-height: 1.5;
  color: var(--rudi-black);
}

/* Metronome Module */
.metronome-controls {
  display: flex;
  align-items: center;
  gap: 10px;
}

.metronome-btn {
  padding: 8px 16px;
  background: var(--rudi-gold);
  color: var(--rudi-black);
  border: none;
  border-radius: 6px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--fast) var(--ease);
}

.metronome-btn:hover {
  background: var(--rudi-gold-light);
  transform: translateY(-1px);
}

.metronome-btn.active {
  background: #ff4444;
  color: white;
}

#metronome-bpm {
  font-weight: 600;
  color: var(--rudi-gold-dark);
}

.metronome-visual {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 15px;
}

.pulse-indicator {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: var(--rudi-gold);
  transition: all 0.1s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--rudi-black);
  font-weight: bold;
  font-size: 18px;
}

.pulse-indicator.active {
  background: #ff4444;
  color: white;
  transform: scale(1.2);
}

#metronome-bpm-slider {
  width: 200px;
  margin: 0;
}

/* Profile Module */
.profile-form {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.form-group label {
  font-weight: 500;
  color: var(--rudi-black);
}

.form-group input,
.form-group select {
  padding: 8px 12px;
  border: 1px solid rgba(0, 0, 0, 0.2);
  border-radius: 6px;
  background: white;
  color: var(--rudi-black);
  font-size: 14px;
}

.form-group input:focus,
.form-group select:focus {
  outline: none;
  border-color: var(--rudi-gold);
  box-shadow: 0 0 0 2px rgba(199, 160, 8, 0.2);
}

/* Session History Module */
.history-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.history-item {
  padding: 12px;
  background: rgba(255, 255, 255, 0.5);
  border-radius: 6px;
  border: 1px solid rgba(0, 0, 0, 0.1);
}

.history-date {
  font-weight: 600;
  color: var(--rudi-black);
  margin-bottom: 4px;
}

.history-stats {
  font-size: 14px;
  color: var(--rudi-gold-dark);
}

/* Instructor Mode Module */
.toggle-switch {
  position: relative;
  display: inline-block;
  width: 50px;
  height: 24px;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #ccc;
  transition: .4s;
  border-radius: 24px;
}

.toggle-slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: .4s;
  border-radius: 50%;
}

input:checked+.toggle-slider {
  background-color: var(--rudi-gold);
}

input:checked+.toggle-slider:before {
  transform: translateX(26px);
}

.instructor-panel {
  margin-top: 15px;
  padding: 15px;
  background: rgba(255, 255, 255, 0.5);
  border-radius: 6px;
  border: 1px solid rgba(0, 0, 0, 0.1);
}

.instructor-panel h4 {
  margin: 0 0 15px 0;
  color: var(--rudi-black);
  font-size: 16px;
}

.student-table {
  overflow-x: auto;
}

.student-table table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.student-table th,
.student-table td {
  padding: 8px 12px;
  text-align: left;
  border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

.student-table th {
  background: rgba(199, 160, 8, 0.1);
  font-weight: 600;
  color: var(--rudi-black);
}

.student-table td {
  color: var(--rudi-black);
}

/* Branding Splash Screen */
.branding-splash {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, var(--rudi-tan) 0%, #e8e0d0 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 3000;
  opacity: 1;
  visibility: visible;
  transition: all 1s ease;
}

.branding-splash.fade-out {
  opacity: 0;
  visibility: hidden;
}

.splash-content {
  text-align: center;
  animation: fadeInUp 1s ease;
}

.splash-logo {
  width: 120px;
  height: 120px;
  margin-bottom: 20px;
  animation: pulse 2s infinite;
}

.splash-logo-fallback {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background: var(--rudi-gold);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 48px;
  font-weight: 900;
  color: var(--rudi-black);
  margin: 0 auto 20px auto;
  animation: pulse 2s infinite;
}

.splash-title {
  font-size: 48px;
  font-weight: 700;
  color: var(--rudi-black);
  margin: 0 0 10px 0;
  letter-spacing: 0.1em;
}

.splash-tagline {
  font-size: 18px;
  color: var(--rudi-gold-dark);
  margin: 0;
  font-weight: 500;
}

/* Animations */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes pulse {

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

  50% {
    transform: scale(1.05);
  }
}

/* Responsive Design for Demo Modules */
@media (max-width: 768px) {
  .demo-module {
    margin: 15px 0;
    padding: 15px;
  }

  .module-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }

  .metronome-controls {
    flex-direction: column;
    align-items: flex-start;
  }

  .profile-form {
    gap: 12px;
  }

  .student-table {
    font-size: 12px;
  }

  .splash-title {
    font-size: 36px;
  }

  .splash-tagline {
    font-size: 16px;
  }
}
