/* ============================================================
   DESIGN SYSTEM — Training Course Website
   ============================================================
   A comprehensive, production-ready CSS design system.
   Mobile-first, RTL-aware, dark-mode ready.
   ============================================================ */


/* ============================================================
   §1  DESIGN TOKENS (Custom Properties)
   ============================================================ */

:root {
  /* ---- Light Mode Colors (Bright Luxury Ivory & Vibrant Burgundy) ---- */
  --color-bg: #FDFBF8;
  --color-surface: #FFFFFF;
  --color-primary: #8A1732;
  --color-primary-hover: #6B0F24;
  --color-accent: #B82948;
  --color-text: #1F191B;
  --color-text-muted: #6E6568;
  --color-border: rgba(138, 23, 50, 0.14);
  --color-glow: rgba(184, 41, 72, 0.15);

  /* ---- Typography ---- */
  --font-display: 'Amiri', serif;
  --font-editorial: 'Cormorant Garamond', serif;
  --font-body: 'IBM Plex Sans Arabic', sans-serif;

  /* ---- Spacing Scale ---- */
  --space-2xs: 0.125rem;
  --space-xs: 0.25rem;
  --space-sm: 0.5rem;
  --space-md: 1rem;
  --space-lg: 1.5rem;
  --space-xl: 2rem;
  --space-2xl: 3rem;
  --space-3xl: 4rem;
  --space-4xl: 6rem;

  /* ---- Motion ---- */
  --ease-spring: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in-out: cubic-bezier(0.4, 0, 0.2, 1);
  --dur-fast: 180ms;
  --dur-normal: 320ms;
  --dur-slow: 560ms;
  --dur-entrance: 800ms;

  /* ---- Radius ---- */
  --radius-sm: 6px;
  --radius-md: 12px;
  --radius-lg: 20px;
  --radius-pill: 100px;

  /* ---- Glass ---- */
  --glass-blur: blur(16px);
  --glass-bg-light: rgba(253, 251, 248, 0.78);
  --glass-bg-dark: rgba(26, 18, 21, 0.78);
  --glass-bg: var(--glass-bg-light);

  /* ---- Safe Areas ---- */
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
}

/* ---- Dark Mode Tokens (Warm Velvet Plum, softer & brighter than pure black) ---- */
[data-theme="dark"] {
  --color-bg: #1A1215;
  --color-surface: rgba(34, 24, 28, 0.85);
  --color-primary: #D4385B;
  --color-primary-hover: #B82948;
  --color-accent: #E04F6E;
  --color-text: #FAF6F3;
  --color-text-muted: #B8ACB0;
  --color-border: rgba(255, 255, 255, 0.13);
  --color-glow: rgba(212, 56, 91, 0.2);
  --glass-bg: var(--glass-bg-dark);
}


/* ============================================================
   §2  RESET & BASE
   ============================================================ */

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

/* CRITICAL: 16px base prevents iOS auto-zoom on input focus */
html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  -moz-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  font-family: var(--font-body);
  background: var(--color-bg);
  color: var(--color-text);
  direction: rtl;
  min-height: 100dvh;
  overflow-x: clip;
  line-height: 1.6;
  transition:
    background var(--dur-normal) var(--ease-in-out),
    color var(--dur-normal) var(--ease-in-out);
  -webkit-tap-highlight-color: transparent;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Selection */
::selection {
  background: rgba(107, 15, 36, 0.2);
  color: var(--color-text);
}

[data-theme="dark"] ::selection {
  background: rgba(184, 41, 72, 0.3);
}

/* Media defaults */
img,
video,
iframe {
  max-width: 100%;
  height: auto;
  display: block;
}

/* Remove list styles */
ul,
ol {
  list-style: none;
}

/* Anchor reset */
a {
  color: inherit;
  text-decoration: none;
}

/* Button reset */
button {
  font: inherit;
  color: inherit;
  background: none;
  border: none;
  cursor: pointer;
}

/* Input reset */
input,
textarea,
select {
  font: inherit;
  color: inherit;
}

/* Remove default fieldset/legend */
fieldset {
  border: none;
}


/* ============================================================
   §3  TYPOGRAPHY
   ============================================================ */

.heading-display {
  font-family: var(--font-display);
  font-size: clamp(2rem, 5vw, 3.25rem);
  font-weight: 700;
  line-height: 1.35;
  color: var(--color-text);
  letter-spacing: -0.01em;
}

.heading-section {
  font-family: var(--font-display);
  font-size: clamp(1.5rem, 3.5vw, 2rem);
  font-weight: 700;
  line-height: 1.4;
  color: var(--color-text);
}

.text-body {
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.7;
  color: var(--color-text);
}

.text-muted {
  color: var(--color-text-muted);
  font-size: 0.875rem;
  line-height: 1.6;
}

.number-editorial {
  font-family: var(--font-editorial);
  font-weight: 300;
  font-size: clamp(2.5rem, 6vw, 4.5rem);
  line-height: 1;
  color: var(--color-primary);
  opacity: 0.25;
}


/* ============================================================
   §4  LAYOUT
   ============================================================ */

.container {
  max-width: 720px;
  margin-inline: auto;
  padding-inline: clamp(1.25rem, 4vw, 2rem);
  width: 100%;
}

.container--wide {
  max-width: 1080px;
}

.section {
  padding-block: var(--space-3xl);
}

/* Course page — 2-column layout on desktop, centered reels stack on mobile */
.course-layout {
  display: flex;
  flex-direction: column;
  gap: var(--space-lg);
  align-items: center;
  width: 100%;
}

@media (min-width: 960px) {
  .course-layout {
    display: grid;
    grid-template-columns: 440px 1fr;
    gap: var(--space-2xl);
    align-items: start;
    justify-content: center;
  }
}


/* ============================================================
   §5  GLASS HEADER (.site-header)
   ============================================================ */

.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  padding: var(--space-md) 0;
  padding-top: calc(var(--space-md) + var(--safe-top));
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  background: var(--glass-bg);
  border-bottom: 1px solid var(--color-border);
  transition:
    padding var(--dur-fast) var(--ease-out),
    border-color var(--dur-fast) var(--ease-out);
}

.header--scrolled {
  padding-top: calc(var(--space-sm) + 4px + var(--safe-top));
  padding-bottom: var(--space-sm);
  border-bottom-color: rgba(107, 15, 36, 0.22);
}

[data-theme="dark"] .header--scrolled {
  border-bottom-color: rgba(255, 255, 255, 0.14);
}

