/* ==========================================================================
   AI ENGLISH HUB - ADVANCED CYBER AI THEME
   Tái hiện phong cách Nexus Quant: Glassmorphism, 3D Perspective & Neon Glow
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Be+Vietnam+Pro:ital,wght@0,300;0,400;0,500;0,600;0,700;0,800;1,400&family=JetBrains+Mono:wght@400;500;700&display=swap');

:root {
  --bg-primary: #07080d;
  --bg-secondary: #0b0e17;
  --bg-card: rgba(11, 14, 23, 0.75);
  --border-color: rgba(255, 255, 255, 0.08);
  --accent-cyan: #06b6d4;
  --accent-green: #10b981;
}

body {
  background-color: var(--bg-primary);
  font-family: 'Be Vietnam Pro', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  letter-spacing: -0.015em;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.mono-font {
  font-family: 'JetBrains Mono', monospace;
}

/* Luxury Cyber Glass Card */
.cyber-card {
  background: rgba(11, 14, 23, 0.78);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 1.25rem;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.5);
}

.cyber-card:hover {
  border-color: rgba(16, 185, 129, 0.4);
  box-shadow: 0 20px 40px -15px rgba(16, 185, 129, 0.15), 0 0 15px rgba(16, 185, 129, 0.1);
}

/* 3D Tilt Card Base Transition */
.card-3d {
  transform-style: preserve-3d;
  will-change: transform;
  transition: transform 0.2s cubic-bezier(0.25, 0.46, 0.45, 0.94), border-color 0.3s ease, box-shadow 0.3s ease;
}

/* Flashcard 3D Flip Effect */
.flashcard-inner {
  transition: transform 0.6s cubic-bezier(0.4, 0.2, 0.2, 1);
  transform-style: preserve-3d;
}

.flashcard.flipped .flashcard-inner {
  transform: rotateY(180deg);
}

.flashcard-front, .flashcard-back {
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}

.flashcard-back {
  transform: rotateY(180deg);
}

