/* ============================================
   Chi tiết Khóa học - CSS
   Layout: video bên trái 80%, sidebar bài học 20%
   ============================================ */

/* --- Layout chính --- */
.course-detail-layout {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* --- Phần trái: Video + bottom bar --- */
.course-detail-main {
  flex: 0 0 80%;
  max-width: 80%;
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}

/* Video player - tràn hết height còn lại */
.course-video-wrap {
  flex: 1;
  min-height: 0;
  background: #000;
  overflow: hidden;
}

.course-video-wrap video {
  width: 100%;
  display: block;
  object-fit: contain;
  height: 100%;
}

/* ============================================
   Bottom bar cố định
   ============================================ */
.course-bottom-bar {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 34px;
  background: #000000;
}

/* --- Cụm nav bài --- */
.course-lesson-nav-group {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
}

.course-lesson-title {
  flex: 1;
  font-size: 15px;
  font-weight: 600;
  color: #e2e8f0;
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.course-lesson-nav {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 14px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.9);
  border: solid 1px rgba(255, 255, 255, 0.7);
  transition: 0.2s;
  flex-shrink: 0;
  cursor: pointer;
}

.course-lesson-nav:hover {
  border-color: transparent;
  color: white;
  background: rgb(43 44 82);
}

.course-lesson-nav.disabled {
  opacity: 0.5;
  pointer-events: none;
  cursor: not-allowed;
}

.course-lesson-nav i {
  font-size: 14px;
}

/* --- Cụm button popup --- */
.course-bottom-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.course-popup-trigger {
  position: relative;
}

.course-popup-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 7px 14px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 400;
  border: none;
  color: #ffffff;
  background: #272a88;
  cursor: pointer;
  transition: 0.2s;
  white-space: nowrap;
}

.course-popup-btn i {
  font-size: 16px;
}

.course-popup-btn:hover,
.course-popup-btn.active {
  border-color: #2e3293;
  color: #fff;
  background: #2e3293;
}

/* ============================================
   Mini Popup
   ============================================ */
.course-mini-popup {
  display: none;
  position: absolute;
  bottom: calc(100% + 8px);
  right: 0;
  width: 340px;
  max-height: 500px;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.15), 0 0 0 1px rgba(0, 0, 0, 0.05);
  overflow: hidden;
  z-index: 100;
  flex-direction: column;
}

.course-mini-popup.open {
  display: flex;
}

.course-mini-popup-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 8px 4px 16px;
  background: rgb(237 237 243);
  flex-shrink: 0;
}

.course-mini-popup-header h4 {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  color: #1e293b;
}

.course-mini-popup-close {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  color: #94a3b8;
  cursor: pointer;
  font-size: 14px;
  transition: 0.15s;
}

.course-mini-popup-close i {
  font-size: 20px;
}

.course-mini-popup-close:hover {
  background: white;
  color: #475569;
}

.course-mini-popup-body {
  flex: 1;
  overflow-y: auto;
  padding: 12px 16px;
}

/* --- Nội dung Ghi chú --- */
.course-mini-popup-body .editor-content {
  font-size: 15px;
  line-height: 1.5;
}

.course-mini-popup-body .editor-content h2 {
  font-size: 15px;
  font-weight: 700;
  color: #1e293b;
  margin: 0 0 6px;
}

.course-mini-popup-body .editor-content h3 {
  font-size: 14px;
  font-weight: 600;
  color: #1e293b;
  margin: 12px 0 4px;
}

.course-mini-popup-body .editor-content p {
  margin: 0 0 8px;
}

.course-mini-popup-body .editor-content ul {
  padding-left: 18px;
  margin: 0 0 8px;
}

.course-mini-popup-body .editor-content li {
  margin-bottom: 3px;
}

/* --- Nội dung Tài liệu --- */
.course-doc-list {
  list-style: none;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.course-doc-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 0px;
  border-bottom: 1px solid #e8ecf0;
  transition: background 0.15s;
}

.course-doc-item:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.course-doc-item:first-child {
  padding-top: 0;
}



/* Icon kiểu file */
.course-doc-icon {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  flex-shrink: 0;
}