.header__inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.brand-mark {
  font-family: var(--font-display);
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--color-text);
  text-decoration: none;
  transition: color var(--dur-fast);
}

.brand-mark:hover {
  color: var(--color-primary);
}

.header__actions {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.header__greeting {
  font-size: 0.8125rem;
  color: var(--color-text-muted);
}

.header__progress-text {
  font-family: var(--font-editorial);
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--color-primary);
  padding: 0.2rem 0.6rem;
  background: rgba(107, 15, 36, 0.08);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-pill);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

[data-theme="dark"] .header__progress-text {
  color: #FF85A0;
  background: rgba(184, 41, 72, 0.15);
}


/* ============================================================
   §6  PROGRESS BAR (.progress-track)
   ============================================================ */

.progress-track {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  z-index: 99;
  background: var(--color-border);
}

.progress-track__bar {
  height: 100%;
  background: var(--color-primary);
  width: 0%;
  transition: width var(--dur-slow) var(--ease-spring);
  will-change: width;
}


/* ============================================================
   §7  THEME TOGGLE (.theme-toggle)
   ============================================================ */

.theme-toggle {
  position: relative;
  width: 44px;
  height: 44px;
  min-width: 44px;
  min-height: 44px;
  border-radius: 50%;
  background: transparent;
  border: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition:
    border-color var(--dur-fast),
    background var(--dur-fast);
}

.theme-toggle:hover {
  border-color: var(--color-primary);
  background: rgba(107, 15, 36, 0.06);
}

[data-theme="dark"] .theme-toggle:hover {
  background: rgba(184, 41, 72, 0.1);
}

.theme-toggle .icon-sun,
.theme-toggle .icon-moon {
  position: absolute;
  width: 20px;
  height: 20px;
  transition:
    opacity var(--dur-normal) var(--ease-out),
    transform var(--dur-normal) var(--ease-out);
}

/* Light mode: show sun, hide moon */
.theme-toggle .icon-sun {
  opacity: 1;
  transform: rotate(0) scale(1);
}

.theme-toggle .icon-moon {
  opacity: 0;
  transform: rotate(45deg) scale(0.6);
}

/* Dark mode: hide sun, show moon */
[data-theme="dark"] .theme-toggle .icon-sun {
  opacity: 0;
  transform: rotate(-45deg) scale(0.6);
}

[data-theme="dark"] .theme-toggle .icon-moon {
  opacity: 1;
  transform: rotate(0) scale(1);
}


/* ============================================================
   §8  HERO SECTION (.hero)
   ============================================================ */

.hero {
  text-align: center;
  padding-top: var(--space-3xl);
  padding-bottom: var(--space-xl);
}

.hero__title {
  font-family: var(--font-display);
  font-size: clamp(2rem, 5vw, 3.25rem);
  font-weight: 700;
  line-height: 1.35;
  color: var(--color-text);
  letter-spacing: -0.01em;
}

.hero__subtitle {
  color: var(--color-text-muted);
  font-size: clamp(1rem, 2.5vw, 1.25rem);
  line-height: 1.6;
  max-width: 480px;
  margin-inline: auto;
  margin-top: var(--space-md);
}


/* ============================================================
   §9  TEXT REVEAL ANIMATION (.reveal-line)
   ============================================================ */

.reveal-line {
  overflow: hidden;
  display: block;
}

.reveal-line__inner {
  display: block;
  transform: translateY(105%);
  transition: transform var(--dur-entrance) var(--ease-spring);
}

.reveal-line.is-visible .reveal-line__inner {
  transform: translateY(0);
}


/* ============================================================
   §10  VIDEO PLAYER FRAME (.video-frame)
   ============================================================ */

.video-frame {
  position: relative;
  margin-inline: auto;
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--color-border);
  background: #000;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.35);
}

/* مقاس ريلز طولي حقيقي بنسبة 9:16 ثابتة وأنيقة لا تنضغط أبداً ومخصصة تماماً لشاشات الجوال */
.video-frame--vertical {
  aspect-ratio: 9 / 16;
  width: 100%;
  max-width: min(390px, 92vw);
  height: auto;
  max-height: calc(85dvh - 80px);
  margin-inline: auto;
  border-radius: var(--radius-lg);
  box-shadow: 0 16px 44px rgba(0, 0, 0, 0.4);
}

.video-frame--widescreen {
  aspect-ratio: 16 / 9;
  width: 100%;
  max-width: 680px;
  margin-inline: auto;
}

#intro-player-container,
#player-container {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}

.video-frame video,
.video-frame iframe,
#intro-player-container video,
#player-container video,
#intro-player-container iframe,
#player-container iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100% !important;
  height: 100% !important;
  border: 0;
  display: block;
  object-fit: contain;
}

/* Ambient glow — VERY subtle */
.video-frame__glow {
  position: absolute;
  inset: -20%;
  border-radius: 50%;
  background: radial-gradient(
    circle,
    var(--color-glow) 0%,
    transparent 70%
  );
  z-index: -1;
  opacity: 0.3;
  pointer-events: none;
  animation: breathe 6s ease-in-out infinite;
}

[data-theme="dark"] .video-frame__glow {
  opacity: 0.7;
}


/* ============================================================
   §11  FORM CARD (.form-card)
   ============================================================ */

.form-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-2xl);
  max-width: 440px;
  margin-inline: auto;
  width: 100%;
}

.form-card__header {
  text-align: center;
  margin-bottom: var(--space-xl);
}

.form-card__title {
  font-family: var(--font-display);
  font-size: clamp(1.5rem, 4vw, 1.875rem);
  font-weight: 700;
  color: var(--color-text);
  line-height: 1.3;
}

.form-card__subtitle {
  font-size: 0.875rem;
  color: var(--color-text-muted);
  margin-top: var(--space-xs);
}


/* ============================================================
   §12  FORM INPUTS (.form-group, .form-input, .form-label)
   ============================================================ */

.form-group {
  position: relative;
  margin-bottom: var(--space-lg);
}

/* CRITICAL: font-size 1rem (16px) prevents iOS auto-zoom */
.form-input {
  width: 100%;
  font-size: 1rem;
  padding: 0.875rem 1rem;
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  color: var(--color-text);
  font-family: var(--font-body);
  outline: none;
  transition:
    border-color var(--dur-fast),
    box-shadow var(--dur-fast);
}

.form-input::placeholder {
  color: transparent;
}