/* Shimmer Animation */
.shimmer-text {
  background: linear-gradient(90deg, #10b981 0%, #06b6d4 50%, #10b981 100%);
  background-size: 200% auto;
  color: transparent;
  -webkit-background-clip: text;
  background-clip: text;
  animation: shine 4s linear infinite;
}

@keyframes shine {
  to {
    background-position: 200% center;
  }
}

/* Glowing Neon Pill */
.neon-pill {
  position: relative;
  border: 1px solid rgba(16, 185, 129, 0.3);
  box-shadow: 0 0 15px rgba(16, 185, 129, 0.15);
}

.neon-pill::after {
  content: '';
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  background: linear-gradient(90deg, rgba(16, 185, 129, 0.4), rgba(6, 182, 212, 0.4));
  z-index: -1;
  filter: blur(4px);
  opacity: 0.5;
}

/* Utilities */
@layer utilities {
  .scrollbar-none::-webkit-scrollbar {
    display: none;
  }
  .scrollbar-none {
    -ms-overflow-style: none;
    scrollbar-width: none;
  }
}

.tab-content {
  animation: fadeIn 0.25s ease-in-out;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}


/* Dynamic Video Slide Presentation (Cinematic Keyframe Stages) */
@keyframes videoStepReveal {
  0% {
    opacity: 0;
    transform: translateY(24px) scale(0.97);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.video-scene-card {
  animation: videoStepReveal 0.65s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  transition: all 0.45s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 4px 20px -2px rgba(0, 0, 0, 0.6);
}

.video-scene-card.is-active-spotlight {
  border-color: rgba(52, 211, 153, 0.85) !important;
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.15), rgba(6, 182, 212, 0.10)) !important;
  box-shadow: 0 0 35px rgba(16, 185, 129, 0.3), inset 0 0 20px rgba(16, 185, 129, 0.08) !important;
  transform: translateY(-2px) scale(1.015);
}

.video-scene-card.is-dimmed-spotlight {
  opacity: 0.65;
  filter: saturate(0.85);
  transform: scale(0.99);
}

.video-progress-fill {
  transition: width 0.15s linear;
}


/* Hardware-Accelerated Video Slide Scene Transitions */
.video-scene-transition {
  will-change: transform, opacity;
  transition: transform 0.24s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.24s ease;
}

.scene-exit-left {
  opacity: 0 !important;
  transform: translate3d(-18px, 0, 0) scale(0.98) !important;
}

.scene-enter-right {
  animation: sceneEnterRightKeyframe 0.35s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes sceneEnterRightKeyframe {
  0% {
    opacity: 0;
    transform: translate3d(20px, 0, 0) scale(0.98);
  }
  100% {
    opacity: 1;
    transform: translate3d(0, 0, 0) scale(1);
  }
}

/* ============================================================== */
/* HIỆU ỨNG TRÌNH CHIẾU THUYẾT GIẢNG MOTION GRAPHICS (SLOW & SMOOTH) */
/* ============================================================== */

@keyframes softFadeUp {
  0% {
    opacity: 0;
    transform: translate3d(0, 16px, 0);
  }
  100% {
    opacity: 1;
    transform: translate3d(0, 0, 0);
  }
}

@keyframes softFadeScale {
  0% {
    opacity: 0;
    transform: translate3d(0, 10px, 0) scale(0.98);
  }
  100% {
    opacity: 1;
    transform: translate3d(0, 0, 0);
  }
}

@keyframes softSlideRight {
  0% {
    opacity: 0;
    transform: translate3d(-20px, 0, 0);
  }
  100% {
    opacity: 1;
    transform: translate3d(0, 0, 0);
  }
}

@keyframes visualPulseWave {
  0% {
    transform: scale(0.85);
    opacity: 0.8;
  }
  50% {
    transform: scale(1.05);
    opacity: 0.3;
  }
  100% {
    transform: scale(1.2);
    opacity: 0;
  }
}

@keyframes synapseDash {
  to {
    stroke-dashoffset: -30;
  }
}

.synapse-flow-line {
  stroke-dasharray: 6, 6;
  animation: synapseDash 1.4s linear infinite;
}

.visual-pulse-ring {
  animation: visualPulseWave 2.2s cubic-bezier(0.16, 1, 0.3, 1) infinite;
}

/* Chuyển động từng phần tử xuất hiện chậm rãi, êm ái, nhịp nhàng theo phong cách tài liệu khoa học */
.scene-kicker,
.motion-beat-badge {
  animation: softFadeScale 0.85s cubic-bezier(0.16, 1, 0.3, 1) 0.12s both;
}

.scene-title,
.motion-beat-title {
  text-wrap: balance;
  letter-spacing: -0.02em;
  animation: softFadeUp 0.95s cubic-bezier(0.16, 1, 0.3, 1) 0.38s both;
}

.motion-beat-visual {
  animation: softFadeScale 1.05s cubic-bezier(0.16, 1, 0.3, 1) 0.72s both;
}

.scene-insight,
.motion-beat-point-0 {
  animation: softFadeUp 0.95s cubic-bezier(0.16, 1, 0.3, 1) 1.05s both;
}

.motion-beat-point-1 {
  animation: softFadeUp 0.95s cubic-bezier(0.16, 1, 0.3, 1) 1.38s both;
}

.motion-beat-point-2 {
  animation: softFadeUp 0.95s cubic-bezier(0.16, 1, 0.3, 1) 1.70s both;
}

.scene-callout,
.motion-beat-callout {
  animation: softFadeScale 0.95s cubic-bezier(0.16, 1, 0.3, 1) 1.70s both;
}



/* ============================================================== */
/* MAGIC UI & REACT BITS PRESENTATION UTILITIES */
/* ============================================================== */

/* Magic UI: Border Beam */
.border-beam {
  position: relative;
  overflow: hidden;
}
.border-beam::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1.5px;
  background: conic-gradient(
    from var(--beam-angle, 0deg) at 50% 50%,
    transparent 0%,
    rgba(16, 185, 129, 0.9) 20%,
    rgba(6, 182, 212, 0.9) 45%,
    rgba(139, 92, 246, 0.9) 65%,
    transparent 80%
  );
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
  animation: borderBeamSpin 4.5s linear infinite;
}
@keyframes borderBeamSpin {
  to {
    --beam-angle: 360deg;
  }
}
@property --beam-angle {
  syntax: "<angle>";
  inherits: false;
  initial-value: 0deg;
}

/* Magic UI: Shimmer Button */
.shimmer-btn {
  position: relative;
  overflow: hidden;
}
.shimmer-btn::before {
  content: "";
  position: absolute;
  top: 0;
  left: -100%;
  width: 50%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.35),
    transparent
  );
  transform: skewX(-25deg);
  animation: shimmerPass 3.5s ease-in-out infinite;
}
@keyframes shimmerPass {
  0% { left: -100%; }
  35%, 100% { left: 160%; }
}