.course-doc-icon.doc-pdf {
  background: #fef2f2;
  color: #ef4444;
}

.course-doc-icon.doc-rar {
  background: #fff7ed;
  color: #f59e0b;
}

.course-doc-icon.doc-doc {
  background: #eff6ff;
  color: #3b82f6;
}

.course-doc-icon.doc-img {
  background: #f0fdf4;
  color: #22c55e;
}

.course-doc-icon.doc-video {
  background: #faf5ff;
  color: #a855f7;
}

/* Info file */
.course-doc-info {
  flex: 1;
  min-width: 0;
}

.course-doc-name {
  font-size: 15px;
  font-weight: 400;
  white-space: nowrap;
  color: #475569;
  overflow: hidden;
  text-overflow: ellipsis;
  display: block;
  line-height: 1.3;
}

.course-doc-size {
  font-size: 12px;
  color: #94a3b8;
  display: block;
  margin-top: 2px;
}

/* Action button */
.course-doc-action {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  color: #94a3b8;
  font-size: 18px;
  cursor: pointer;
  transition: 0.15s;
  flex-shrink: 0;
  text-decoration: none;
}

.course-doc-action:hover {
  background: #eef2ff;
  color: #2e3293;
}

/* ============================================
   Sidebar bài học (phải 20%)
   ============================================ */
.course-sidebar {
  flex: 0 0 20%;
  max-width: 20%;
  display: flex;
  flex-direction: column;
  height: 100vh;
}

/* Header sidebar = Tên khóa học (nổi bật) */
.course-sidebar-header {
  padding: 10px 16px;
  border-bottom: 1px solid #e8ecf0;
  flex-shrink: 0;
  background: linear-gradient(135deg, #1a1a72 0%, #2e3293 100%);
  position: relative;
}

.course-back-to-class {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.65);
  text-decoration: none;
  margin-bottom: 6px;
  transition: color 0.15s;
}
.course-back-to-class:hover {
  color: #fff;
}

.course-sidebar-title {
  font-size: 17px;
  font-weight: 600;
  color: #fff;
  margin: 0;
  line-height: 1.3;
  padding-right: 26px;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
}

.course-sidebar-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 4px;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.7);
}

.course-sidebar-meta i {
  font-size: 13px;
  margin-right: 2px;
}

/* Close button */
.course-sidebar-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  color: rgba(255, 255, 255, 0.7);
  cursor: pointer;
  transition: 0.15s;
  font-size: 16px;
}

.course-sidebar-close i {
  font-size: 20px;
}

.course-sidebar-close:hover {
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
}

/* Scrollable list */
.course-sidebar-scroll {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
}

/* Accordion chương */
.course-chapter {
  border-bottom: 1px solid #e4ecf3;
}

.course-chapter-header {
  display: flex;
  gap: 8px;
  padding: 12px 12px;
  cursor: pointer;
  transition: background 0.15s;
}

.course-chapter-header:hover {
  background: #eff4f8;
}

.course-chapter-toggle {
  font-size: 18px;
  flex-shrink: 0;
  transition: transform 0.2s;
}

.course-chapter.open .course-chapter-toggle {
  transform: rotate(180deg);
}

.course-chapter-info {
  flex: 1;
  min-width: 0;
}

.course-chapter-name {
  font-size: 15px;
  font-weight: 600;
  color: #1e293b;
  line-height: 1.3;
}

/* Danh sách bài */
.course-chapter-lessons {
  display: none;
}

.course-chapter.open .course-chapter-lessons {
  display: block;
}

/* Mỗi bài học */
.course-lesson-item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 10px 14px 8px 14px;
  cursor: pointer;
  transition: background 0.15s;
  font-size: 15px;
  color: #475569;
}

.course-lesson-item:hover {
  background: #eff4f8;
}

.course-lesson-item:hover:not(.active) .course-lesson-name {
  color: #212529;
}

.course-lesson-item.active {
  background: #dde4fa;
  color: #2e3293;
}

.course-lesson-item.active .course-lesson-name {
  font-weight: 600;
}

.course-lesson-item.completed {
  color: #94a3b8;
}