.form-input:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(107, 15, 36, 0.1);
}

[data-theme="dark"] .form-input:focus {
  box-shadow: 0 0 0 3px rgba(184, 41, 72, 0.15);
}

/* Dark mode: slightly elevated input background */
[data-theme="dark"] .form-input {
  background: rgba(30, 24, 26, 0.9);
}

/* Floating label */
.form-label {
  position: absolute;
  top: 50%;
  right: 1rem;
  transform: translateY(-50%);
  font-size: 0.9375rem;
  color: var(--color-text-muted);
  pointer-events: none;
  background: var(--color-surface);
  padding-inline: 4px;
  transition: all var(--dur-fast) var(--ease-out);
  line-height: 1;
}

.form-input:focus ~ .form-label,
.form-input:not(:placeholder-shown) ~ .form-label {
  top: 0;
  transform: translateY(-50%);
  font-size: 0.75rem;
  color: var(--color-primary);
}


/* ============================================================
   §13  BUTTONS (.btn, .btn--primary)
   ============================================================ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  font-family: var(--font-body);
  font-size: 1rem;
  font-weight: 600;
  padding: 0.875rem 2rem;
  border-radius: var(--radius-pill);
  border: none;
  cursor: pointer;
  min-height: 48px;
  position: relative;
  overflow: hidden;
  transition:
    transform var(--dur-fast),
    box-shadow var(--dur-fast),
    background var(--dur-fast);
  -webkit-user-select: none;
  user-select: none;
}

.btn--primary {
  background: var(--color-primary);
  color: #fff;
}

.btn--primary:hover {
  background: var(--color-primary-hover);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(107, 15, 36, 0.2);
}

[data-theme="dark"] .btn--primary:hover {
  box-shadow: 0 8px 24px rgba(184, 41, 72, 0.25);
}

.btn--primary:active {
  transform: scale(0.98) translateY(0);
  box-shadow: none;
}

/* Light sheen sweep */
.btn--primary::after {
  content: '';
  position: absolute;
  top: 0;
  right: -100%;
  width: 60%;
  height: 100%;
  background: linear-gradient(
    105deg,
    transparent 30%,
    rgba(255, 255, 255, 0.15) 50%,
    transparent 70%
  );
  transition: right 0.6s var(--ease-out);
  pointer-events: none;
}

.btn--primary:hover::after {
  right: 150%;
}

/* Loading state */
.btn--loading {
  pointer-events: none;
  opacity: 0.85;
}


/* ============================================================
   §14  SPINNER (.spinner)
   ============================================================ */

.spinner {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  flex-shrink: 0;
}


/* ============================================================
   §15  COURSE OUTLINE PREVIEW (.outline)
   ============================================================ */

.outline {
  width: 100%;
}

.outline__item {
  display: flex;
  align-items: baseline;
  gap: var(--space-lg);
  padding-block: var(--space-lg);
}

.outline__number {
  font-family: var(--font-editorial);
  font-weight: 300;
  font-size: clamp(2.5rem, 6vw, 4.5rem);
  line-height: 1;
  color: var(--color-primary);
  opacity: 0.25;
  flex-shrink: 0;
  width: 3rem;
  text-align: left;
}

.outline__content {
  flex: 1;
  min-width: 0;
}

.outline__title {
  font-family: var(--font-display);
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--color-text);
  line-height: 1.4;
}

.outline__desc {
  font-size: 0.875rem;
  color: var(--color-text-muted);
  margin-top: 2px;
  line-height: 1.6;
}


/* ============================================================
   §16  HAIRLINE DIVIDERS (.hairline)
   ============================================================ */

.hairline {
  height: 1px;
  background: var(--color-border);
  transform: scaleX(0);
  transform-origin: right;  /* RTL: draw from right */
  transition: transform var(--dur-slow) var(--ease-spring);
  border: none;
}

.hairline--drawn {
  transform: scaleX(1);
}


/* ============================================================
   §17  RETURNING USER BANNER (.return-banner)
   ============================================================ */

.return-banner {
  position: fixed;
  top: calc(var(--space-xl) + var(--safe-top) + 60px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 50;
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  background: var(--glass-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-pill);
  padding: var(--space-sm) var(--space-lg);
  display: flex;
  align-items: center;
  gap: var(--space-md);
  max-width: 90%;
  margin-inline: auto;
  font-size: 0.875rem;
  color: var(--color-text);
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.08);
  animation: fadeRise var(--dur-entrance) var(--ease-spring);
}

.return-banner a {
  color: var(--color-primary);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.return-banner a:hover {
  color: var(--color-primary-hover);
}


/* ============================================================
   §18  LESSON LIST (.lesson-list & .sidebar-header)
   ============================================================ */

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

.sidebar-header__title {
  font-family: var(--font-display);
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--color-text);
}

.sidebar-header__badge {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.15rem 0.55rem;
  border-radius: var(--radius-pill);
  background: rgba(107, 15, 36, 0.08);
  color: var(--color-primary);
  border: 1px solid var(--color-border);
}

[data-theme="dark"] .sidebar-header__badge {
  background: rgba(184, 41, 72, 0.15);
  color: #FF85A0;
}

.lesson-list {
  display: flex;
  flex-direction: column;
}

.lesson-item {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-md) var(--space-lg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  cursor: pointer;
  margin-bottom: var(--space-sm);
  min-height: 44px;
  position: relative;
  transition:
    border-color var(--dur-fast),
    background var(--dur-fast),
    box-shadow var(--dur-fast),
    opacity var(--dur-fast);
}

.lesson-item:hover:not(.lesson-item--locked) {
  border-color: var(--color-primary);
  background: rgba(107, 15, 36, 0.03);
}

[data-theme="dark"] .lesson-item:hover:not(.lesson-item--locked) {
  background: rgba(184, 41, 72, 0.06);
}

/* Active lesson */
.lesson-item--active {
  border-color: var(--color-primary);
  background: rgba(107, 15, 36, 0.06);
  box-shadow: 0 0 0 1px var(--color-primary);
}

[data-theme="dark"] .lesson-item--active {
  background: rgba(184, 41, 72, 0.1);
}

/* Locked lesson */
.lesson-item--locked {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Completed lesson */
.lesson-item--completed {
  opacity: 0.7;
}

.lesson-item__number {
  font-family: var(--font-editorial);
  font-size: 1.25rem;
  font-weight: 300;
  color: var(--color-primary);
  opacity: 0.4;
  min-width: 2rem;
  text-align: center;
  flex-shrink: 0;
}

.lesson-item__title {
  font-size: 0.9375rem;
  font-weight: 500;
  flex: 1;
  min-width: 0;
}

.lesson-item__icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}