/* Magic UI / React Bits: Animated Gradient Text */
.animated-gradient-text {
  background: linear-gradient(
    90deg,
    #34d399 0%,
    #22d3ee 30%,
    #a78bfa 60%,
    #34d399 100%
  );
  background-size: 250% auto;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: textGradientShine 6s linear infinite;
}
@keyframes textGradientShine {
  to {
    background-position: 250% center;
  }
}

/* React Bits: Spotlight Card */
.spotlight-card {
  position: relative;
  overflow: hidden;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}
.spotlight-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 35px -8px rgba(16, 185, 129, 0.25);
}

/* Zero Extraneous Load on Mobile */
@media (max-width: 640px) {
  .mobile-tight-pad {
    padding-left: 0.75rem !important;
    padding-right: 0.75rem !important;
  }
  .scene-active-card {
    padding: 1rem !important;
  }
}

/* ============================================================== */
/* LECTURE STAGE: CINEMATIC SCENE, CAPTION & TIMELINE             */
/* ============================================================== */

.lecture-stage-card {
  background:
    radial-gradient(120% 90% at 50% -10%, rgba(16, 185, 129, 0.08), transparent 60%),
    rgba(8, 11, 19, 0.92);
}

.lecture-cinema-stage {
  --scene-accent: 16 185 129;
  position: relative;
  isolation: isolate;
  overflow: hidden;
  min-height: 360px;
  background:
    radial-gradient(90% 70% at 50% 0%, rgb(var(--scene-accent) / 0.14), transparent 70%),
    linear-gradient(160deg, rgba(15, 23, 42, 0.96), rgba(2, 6, 23, 0.98));
}

.lecture-cinema-stage[data-theme="cyan"] { --scene-accent: 6 182 212; }
.lecture-cinema-stage[data-theme="indigo"] { --scene-accent: 99 102 241; }
.lecture-cinema-stage[data-theme="purple"] { --scene-accent: 168 85 247; }
.lecture-cinema-stage[data-theme="blue"] { --scene-accent: 59 130 246; }
.lecture-cinema-stage[data-theme="amber"] { --scene-accent: 245 158 11; }

.lecture-cinema-stage::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background: radial-gradient(110% 90% at 50% 45%, transparent 55%, rgba(0, 0, 0, 0.38) 100%);
}

.lecture-stage-grid {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgb(var(--scene-accent) / 0.055) 1px, transparent 1px),
    linear-gradient(90deg, rgb(var(--scene-accent) / 0.055) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: radial-gradient(80% 70% at 50% 42%, #000 10%, transparent 82%);
  -webkit-mask-image: radial-gradient(80% 70% at 50% 42%, #000 10%, transparent 82%);
}

#activeSceneContentContainer {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-areas: "stage";
  align-items: center;
  justify-items: center;
  width: 100%;
}

.scene-layer {
  grid-area: stage;
  width: 100%;
  max-width: 1080px;
  opacity: 1;
  transform: translate3d(0, 0, 0);
  transition:
    opacity 0.9s cubic-bezier(0.22, 1, 0.36, 1),
    transform 0.9s cubic-bezier(0.22, 1, 0.36, 1);
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  will-change: opacity, transform;
}

.scene-layer.is-current {
  opacity: 1;
  transform: translate3d(0, 0, 0);
  pointer-events: auto;
}

.scene-layer.scene-layer-enter {
  opacity: 0;
  transform: translate3d(0, 24px, 0);
  pointer-events: none;
}

.scene-layer.scene-layer-enter.is-visible {
  opacity: 1;
  transform: translate3d(0, 0, 0);
  pointer-events: auto;
}

.scene-layer.is-leaving {
  opacity: 0;
  transform: translate3d(0, -18px, 0);
  pointer-events: none;
}

/* Scene typography motion */
.scene-active-card.scene-kinetic {
  background:
    linear-gradient(155deg, rgba(15, 23, 42, 0.84), rgba(2, 6, 23, 0.8));
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.04),
    0 24px 60px -34px rgba(0, 0, 0, 0.95);
}

