/* assets/css/player.css — Course player styles */

/* Override page wrapper for full-height layout */
.page-content { display: flex; flex-direction: column; }

/* ============================================================
   PLAYER LAYOUT
   ============================================================ */
.player-layout {
  display: flex;
  height: calc(100vh - var(--nav-height));
  overflow: hidden;
}

/* ============================================================
   SIDEBAR
   ============================================================ */
.player-sidebar {
  width: 300px;
  flex-shrink: 0;
  background: var(--bg);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: width .25s ease, transform .25s ease;
}
.player-sidebar.collapsed { width: 0; overflow: hidden; }

.player-sidebar__header {
  padding: 1.25rem 1rem;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.player-back {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  color: var(--text-secondary);
  font-size: .8rem;
  margin-bottom: .85rem;
  transition: color .15s;
}
.player-back:hover { color: var(--accent); }
.player-sidebar__title {
  font-size: .9rem;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.3;
  margin-bottom: .75rem;
}
.player-progress { display: flex; flex-direction: column; gap: .3rem; }
.player-progress__bar {
  height: 4px;
  background: var(--bg-gray);
  border-radius: 99px;
  overflow: hidden;
}
.player-progress__fill {
  height: 100%;
  background: var(--accent);
  border-radius: 99px;
  transition: width .4s ease;
}
.player-progress__label { font-size: .75rem; color: var(--text-muted); }

/* Nav list */
.player-nav { overflow-y: auto; flex: 1; padding: .5rem 0; }
.player-nav__section { margin-bottom: .25rem; }
.player-nav__section-title {
  font-size: .72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--text-muted);
  padding: .6rem 1rem .3rem;
}
.player-nav__item {
  display: flex;
  align-items: center;
  gap: .6rem;
  padding: .55rem 1rem;
  color: var(--text-secondary);
  font-size: .85rem;
  border-radius: var(--radius);
  margin: .1rem .4rem;
  transition: background .12s, color .12s;
  cursor: pointer;
}
.player-nav__item:hover { background: var(--bg-gray); color: var(--text-primary); }
.player-nav__item.active {
  background: var(--accent-light);
  color: var(--accent);
  font-weight: 500;
}
.player-nav__item.done { color: var(--text-muted); }
.player-nav__item.done .player-nav__icon { color: var(--success); }
.player-nav__icon {
  flex-shrink: 0;
  color: var(--text-muted);
  display: flex;
  align-items: center;
}
.player-nav__item.active .player-nav__icon { color: var(--accent); }
.player-nav__label { flex: 1; line-height: 1.3; }
.player-nav__type {
  font-size: .68rem;
  color: var(--text-muted);
  background: var(--bg-gray);
  padding: .15rem .45rem;
  border-radius: 99px;
  flex-shrink: 0;
  text-transform: capitalize;
}
.player-nav__item.active .player-nav__type {
  background: rgba(59,130,246,.12);
  color: var(--accent);
}

/* ============================================================
   MAIN AREA
   ============================================================ */
.player-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--bg-gray);
}