/* ============================================================
   §19  LOCK / UNLOCK / CHECK ICONS
   ============================================================ */

.icon-lock,
.icon-unlock,
.icon-check {
  width: 20px;
  height: 20px;
}

.icon-lock {
  color: var(--color-text-muted);
}

.icon-unlock {
  color: var(--color-primary);
  animation: unlock-pop 0.4s var(--ease-spring);
}

.icon-check {
  color: var(--color-primary);
}

/* Shake animation for locked tap */
.lesson-item--shake {
  animation: shake 0.4s var(--ease-spring);
}

/* Glow pulse for newly unlocked */
.lesson-item--glow {
  animation: glow-pulse 1s var(--ease-out);
}


/* ============================================================
   §20  PROMPT BOX (.prompt-box)
   ============================================================ */

.prompt-box {
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--space-lg);
  margin-top: var(--space-lg);
}

[data-theme="dark"] .prompt-box {
  background: rgba(26, 21, 23, 0.9);
}

.prompt-box__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-md);
}

.prompt-box__label {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.prompt-box__copy {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-xs);
  min-width: 44px;
  min-height: 44px;
  padding: var(--space-xs) var(--space-sm);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--color-text-muted);
  font-size: 0.75rem;
  cursor: pointer;
  transition:
    border-color var(--dur-fast),
    color var(--dur-fast),
    background var(--dur-fast);
}

.prompt-box__copy:hover {
  border-color: var(--color-primary);
  color: var(--color-primary);
  background: rgba(107, 15, 36, 0.04);
}

[data-theme="dark"] .prompt-box__copy:hover {
  background: rgba(184, 41, 72, 0.08);
}

.prompt-box__content {
  font-size: 0.875rem;
  line-height: 1.8;
  color: var(--color-text);
  white-space: pre-wrap;
  direction: rtl;
  max-height: 200px;
  overflow-y: auto;
  padding-left: var(--space-xs);
}


/* ============================================================
   §21  TOAST SYSTEM (.toast-container, .toast)
   ============================================================ */

.toast-container {
  position: fixed;
  bottom: calc(var(--space-xl) + var(--safe-bottom));
  left: 50%;
  transform: translateX(-50%);
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  align-items: center;
  pointer-events: none;
}

.toast {
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  background: var(--glass-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-pill);
  padding: var(--space-sm) var(--space-lg);
  font-size: 0.875rem;
  color: var(--color-text);
  opacity: 0;
  transform: translateY(16px) scale(0.96);
  transition: all var(--dur-normal) var(--ease-spring);
  pointer-events: auto;
  white-space: nowrap;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
}

.toast--visible {
  opacity: 1;
  transform: translateY(0) scale(1);
}


/* ============================================================
   §22  NEXT LESSON BUTTON (.btn-next-lesson)
   ============================================================ */

.btn-next-lesson {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  font-family: var(--font-body);
  font-size: 0.9375rem;
  font-weight: 600;
  padding: 0.75rem 1.5rem;
  border-radius: var(--radius-pill);
  border: none;
  cursor: pointer;
  min-height: 44px;
  background: var(--color-primary);
  color: #fff;
  position: relative;
  overflow: hidden;

  /* Initially hidden */
  opacity: 0;
  transform: translateY(8px);
  pointer-events: none;
  transition:
    opacity var(--dur-normal) var(--ease-spring),
    transform var(--dur-normal) var(--ease-spring),
    background var(--dur-fast),
    box-shadow var(--dur-fast);
}

.btn-next-lesson--visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.btn-next-lesson:hover {
  background: var(--color-primary-hover);
  box-shadow: 0 6px 20px rgba(107, 15, 36, 0.18);
}

[data-theme="dark"] .btn-next-lesson:hover {
  box-shadow: 0 6px 20px rgba(184, 41, 72, 0.22);
}


/* ============================================================
   §23  KEYFRAME ANIMATIONS
   ============================================================ */

@keyframes breathe {
  0%,
  100% {
    opacity: 0.3;
    transform: scale(1);
  }
  50% {
    opacity: 0.5;
    transform: scale(1.05);
  }
}

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

@keyframes shake {
  0%,
  100% {
    transform: translateX(0);
  }
  20%,
  60% {
    transform: translateX(-4px);
  }
  40%,
  80% {
    transform: translateX(4px);
  }
}

@keyframes glow-pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(107, 15, 36, 0.3);
  }
  100% {
    box-shadow: 0 0 0 12px rgba(107, 15, 36, 0);
  }
}

@keyframes unlock-pop {
  0% {
    transform: scale(0.5) rotate(-15deg);
    opacity: 0;
  }
  100% {
    transform: scale(1) rotate(0);
    opacity: 1;
  }
}

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


/* ============================================================
   §24  SCROLL-TRIGGERED ENTRANCE ANIMATIONS ([data-animate])
   ============================================================ */

[data-animate] {
  opacity: 0;
  transform: translateY(24px);
  transition:
    opacity var(--dur-entrance) var(--ease-spring),
    transform var(--dur-entrance) var(--ease-spring);
}

[data-animate].is-visible {
  opacity: 1;
  transform: translateY(0);
}

/* Fade variant — just opacity, no movement */
[data-animate="fade"] {
  transform: none;
}

[data-animate="fade"].is-visible {
  opacity: 1;
}

/* Rise variant — standard vertical rise (default) */
[data-animate="rise"] {
  transform: translateY(24px);
}

[data-animate="rise"].is-visible {
  transform: translateY(0);
}

/* Scale variant */
[data-animate="scale"] {
  transform: scale(0.96);
}

[data-animate="scale"].is-visible {
  opacity: 1;
  transform: scale(1);
}


/* ============================================================
   §25  VIEW TRANSITION API
   ============================================================ */

::view-transition-old(root),
::view-transition-new(root) {
  animation-duration: 0.3s;
}


/* ============================================================
   §26  RESPONSIVE BREAKPOINTS
   ============================================================ */