/* Voice-synced caption ribbon (không đè lên nội dung slide) */
.lecture-cinema-stage {
  display: flex;
  flex-direction: column;
}

#activeSceneContentContainer {
  flex: 1;
  min-height: 0;
}

.lecture-caption-ribbon {
  position: relative;
  z-index: 4;
  flex-shrink: 0;
  width: auto;
  min-height: 2.65rem;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0.4rem 0.85rem 0.85rem;
  padding: 0.5rem 0.9rem;
  border-radius: 0.75rem;
  border: 1px solid rgb(var(--scene-accent) / 0.28);
  background: rgba(2, 6, 23, 0.88);
  box-shadow: 0 10px 30px -12px rgba(0, 0, 0, 0.9);
  color: #f8fafc;
  font-size: clamp(0.8rem, 2.6vw, 1rem);
  line-height: 1.45;
  font-weight: 500;
  text-align: center;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.9);
  pointer-events: none;
}

.lecture-caption-ribbon.hidden {
  display: flex;
  visibility: hidden;
}

/* Ẩn hoàn toàn thanh tiến trình và thời gian kiểu video theo yêu cầu người học */
.lecture-timeline,
.lecture-timeline-fill,
.lecture-time-row {
  display: none !important;
}

#lectureCaptionText {
  display: inline-block;
}

.caption-pop #lectureCaptionText {
  animation: captionPop 0.18s ease-out;
}

@keyframes captionPop {
  0% { opacity: 0.25; transform: translateY(4px); }
  100% { opacity: 1; transform: translateY(0); }
}

.slide-stage-enter .lecture-cinema-stage {
  animation: slideStageEnter 0.75s cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes slideStageEnter {
  0% {
    opacity: 0;
    transform: translate3d(0, 14px, 0);
  }
  100% {
    opacity: 1;
    transform: translate3d(0, 0, 0);
  }
}

/* ============================================================== */
/* ADMIN CINEMA PRESENTATION MODE                                  */
/* ============================================================== */

.cinema-wave {
  display: none;
}

.cinema-countdown-overlay {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  background:
    radial-gradient(70% 60% at 50% 50%, rgba(16, 185, 129, 0.12), transparent 70%),
    rgba(3, 5, 10, 0.96);
  color: #e2e8f0;
  text-align: center;
  transition: opacity 0.35s ease;
}

.cinema-countdown-overlay.is-fading {
  opacity: 0;
}

.cinema-countdown-label {
  color: #34d399;
  font-family: "JetBrains Mono", monospace;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.22em;
  text-transform: uppercase;
}

.cinema-countdown-number {
  font-family: "JetBrains Mono", monospace;
  font-size: clamp(5rem, 18vw, 11rem);
  font-weight: 800;
  line-height: 1;
  color: #f8fafc;
  text-shadow: 0 0 60px rgba(16, 185, 129, 0.45);
}

.cinema-countdown-hint {
  color: #64748b;
  font-size: 0.75rem;
}

body.cinema-mode {
  overflow: hidden;
}

body.cinema-mode #mainTopHeader,
body.cinema-mode #btnRestoreTopHeader,
body.cinema-mode #workspaceFocusBar,
body.cinema-mode #moduleNav,
body.cinema-mode #curriculumSidebar,
body.cinema-mode #sidebarBackdrop,
body.cinema-mode footer,
body.cinema-mode [data-cinema-hide] {
  display: none !important;
}

/* AI Neural Canvas & Cyber Canvases in Cinema Mode */
body.cinema-mode #neuralCanvas {
  display: block !important;
  z-index: 75 !important;
  opacity: 1 !important;
  pointer-events: none !important;
}

body.cinema-mode #pointerTrailCanvas {
  display: block !important;
  z-index: 95 !important;
  pointer-events: none !important;
}

body.cinema-mode #moduleLecture {
  position: fixed;
  inset: 0;
  z-index: 80;
  margin: 0;
  padding: 0;
  background: transparent !important;
  overflow: hidden;
}

body.cinema-mode #slideStageMainCard {
  display: flex;
  flex-direction: column;
  width: 100vw;
  height: 100dvh;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: radial-gradient(80% 65% at 50% 20%, rgba(16, 185, 129, 0.09), transparent 72%) !important;
}