/* Icon bài */
.course-lesson-icon {
  font-size: 18px;
  flex-shrink: 0;
  width: 18px;
  text-align: center;
  position: relative;
  top: 2px;
  left: -2px;
}

.course-lesson-item.completed .course-lesson-icon {
  color: #0dbc7b;
}

.course-lesson-item.active .course-lesson-icon {
  color: #2e3293;
}

/* Icon zoom thay thế ph-monitor-play */
.course-lesson-zoom-icon {
  width: 16px;
  flex-shrink: 0;
  object-fit: contain;
  position: relative;
  top: 2px;
}

/* Nội dung bài: tên + lịch zoom */
.course-lesson-content {
  flex: 1;
}

/* Lịch zoom */
.course-lesson-schedule {
  font-size: 13px;
  border-radius: 4px;
  color: #3c429e;
  margin-top: 2px;
  display: block;
}

/* Phần phải bài: tags + duration */
.course-lesson-right {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
  position: relative;
  top: 3px;
}

/* Tag LIVE trong sidebar */
.course-lesson-live-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: #ef4444;
  color: #fff;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.06em;
  padding: 2px 5px;
  border-radius: 6px;
}

.course-lesson-live-tag .course-live-pulse {
  width: 8px;
  height: 8px;
}

.course-lesson-live-tag .course-live-dot {
  width: 5px;
  height: 5px;
}

.course-lesson-live-tag .course-live-pulse::before,
.course-lesson-live-tag .course-live-pulse::after {
  width: 5px;
  height: 5px;
}

/* Duration */
.course-lesson-duration {
  font-size: 11px;
  color: #94a3b8;
  white-space: nowrap;
  flex-shrink: 0;
}

/* ============================================
   Zoom Lesson States
   Thay thế course-video-wrap khi bài học là Zoom
   ============================================ */