/* ---- Course Page Mobile Optimizations (< 960px) ---- */
@media (max-width: 959px) {
  body:has(#lesson-list) main.section {
    padding-top: var(--space-md);
    padding-bottom: var(--space-3xl);
  }

  .course-layout__player {
    width: 100%;
    max-width: 420px;
    margin-inline: auto;
  }

  .course-layout__sidebar {
    width: 100%;
    max-width: 420px;
    margin-inline: auto;
    margin-top: var(--space-md);
  }

  .lesson-info {
    width: 100%;
    max-width: 420px;
    margin-inline: auto;
    padding: var(--space-md) var(--space-lg);
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
  }

  .btn-next-lesson {
    width: 100%;
    max-width: 420px;
    margin-inline: auto;
    min-height: 48px;
    font-size: 1rem;
    box-shadow: 0 4px 16px rgba(107, 15, 36, 0.2);
  }
}

/* ---- ≥ 640px: Tablet ---- */
@media (min-width: 640px) {
  .heading-display,
  .hero__title {
    font-size: clamp(2.25rem, 5vw, 3.25rem);
  }

  .heading-section {
    font-size: clamp(1.625rem, 3.5vw, 2rem);
  }

  .section {
    padding-block: var(--space-4xl);
  }

  .hero {
    padding-top: var(--space-4xl);
    padding-bottom: var(--space-2xl);
  }

  .form-card {
    padding: var(--space-3xl);
  }
}

/* ---- ≥ 960px: Desktop ---- */
@media (min-width: 960px) {
  .section {
    padding-block: calc(var(--space-4xl) + var(--space-xl));
  }

  .hero {
    padding-top: calc(var(--space-4xl) + var(--space-xl));
  }

  .container {
    padding-inline: 2rem;
  }

  .lesson-item {
    padding: var(--space-md) var(--space-xl);
  }
}

/* ---- ≥ 1200px: Large desktop ---- */
@media (min-width: 1200px) {
  .container {
    max-width: 760px;
  }

  .container--wide {
    max-width: 1140px;
  }
}


/* ============================================================
   §27  REDUCED MOTION
   ============================================================ */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  html {
    scroll-behavior: auto;
  }

  .video-frame__glow {
    animation: none;
    opacity: 0.3;
  }

  .reveal-line__inner {
    transform: none;
  }

  [data-animate] {
    opacity: 1;
    transform: none;
  }
}


/* ============================================================
   §28  DARK MODE SPECIFICS
   ============================================================ */

/* Video glow slightly brighter in dark */
/* (Already handled in §10 — [data-theme="dark"] .video-frame__glow) */

/* Buttons shadow adjustment */
[data-theme="dark"] .btn--primary {
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.3);
}

[data-theme="dark"] .btn--primary:active {
  box-shadow: none;
}

/* Form card surface */
[data-theme="dark"] .form-card {
  background: rgba(22, 17, 19, 0.85);
  border-color: rgba(255, 255, 255, 0.07);
}

/* Form label background matches elevated surface */
[data-theme="dark"] .form-label {
  background: rgba(22, 17, 19, 0.95);
}

/* Return banner shadow */
[data-theme="dark"] .return-banner {
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.3);
}

/* Toast shadow */
[data-theme="dark"] .toast {
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

/* Outline number */
[data-theme="dark"] .outline__number {
  opacity: 0.3;
}

/* Hairline slightly subtler in dark */
[data-theme="dark"] .hairline {
  background: rgba(255, 255, 255, 0.06);
}


/* ============================================================
   §29  iOS SAFE AREA HELPERS
   ============================================================ */

.safe-top {
  padding-top: var(--safe-top);
}

.safe-bottom {
  padding-bottom: var(--safe-bottom);
}

.safe-left {
  padding-left: var(--safe-left);
}

.safe-right {
  padding-right: var(--safe-right);
}


/* ============================================================
   §30  SCROLLBAR STYLING
   ============================================================ */

/* Thin scrollbar for prompt-box content */
.prompt-box__content::-webkit-scrollbar {
  width: 4px;
}

.prompt-box__content::-webkit-scrollbar-track {
  background: transparent;
  border-radius: 2px;
}

.prompt-box__content::-webkit-scrollbar-thumb {
  background: var(--color-border);
  border-radius: 2px;
}

.prompt-box__content::-webkit-scrollbar-thumb:hover {
  background: var(--color-text-muted);
}

/* Firefox scrollbar */
.prompt-box__content {
  scrollbar-width: thin;
  scrollbar-color: var(--color-border) transparent;
}

/* Lesson list scrollbar (if overflow needed) */
.lesson-list::-webkit-scrollbar {
  width: 4px;
}

.lesson-list::-webkit-scrollbar-track {
  background: transparent;
}

.lesson-list::-webkit-scrollbar-thumb {
  background: var(--color-border);
  border-radius: 2px;
}

.lesson-list {
  scrollbar-width: thin;
  scrollbar-color: var(--color-border) transparent;
}


/* ============================================================
   §31  UTILITY CLASSES
   ============================================================ */

/* Screen reader only */
.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;
}

/* Text alignment */
.text-center {
  text-align: center;
}

/* Margin-top utilities */
.mt-sm  { margin-top: var(--space-sm); }
.mt-md  { margin-top: var(--space-md); }
.mt-lg  { margin-top: var(--space-lg); }
.mt-xl  { margin-top: var(--space-xl); }
.mt-2xl { margin-top: var(--space-2xl); }
.mt-3xl { margin-top: var(--space-3xl); }

/* Margin-bottom utilities */
.mb-sm  { margin-bottom: var(--space-sm); }
.mb-md  { margin-bottom: var(--space-md); }
.mb-lg  { margin-bottom: var(--space-lg); }
.mb-xl  { margin-bottom: var(--space-xl); }
.mb-2xl { margin-bottom: var(--space-2xl); }
.mb-3xl { margin-bottom: var(--space-3xl); }

/* Width */
.w-full {
  width: 100%;
}

/* Flex helpers */
.flex-center {
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Hidden utility */
.hidden {
  display: none !important;
}

/* ============================================================
   §32  MOBILE-FIRST LUXURY MOTION & INTERACTIVE COMPONENTS
   ============================================================ */

/* ── 1. Hero Shimmer Badge ── */
.hero__badge-wrapper {
  display: flex;
  justify-content: center;
  margin-bottom: var(--space-md);
}

.hero__badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  padding: 0.35rem 0.95rem;
  background: rgba(107, 15, 36, 0.06);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-pill);
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--color-primary);
  letter-spacing: 0.02em;
  box-shadow: 0 2px 12px rgba(107, 15, 36, 0.06);
  position: relative;
  overflow: hidden;
}