body.cinema-mode .lecture-cinema-stage {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  margin: 0;
  border: 0 !important;
  border-radius: 0;
  background: transparent !important;
  box-shadow: none !important;
  padding-bottom: 5.5rem; /* Để khoảng trống thoáng đãng cho dải sóng âm cinemaWave không bao giờ bị đè */
  box-sizing: border-box;
}

body.cinema-mode #activeSceneContentContainer {
  flex: 1;
  display: grid;
  grid-template-areas: "stage";
  align-items: center;
  justify-items: center;
  min-height: 0;
  padding: clamp(0.75rem, 2vw, 1.75rem) clamp(0.75rem, 4vw, 3rem) 0.5rem;
  overflow-y: auto;
  scrollbar-width: none;
}

body.cinema-mode #activeSceneContentContainer::-webkit-scrollbar {
  display: none;
}

body.cinema-mode .scene-active-card {
  width: min(1080px, 100%);
  margin: auto;
  padding: clamp(1rem, 2.2vw, 2rem);
  border: 1px solid rgba(16, 185, 129, 0.22);
  background: rgba(11, 14, 23, 0.72);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-radius: 1.5rem;
  box-shadow: 0 24px 60px -20px rgba(0, 0, 0, 0.85), 0 0 35px -10px rgba(16, 185, 129, 0.18);
}

body.cinema-mode .scene-title {
  font-size: clamp(1.7rem, 4.6vw, 4rem);
  line-height: 1.08;
  margin-bottom: 1.25rem;
}

body.cinema-mode .scene-insight p,
body.cinema-mode .motion-beat-point-0 p,
body.cinema-mode .motion-beat-point-1 p,
body.cinema-mode .motion-beat-point-2 p,
body.cinema-mode .scene-callout {
  font-size: clamp(1rem, 1.65vw, 1.45rem);
  line-height: 1.6;
}

body.cinema-mode .scene-kicker {
  font-size: clamp(0.7rem, 1.1vw, 0.9rem);
}

body.cinema-mode .lecture-caption-ribbon {
  margin: 0.4rem clamp(1rem, 6vw, 5rem) 0.5rem;
  padding: 0.6rem 1.25rem;
  font-size: clamp(0.95rem, 1.7vw, 1.35rem);
  line-height: 1.45;
  position: relative;
  z-index: 25;
}

body.cinema-live .cinema-wave {
  display: flex !important;
  position: fixed;
  left: 50%;
  bottom: 0.85rem;
  z-index: 90;
  transform: translateX(-50%);
  width: min(1080px, 90vw);
  height: 48px;
  align-items: center;
  justify-content: center;
  gap: 0.2rem;
  padding: 0 1.25rem;
  border-radius: 1rem;
  border: 1px solid rgba(16, 185, 129, 0.28);
  background: rgba(2, 6, 23, 0.85);
  box-shadow: 0 14px 40px -18px rgba(0, 0, 0, 0.9), 0 0 30px -10px rgba(16, 185, 129, 0.25);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  cursor: pointer;
  overflow: hidden;
}

/* Cinema mode keeps the room calm: no hover chrome */
body.cinema-live #slideStageMainCard {
  cursor: none;
}

/* ============================================================== */
/* COMPACT RESPONSIVE NAVIGATION                                   */
/* ============================================================== */

.sticky-module-nav {
  position: sticky;
  top: 4rem;
  z-index: 30;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  background-color: rgba(7, 8, 13, 0.94);
  transition: top 0.25s ease;
}

body.header-hidden .sticky-module-nav {
  top: 0 !important;
}

@media (max-width: 767px) {
  .module-tab-btn {
    padding: 0.5rem 0.55rem !important;
    border-radius: 0.7rem !important;
  }

  .module-tab-label {
    display: none;
  }

  .module-tab-btn i,
  .module-tab-btn svg {
    width: 1.05rem;
    height: 1.05rem;
  }

  .lecture-cinema-stage {
    min-height: 300px;
  }

  .lecture-caption-ribbon {
    min-height: 2.9rem;
    margin: 0.35rem 0.65rem 0.45rem;
    padding: 0.45rem 0.65rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .scene-layer,
  .scene-title,
  .scene-kicker,
  .scene-insight,
  .lecture-caption-ribbon {
    animation: none !important;
    transition-duration: 0.01ms !important;
  }
}