.player-main__header {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem 1.5rem;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.player-toggle-sidebar {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: .3rem;
  border-radius: var(--radius);
  flex-shrink: 0;
  transition: background .15s, color .15s;
}
.player-toggle-sidebar:hover { background: var(--bg-gray); color: var(--text-primary); }
.player-main__header-text { flex: 1; min-width: 0; }
.player-main__meta { font-size: .75rem; color: var(--text-muted); margin-bottom: .1rem; }
.player-main__title {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Type badge */
.player-type-badge {
  font-size: .72rem;
  font-weight: 600;
  padding: .25rem .65rem;
  border-radius: 99px;
  text-transform: capitalize;
  flex-shrink: 0;
}
.player-type-badge--written  { background: #eff6ff; color: #2563eb; }
.player-type-badge--video    { background: #fef2f2; color: #dc2626; }
.player-type-badge--audio    { background: #f0fdf4; color: #16a34a; }
.player-type-badge--pdf      { background: #fff7ed; color: #ea580c; }
.player-type-badge--flashcard{ background: #fdf4ff; color: #9333ea; }
.player-type-badge--game     { background: #fefce8; color: #ca8a04; }
.player-type-badge--quiz     { background: #f0fdf4; color: #059669; }
.player-type-badge--exam     { background: #fef2f2; color: #dc2626; }

/* Content area */
.player-content {
  flex: 1;
  overflow-y: auto;
  padding: 2rem;
}

/* Footer navigation */
.player-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 2rem;
  background: var(--bg);
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

.player-empty {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: .95rem;
}

/* ============================================================
   LESSON TYPE STYLES
   ============================================================ */

/* Written */
.lesson-written {
  max-width: 720px;
  margin: 0 auto;
  background: var(--bg);
  border-radius: var(--radius-lg);
  padding: 2rem;
  border: 1px solid var(--border);
  color: var(--text-secondary);
  font-size: .975rem;
  line-height: 1.85;
}
.lesson-written h1,.lesson-written h2,.lesson-written h3 {
  font-family: var(--font-display);
  color: var(--text-primary);
  margin: 1.5rem 0 .6rem;
}
.lesson-written h2 { font-size: 1.5rem; }
.lesson-written h3 { font-size: 1.2rem; }
.lesson-written p { margin-bottom: 1rem; }
.lesson-written ul,.lesson-written ol { padding-left: 1.4rem; margin-bottom: 1rem; }
.lesson-written li { margin-bottom: .4rem; }
.lesson-written table { width: 100%; border-collapse: collapse; margin-bottom: 1rem; }
.lesson-written th,.lesson-written td { border: 1px solid var(--border); padding: .5rem .75rem; font-size: .9rem; }
.lesson-written th { background: var(--bg-gray); font-weight: 600; }

/* Video */
.lesson-video { max-width: 800px; margin: 0 auto; }
.lesson-video__embed {
  position: relative;
  padding-bottom: 56.25%;
  height: 0;
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: #000;
}
.lesson-video__embed iframe {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  border: none;
}

/* Audio */
.lesson-audio {
  max-width: 600px;
  margin: 2rem auto;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2rem;
  text-align: center;
}
.lesson-audio audio { width: 100%; margin-top: 1rem; }

/* PDF */
.lesson-pdf { height: 100%; min-height: 600px; }
.lesson-pdf iframe { width: 100%; height: 600px; border: none; border-radius: var(--radius-lg); }

/* Flashcards */
.flashcard-container {
  max-width: 600px;
  margin: 1rem auto;
  text-align: center;
}
.flashcard {
  perspective: 1000px;
  height: 260px;
  cursor: pointer;
  margin-bottom: 1.5rem;
}
.flashcard__inner {
  position: relative;
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
  transition: transform .5s;
}
.flashcard.flipped .flashcard__inner { transform: rotateY(180deg); }
.flashcard__front,.flashcard__back {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-lg);
  padding: 2rem;
  backface-visibility: hidden;
  font-size: 1.1rem;
  font-weight: 500;
  line-height: 1.5;
}
.flashcard__front {
  background: var(--navy);
  color: var(--text-white);
  border: 1px solid var(--border-dark);
}
.flashcard__back {
  background: var(--accent-light);
  color: var(--accent);
  border: 1px solid var(--accent);
  transform: rotateY(180deg);
}
.flashcard-hint { font-size: .8rem; color: var(--text-muted); margin-bottom: 1rem; }
.flashcard-counter { font-size: .85rem; color: var(--text-muted); margin-top: .5rem; }
.flashcard-nav { display: flex; gap: .75rem; justify-content: center; margin-top: 1rem; }

/* ============================================================
   EXAM / QUIZ
   ============================================================ */
.exam-wrapper { max-width: 720px; margin: 0 auto; }

.exam-intro {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2.5rem;
  text-align: center;
}
.exam-intro__icon { font-size: 2.5rem; margin-bottom: 1rem; }
.exam-intro__title {
  font-family: var(--font-display);
  font-size: 1.6rem;
  color: var(--text-primary);
  margin-bottom: 1.5rem;
}
.exam-meta-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}
.exam-meta-item {
  background: var(--bg-gray);
  border-radius: var(--radius);
  padding: .85rem 1rem;
}
.exam-meta-label { display: block; font-size: .75rem; color: var(--text-muted); margin-bottom: .2rem; }
.exam-meta-value { display: block; font-size: 1.1rem; font-weight: 600; color: var(--text-primary); }

.exam-timer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: .4rem;
  font-size: .95rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 1rem;
  padding: .5rem 1rem;
  background: var(--bg);
  border-radius: var(--radius);
  border: 1px solid var(--border);
}
.exam-timer.warning { color: var(--danger); border-color: #fca5a5; background: #fef2f2; }

.exam-question {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  margin-bottom: 1rem;
}
.exam-question__num { font-size: .75rem; color: var(--text-muted); margin-bottom: .5rem; }
.exam-question__text { font-size: 1rem; font-weight: 500; color: var(--text-primary); margin-bottom: 1.1rem; line-height: 1.5; }

.exam-answers { display: flex; flex-direction: column; gap: .5rem; }
.exam-answer {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .75rem 1rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: border-color .12s, background .12s;
}
.exam-answer:hover { border-color: var(--accent); background: var(--accent-light); }
.exam-answer input[type="radio"] { flex-shrink: 0; accent-color: var(--accent); width: 16px; height: 16px; }
.exam-answer__text { font-size: .9rem; color: var(--text-secondary); line-height: 1.4; }
.exam-answer:has(input:checked) { border-color: var(--accent); background: var(--accent-light); }
.exam-answer:has(input:checked) .exam-answer__text { color: var(--accent); font-weight: 500; }

.exam-submit-row { text-align: center; margin-top: 1.5rem; }

/* Results */
.exam-result-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 3rem 2rem;
  text-align: center;
}
.exam-result-card.passed { border-color: #86efac; background: #f0fdf4; }
.exam-result-card.failed { border-color: #fca5a5; background: #fef2f2; }
.exam-result-icon { font-size: 3rem; margin-bottom: 1rem; }
.exam-result-title { font-family: var(--font-display); font-size: 1.8rem; margin-bottom: .5rem; color: var(--text-primary); }
.exam-result-score { font-size: 3.5rem; font-weight: 700; color: var(--text-primary); line-height: 1; margin: .5rem 0; }
.exam-result-sub { font-size: .9rem; color: var(--text-muted); margin-bottom: 1.5rem; }
.exam-result-actions { display: flex; gap: .75rem; justify-content: center; flex-wrap: wrap; }

.exam-explanation { margin-top: .75rem; animation: fadeIn .25s ease; }
.exam-explanation__inner { background: #fffbeb; border: 1px solid #fde68a; border-radius: var(--radius); padding: .75rem 1rem; font-size: .875rem; color: #92400e; line-height: 1.6; }
@keyframes fadeIn { from { opacity:0; transform:translateY(-4px); } to { opacity:1; transform:translateY(0); } }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 768px) {
  .player-sidebar {
    position: absolute;
    z-index: 50;
    height: calc(100vh - var(--nav-height));
    box-shadow: var(--shadow-lg);
    transform: translateX(0);
  }
  .player-sidebar.collapsed { transform: translateX(-100%); width: 300px; }
  .player-content { padding: 1.25rem; }
  .player-footer { padding: .75rem 1rem; }
}