[data-theme="dark"] .hero__badge {
  background: rgba(184, 41, 72, 0.12);
  border-color: rgba(184, 41, 72, 0.25);
  color: #FF85A0;
  box-shadow: 0 2px 16px rgba(184, 41, 72, 0.12);
}

.hero__badge::after {
  content: '';
  position: absolute;
  top: 0;
  left: -120%;
  width: 60%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(255, 255, 255, 0.35) 50%,
    transparent 100%
  );
  animation: badgeShimmer 3.6s infinite ease-in-out;
  pointer-events: none;
}

.badge-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background-color: var(--color-primary);
  display: inline-block;
  box-shadow: 0 0 0 0 rgba(107, 15, 36, 0.4);
  animation: badgePulse 2s infinite;
}

[data-theme="dark"] .badge-dot {
  background-color: #FF85A0;
  box-shadow: 0 0 0 0 rgba(255, 133, 160, 0.5);
}

@keyframes badgeShimmer {
  0% { left: -100%; }
  40%, 100% { left: 200%; }
}

@keyframes badgePulse {
  0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(107, 15, 36, 0.6); }
  70% { transform: scale(1.15); box-shadow: 0 0 0 6px rgba(107, 15, 36, 0); }
  100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(107, 15, 36, 0); }
}

/* ── 2. Outline Chips & Section Tag ── */
.section-badge-center {
  display: flex;
  justify-content: center;
  margin-bottom: var(--space-lg);
}

.section-tag {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--color-primary);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 0.25rem 0.75rem;
  background: rgba(107, 15, 36, 0.05);
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-border);
}

[data-theme="dark"] .section-tag {
  color: #FF85A0;
  background: rgba(184, 41, 72, 0.1);
}

.outline__meta {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  margin-bottom: 0.35rem;
}

.outline__chip {
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.15rem 0.55rem;
  border-radius: var(--radius-pill);
  background: rgba(107, 15, 36, 0.06);
  color: var(--color-primary);
  border: 1px solid var(--color-border);
}

[data-theme="dark"] .outline__chip {
  background: rgba(184, 41, 72, 0.15);
  color: #F5A3B5;
}

.outline__chip--time {
  background: transparent;
  color: var(--color-text-muted);
  border-color: var(--color-border);
}

.outline__item {
  transition: transform var(--dur-fast) var(--ease-out), background var(--dur-fast);
  border-radius: var(--radius-md);
  padding-inline: var(--space-sm);
}

.outline__item:hover {
  transform: translateX(-4px);
  background: rgba(107, 15, 36, 0.02);
}

[data-theme="dark"] .outline__item:hover {
  background: rgba(255, 255, 255, 0.02);
}

/* ── 3. Mobile Floating Sticky CTA Bar ── */
.mobile-sticky-cta {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 95;
  background: var(--glass-bg);
  -webkit-backdrop-filter: var(--glass-blur);
  backdrop-filter: var(--glass-blur);
  border-top: 1px solid var(--color-border);
  padding: 0.75rem 1rem calc(0.75rem + var(--safe-bottom));
  transform: translateY(120%);
  transition: transform 400ms var(--ease-spring), opacity 300ms ease;
  opacity: 0;
  pointer-events: none;
  box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.08);
}

[data-theme="dark"] .mobile-sticky-cta {
  box-shadow: 0 -8px 28px rgba(0, 0, 0, 0.4);
}

.mobile-sticky-cta.is-visible {
  transform: translateY(0);
  opacity: 1;
  pointer-events: auto;
}

.mobile-sticky-cta__inner {
  max-width: 600px;
  margin-inline: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-md);
}

.mobile-sticky-cta__info {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.mobile-sticky-cta__title {
  font-weight: 600;
  font-size: 0.9375rem;
  color: var(--color-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mobile-sticky-cta__subtitle {
  font-size: 0.775rem;
  color: var(--color-text-muted);
}

.btn--compact {
  padding: 0.6rem 1.25rem;
  min-height: 40px;
  font-size: 0.875rem;
  gap: var(--space-xs);
  flex-shrink: 0;
}

/* ── 4. Luxury Custom Video Overlay ── */
.custom-video-wrapper {
  cursor: pointer;
}

.video-custom-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.22);
  transition: opacity 300ms ease, visibility 300ms ease;
  z-index: 10;
  pointer-events: none;
}

.video-custom-overlay .video-play-pulse-btn {
  pointer-events: auto;
}

.video-loading-indicator {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 12;
  pointer-events: none;
  opacity: 0;
  transition: opacity 200ms ease;
}

.video-loading-indicator.is-active {
  opacity: 1;
}

.video-loading-indicator .spinner {
  width: 36px;
  height: 36px;
  border-width: 3px;
}

.video-custom-overlay.is-playing {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.video-play-pulse-btn {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: rgba(251, 249, 246, 0.88);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.6);
  color: #6B0F24;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.35);
  transition: transform 250ms var(--ease-spring), background 200ms ease;
  animation: playPulse 2.4s infinite;
  padding-left: 4px; /* visually center play icon */
}

[data-theme="dark"] .video-play-pulse-btn {
  background: rgba(22, 17, 19, 0.85);
  border-color: rgba(255, 255, 255, 0.15);
  color: #FF85A0;
}

.video-play-pulse-btn:hover {
  transform: scale(1.08);
}

.video-play-pulse-btn:active {
  transform: scale(0.92);
}

@keyframes playPulse {
  0% { box-shadow: 0 0 0 0 rgba(107, 15, 36, 0.4); }
  70% { box-shadow: 0 0 0 16px rgba(107, 15, 36, 0); }
  100% { box-shadow: 0 0 0 0 rgba(107, 15, 36, 0); }
}

/* ── 5. Mobile Story-Style Navigation Pills in course.html ── */
.mobile-story-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  margin-top: var(--space-md);
  padding: 0.5rem 0.25rem;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

/* On large desktop screens with visible sidebar, keep it clean or accessible */
@media (min-width: 992px) {
  .mobile-story-nav {
    display: none;
  }
}

.story-pill {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0.45rem 0.85rem;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-pill);
  cursor: pointer;
  font-family: var(--font-body);
  color: var(--color-text);
  font-size: 0.8125rem;
  font-weight: 500;
  transition: all var(--dur-fast) var(--ease-out);
}

.story-pill:active {
  transform: scale(0.95);
}

.story-pill__num {
  font-family: var(--font-editorial);
  font-size: 0.95rem;
  font-weight: 600;
}