/* --- Container chung --- */
.course-zoom-wrap {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* ============================================
   STATE 2: ĐANG LIVE
   ============================================ */
.course-zoom-live {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.course-zoom-embed {
  flex: 1;
  min-height: 0;
  background: #0b0b0e;
}

/* Placeholder khi chưa embed SDK thật */
.course-zoom-embed-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  background: radial-gradient(ellipse at center, #14142e 0%, #0b0b0e 70%);
}

/* --- Pulse area: logo + 3 vòng tỏa --- */
.course-zoom-pulse-area {
  position: relative;
  width: 140px;
  height: 140px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 8px;
}

.course-zoom-logo {
  width: 80px;
  height: 80px;
  object-fit: contain;
  z-index: 2;
  position: relative;
  filter: drop-shadow(0 0 20px rgba(45, 104, 252, 0.3));
}

/* 3 vòng tròn tỏa mờ dần */
.course-zoom-pulse-ring {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 68px;
  height: 68px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  transform: translate(-50%, -50%) scale(1);
  animation: zoomPulseRing 2s ease-out infinite;
}

.course-zoom-pulse-ring:nth-child(2) {
  animation-delay: 1s;
  background: rgba(255, 255, 255, 0.1);
}

.course-zoom-pulse-ring:nth-child(3) {
  animation-delay: 1.6s;
  background: rgba(255, 255, 255, 0.05);
}

@keyframes zoomPulseRing {
  0% {
    transform: translate(-50%, -50%) scale(1);
    opacity: 0.6;
  }

  100% {
    transform: translate(-50%, -50%) scale(3);
    opacity: 0;
  }
}

.course-zoom-embed-text {
  font-size: 20px;
  font-weight: 700;
  color: #fff;
}

.course-zoom-embed-sub {
  font-size: 14px;
  color: rgba(255, 255, 255, 0.5);
}

/* Timer info (bên trong placeholder) */
.course-zoom-live-info {
  display: flex;
  align-items: center;
  gap: 16px;
}

.course-zoom-live-timer {
  font-size: 16px;
  color: rgba(255, 255, 255, 0.55);
  display: flex;
  align-items: center;
  gap: 6px;
}

.course-zoom-live-timer i {
  font-size: 16px;
}

.course-zoom-live-timer strong {
  color: #df8238;
  font-weight: 700;
  font-family: 'Inter', monospace;
  letter-spacing: 0.03em;
}

/* Button Vào phòng học */
.course-zoom-join-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 32px;
  border-radius: 10px;
  font-size: 17px;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(135deg, #2d68fc 0%, #4f46e5 100%);
  text-decoration: none;
  cursor: pointer;
  transition: all 0.25s;
  margin-top: 8px;
}

.course-zoom-join-btn:hover {
  color: #fff;
  transform: translateY(-2px);
  background: linear-gradient(135deg, #3b75ff 0%, #5b52f0 100%);
}

.course-zoom-join-btn i {
  font-size: 20px;
}

/* --- Lottie animation container --- */
.course-zoom-lottie-end {
  width: 160px;
}

.course-zoom-lottie-schedule {
  width: 280px;
}

.course-zoom-lottie lottie-player {
  width: 100%;
}

/* ============================================
   STATE 3: ĐÃ KẾT THÚC (dark theme)
   ============================================ */
.course-zoom-ended {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: radial-gradient(ellipse at center, #14142e 0%, #0b0b0e 70%);
  gap: 16px;
  padding: 40px;
}

.course-zoom-ended-icon {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: rgba(13, 188, 123, 0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 8px;
}

.course-zoom-ended-icon i {
  font-size: 40px;
  color: #34d399;
}

.course-zoom-ended-title {
  font-size: 22px;
  font-weight: 700;
  color: #fff;
  margin: 0;
}

.course-zoom-ended-desc {
  font-size: 15px;
  color: rgba(255, 255, 255, 0.5);
  margin: 0 0 16px;
}

.course-zoom-ended-details {
  background: rgb(80 90 244 / 15%);
  border-radius: 12px;
  padding: 16px 24px;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  row-gap: 8px;
  column-gap: 20px;
  min-width: 320px;
  backdrop-filter: blur(8px);
  max-width: 1000px;
}

.course-zoom-ended-row {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 15px;
}

.course-zoom-ended-row i {
  font-size: 18px;
  color: rgba(255, 255, 255, 0.4);
  flex-shrink: 0;
  width: 20px;
  text-align: center;
}

.course-zoom-ended-row .label {
  color: white;
}

.course-zoom-ended-row .value {
  color: #f9b03e;
}

/* ============================================
   STATE 4: CHƯA ĐẾN LỊCH (dark theme)
   ============================================ */
.course-zoom-upcoming {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: radial-gradient(ellipse at center, #14142e 0%, #0b0b0e 70%);
  gap: 8px;
  padding: 40px;
}

.course-zoom-upcoming-icon {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: rgba(46, 50, 147, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 8px;
}

.course-zoom-upcoming-icon i {
  font-size: 40px;
  color: #818cf8;
}

.course-zoom-upcoming-title {
  font-size: 24px;
  font-weight: 700;
  color: #fff;
  margin: 0;
}

.course-zoom-upcoming-schedule {
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  padding: 16px 24px;
  margin: 8px 0;
  min-width: 280px;
  backdrop-filter: blur(8px);
}

.course-zoom-upcoming-row {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 15px;
  color: rgba(255, 255, 255, 0.85);
}

.course-zoom-upcoming-row i {
  font-size: 18px;
  color: #818cf8;
  flex-shrink: 0;
}

.course-zoom-upcoming-row strong {
  color: #a5b4fc;
  font-weight: 700;
}

.course-zoom-upcoming-notice {
  display: flex;
  gap: 8px;
  width: 100%;
  font-size: 14px;
  color: white;
  background: #4141a8;
  border-radius: 10px;
  padding: 8px 16px;
  line-height: 1.5;
  margin: 0;
  margin-top: 4px;
  align-items: center;
  justify-content: center;
}

.course-zoom-upcoming-notice i {
  font-size: 18px;
  color: #fbbf24;
  flex-shrink: 0;
  margin-top: 2px;
}

/* ============================================
   STATE 5: EMBED TRỰC TIẾP (Zoom SDK)
   ============================================ */
.course-zoom-sdk-embed {
  flex: 1;
  min-height: 0;
  background: #0b0b0e;
  /* Dev sẽ nhúng Zoom Meeting SDK / iframe vào div này */
}