.story-pill--active {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: #fff;
  box-shadow: 0 4px 14px rgba(107, 15, 36, 0.25);
}

[data-theme="dark"] .story-pill--active {
  background: #B82948;
  border-color: #B82948;
  box-shadow: 0 4px 16px rgba(184, 41, 72, 0.35);
}

.story-pill--completed {
  border-color: rgba(46, 125, 50, 0.3);
  color: #2E7D32;
  background: rgba(46, 125, 50, 0.08);
}

[data-theme="dark"] .story-pill--completed {
  border-color: rgba(76, 175, 80, 0.3);
  color: #81C784;
  background: rgba(76, 175, 80, 0.1);
}

.story-pill--locked {
  opacity: 0.45;
  cursor: not-allowed;
  background: rgba(0, 0, 0, 0.03);
}

[data-theme="dark"] .story-pill--locked {
  background: rgba(255, 255, 255, 0.03);
}

.story-pill__dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #fff;
  animation: badgePulse 1.8s infinite;
}

.story-pill__ring {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  border: 1.5px solid var(--color-text-muted);
}

.story-pill--shake {
  animation: shake 0.4s var(--ease-spring);
}

/* ── 6. Confetti Canvas ── */
.confetti-canvas {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  z-index: 9999;
  opacity: 0;
  transition: opacity 200ms ease;
}

.confetti-canvas.is-active {
  opacity: 1;
}

/* ── 7. Touch Feedback & Mobile Tap Polish ── */
button,
a,
.lesson-item,
.story-pill {
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.btn:active,
.theme-toggle:active {
  transform: scale(0.96) !important;
}

/* ── 8. Form Card Perks ── */
.form-card__perks {
  font-size: 0.75rem;
  text-align: center;
  margin-top: var(--space-md);
  line-height: 1.6;
}

/* ── 9. Lesson Tool Links (.lesson-tools, .tool-pill) ── */
.lesson-tools {
  margin-top: var(--space-md);
  padding-top: var(--space-md);
  border-top: 1px solid var(--color-border);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-sm);
}

.lesson-tools__label {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--color-text-muted);
}

.lesson-tools__list {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-xs);
}

.tool-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0.35rem 0.75rem;
  border-radius: var(--radius-pill);
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--color-primary);
  background: rgba(107, 15, 36, 0.06);
  border: 1px solid var(--color-border);
  transition: all var(--dur-fast) var(--ease-out);
}

.tool-pill:hover {
  background: var(--color-primary);
  color: #fff;
  transform: translateY(-1px);
}

[data-theme="dark"] .tool-pill {
  color: #FF85A0;
  background: rgba(184, 41, 72, 0.14);
}

[data-theme="dark"] .tool-pill:hover {
  background: #B82948;
  color: #fff;
}

/* ── 10. Outline Button (.btn--outline) ── */
.btn--outline {
  background: transparent;
  color: var(--color-primary);
  border: 1px solid var(--color-border);
}

.btn--outline:hover {
  border-color: var(--color-primary);
  background: rgba(107, 15, 36, 0.05);
}

[data-theme="dark"] .btn--outline {
  color: #FF85A0;
}

[data-theme="dark"] .btn--outline:hover {
  border-color: #B82948;
  background: rgba(184, 41, 72, 0.12);
}

/* ── 11. Final Challenge & Certificate Card ── */
.challenge-card {
  width: 100%;
  max-width: 420px;
  margin-inline: auto;
  padding: var(--space-lg);
  background: linear-gradient(145deg, rgba(107, 15, 36, 0.05), rgba(107, 15, 36, 0.01));
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  text-align: center;
}

[data-theme="dark"] .challenge-card {
  background: linear-gradient(145deg, rgba(184, 41, 72, 0.12), rgba(22, 17, 19, 0.85));
}

.challenge-card__badge {
  display: inline-block;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--color-primary);
  background: rgba(107, 15, 36, 0.08);
  border: 1px solid var(--color-border);
  padding: 0.25rem 0.75rem;
  border-radius: var(--radius-pill);
  margin-bottom: var(--space-sm);
}

[data-theme="dark"] .challenge-card__badge {
  color: #E6C687;
  background: rgba(230, 198, 135, 0.12);
  border-color: rgba(230, 198, 135, 0.25);
}

.challenge-card__title {
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--color-text);
  margin-bottom: var(--space-xs);
}

.challenge-card__desc {
  font-size: 0.875rem;
  line-height: 1.6;
  margin-bottom: var(--space-md);
}

.challenge-card__actions {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.btn--locked-cert {
  opacity: 0.65;
  filter: grayscale(0.35);
}

/* ── 12. Certificate Modal (.cert-modal) ── */
.cert-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-md);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 260ms ease, visibility 260ms ease;
}

.cert-modal.is-open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.cert-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(12, 9, 10, 0.75);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
}

.cert-modal__dialog {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 400px;
  max-height: 92dvh;
  overflow-y: auto;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.45);
  text-align: center;
  transform: translateY(16px) scale(0.97);
  transition: transform 320ms var(--ease-spring);
}

.cert-modal.is-open .cert-modal__dialog {
  transform: translateY(0) scale(1);
}

.cert-modal__close {
  position: absolute;
  top: 0.75rem;
  left: 0.75rem;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid var(--color-border);
  background: var(--color-bg);
  color: var(--color-text);
  font-size: 1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.cert-modal__title {
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 700;
  margin-bottom: 0.25rem;
}

.cert-modal__sub {
  font-size: 0.8125rem;
  margin-bottom: var(--space-md);
}

.cert-modal__preview {
  width: 100%;
  max-width: 240px;
  aspect-ratio: 9 / 16;
  margin-inline: auto;
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid var(--color-border);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.25);
  margin-bottom: var(--space-md);
}

.cert-modal__preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.cert-modal__actions {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

/* ── 13. Floating Unmute Pill for Smart Autoplay ── */
.video-unmute-pill {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 15;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0.45rem 0.9rem;
  background: rgba(12, 9, 10, 0.78);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: var(--radius-pill);
  color: #fff;
  font-family: var(--font-body);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-6px);
  transition: opacity 250ms ease, transform 250ms var(--ease-spring), visibility 250ms;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35);
}

.video-unmute-pill.is-visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
  animation: playPulse 2.4s infinite;
}

.video-unmute-pill:active {
  transform: scale(0.95);
}

/* ── 14. Admin Dashboard (admin.html) ── */
.admin-gate {
  max-width: 440px;
  margin-inline: auto;
  padding-top: var(--space-xl);
}

.admin-topbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-md);
  margin-bottom: var(--space-lg);
}

.admin-topbar__actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-xs);
}

.admin-stats {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-sm);
  margin-bottom: var(--space-lg);
}

@media (min-width: 768px) {
  .admin-stats {
    grid-template-columns: repeat(4, 1fr);
    gap: var(--space-md);
  }
}

.stat-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--space-md);
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.stat-card__label {
  font-size: 0.78rem;
  color: var(--color-text-muted);
}

.stat-card__value {
  font-size: 2rem;
  line-height: 1.1;
  color: var(--color-primary);
}

.admin-controls {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  margin-bottom: var(--space-lg);
}

@media (min-width: 768px) {
  .admin-controls {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }
}

.admin-search {
  flex: 1;
  max-width: 400px;
}

.admin-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.filter-chip {
  padding: 0.4rem 0.85rem;
  border-radius: var(--radius-pill);
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-text-muted);
  font-family: var(--font-body);
  font-size: 0.8125rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--dur-fast) var(--ease-out);
}

.filter-chip.is-active {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: #fff;
}

.admin-users-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

.user-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--space-md);
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.user-card__top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-sm);
}

.user-card__name {
  font-size: 1rem;
  font-weight: 700;
  color: var(--color-text);
}

.user-card__email {
  font-size: 0.8125rem;
  color: var(--color-text-muted);
  word-break: break-all;
}

.user-card__badges {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.user-badge {
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.2rem 0.55rem;
  border-radius: var(--radius-pill);
  background: rgba(138, 23, 50, 0.07);
  color: var(--color-text-muted);
  border: 1px solid var(--color-border);
}

.user-badge--pct {
  color: var(--color-primary);
  background: rgba(138, 23, 50, 0.1);
}

.user-delete-btn {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1px solid var(--color-border);
  background: transparent;
  color: var(--color-text-muted);
  cursor: pointer;
  font-size: 0.75rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.user-delete-btn:hover {
  background: rgba(200, 30, 50, 0.12);
  color: #c81e32;
}

.progress-segments {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 6px;
}

.progress-seg {
  height: 26px;
  border-radius: var(--radius-sm);
  background: rgba(138, 23, 50, 0.06);
  border: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-editorial);
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--color-text-muted);
}

.progress-seg.seg--done {
  background: rgba(46, 125, 50, 0.14);
  border-color: rgba(46, 125, 50, 0.4);
  color: #2E7D32;
}

[data-theme="dark"] .progress-seg.seg--done {
  color: #81C784;
}

.progress-seg.seg--current {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: #fff;
}

.user-card__meta {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: var(--space-xs);
  font-size: 0.78rem;
  color: var(--color-text-muted);
  padding-top: var(--space-xs);
  border-top: 1px solid var(--color-border);
}

.admin-empty {
  text-align: center;
  padding: var(--space-2xl);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
}

/* ── 15. Auth Tabs (Register / Resume on index.html) ── */
.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  padding: 4px;
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-pill);
  margin-bottom: var(--space-lg);
}

.auth-tab {
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius-pill);
  font-family: var(--font-body);
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--color-text-muted);
  cursor: pointer;
  transition: all var(--dur-fast) var(--ease-out);
  text-align: center;
}

.auth-tab.is-active {
  background: var(--color-primary);
  color: #fff;
  box-shadow: 0 2px 10px rgba(138, 23, 50, 0.22);
}

/* ── 16. Video Quality Selector (.video-quality-control) ── */
.video-quality-control {
  position: absolute;
  top: 14px;
  left: 14px;
  z-index: 16;
}

.video-quality-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 0.38rem 0.75rem;
  background: rgba(12, 9, 10, 0.72);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: var(--radius-pill);
  color: #fff;
  font-family: var(--font-body);
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform var(--dur-fast), background var(--dur-fast);
}

.video-quality-btn:active {
  transform: scale(0.95);
}

.video-quality-menu {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  min-width: 155px;
  background: rgba(18, 13, 15, 0.92);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: var(--radius-md);
  padding: 4px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.45);
  display: flex;
  flex-direction: column;
  gap: 2px;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-6px);
  transition: opacity 180ms ease, transform 180ms var(--ease-spring), visibility 180ms;
}

.video-quality-control.is-open .video-quality-menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.video-quality-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  padding: 0.45rem 0.65rem;
  border-radius: var(--radius-sm);
  color: #F5F0EC;
  font-family: var(--font-body);
  font-size: 0.78rem;
  font-weight: 500;
  cursor: pointer;
  text-align: right;
  transition: background 150ms ease;
}

.video-quality-option:hover {
  background: rgba(255, 255, 255, 0.1);
}

.video-quality-option.is-selected {
  background: rgba(212, 56, 91, 0.32);
  color: #fff;
  font-weight: 700;
}

.video-quality-option .q-tag {
  font-family: var(--font-editorial);
  font-size: 0.82rem;
  opacity: 0.85;
}

/* ── 17. Mandatory Email Consent Checkbox (.form-consent) ── */
.form-consent {
  margin-bottom: var(--space-lg);
}

.consent-label {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  cursor: pointer;
  -webkit-user-select: none;
  user-select: none;
  position: relative;
}

.consent-checkbox {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
  pointer-events: none;
}

.consent-box {
  width: 20px;
  height: 20px;
  min-width: 20px;
  margin-top: 2px;
  border-radius: 6px;
  border: 1.5px solid var(--color-border);
  background: var(--color-bg);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  transition: all var(--dur-fast) var(--ease-spring);
}

.consent-box svg {
  opacity: 0;
  transform: scale(0.5);
  transition: all var(--dur-fast) var(--ease-spring);
}

.consent-checkbox:checked + .consent-box {
  background: var(--color-primary);
  border-color: var(--color-primary);
  box-shadow: 0 2px 10px rgba(138, 23, 50, 0.25);
}

.consent-checkbox:checked + .consent-box svg {
  opacity: 1;
  transform: scale(1);
}

.consent-checkbox:focus-visible + .consent-box {
  box-shadow: 0 0 0 3px rgba(138, 23, 50, 0.2);
}

.consent-text {
  font-size: 0.8125rem;
  line-height: 1.55;
  color: var(--color-text-muted);
}

.consent-text strong {
  color: var(--color-text);
  font-weight: 600;
}

/* End of Luxury Components */

