/* public/css/ezlan-video-tutorial.css — پاپ‌آپ «آموزش ویدیویی»
   توکن‌ها از ezlan-tokens.css (روشن/تیره خودکار). پیشوند کلاس‌ها: vtp- */

html.vtp-lock {
  overflow: hidden;
}
.vtp-overlay {
  position: fixed;
  inset: 0;
  z-index: 58;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: var(--overlay);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.22s ease, visibility 0s linear 0.22s;
}
.vtp-overlay.is-open {
  opacity: 1;
  visibility: visible;
  transition: opacity 0.22s ease;
}
.vtp-modal {
  display: flex;
  flex-direction: column;
  width: min(1020px, 100%);
  max-height: min(94vh, 800px);
  max-height: min(94dvh, 800px);
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-3);
  overflow: hidden;
  transform: translateY(14px) scale(0.975);
  transition: transform 0.32s cubic-bezier(0.22, 1, 0.36, 1);
}
.vtp-overlay.is-open .vtp-modal {
  transform: none;
}
.vtp-modal *,
.vtp-modal *::before,
.vtp-modal *::after {
  box-sizing: border-box;
}
.vtp-modal button {
  font: inherit;
  color: inherit;
}

/* ---------- سربرگ ---------- */
.vtp-head {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 20px 24px 14px;
}
.vtp-head-text {
  flex: 1;
  min-width: 0;
}
.vtp-head h2 {
  margin: 0;
  font-size: 21px;
  font-weight: 800;
  line-height: 1.5;
}
.vtp-head p {
  margin: 2px 0 0;
  font-size: 14px;
  color: var(--ink-2);
  line-height: 1.8;
}
.vtp-close {
  flex: none;
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  cursor: pointer;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  transition: background-color 0.15s ease;
}
.vtp-close:hover {
  background: var(--surface-3);
}
.vtp-close svg {
  width: 18px;
  height: 18px;
}

/* ---------- بدنه ---------- */
.vtp-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 0 24px 18px;
  display: grid;
  grid-template-columns: minmax(0, 1.65fr) minmax(0, 1fr);
  gap: 18px 22px;
  align-items: start;
}
.vtp-player {
  grid-column: 1;
  min-width: 0;
}
.vtp-side {
  grid-column: 2;
  min-width: 0;
}
.vtp-after {
  grid-column: 1 / -1;
}

/* ---------- پلیر ---------- */
.vtp-stage {
  position: relative;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  color: #f2f4ee;
  background: #0b1210;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
}
.vtp-stage:fullscreen {
  border: 0;
  border-radius: 0;
  width: 100%;
  height: 100%;
}
.vtp-screen {
  position: relative;
  flex: 1;
  min-height: 0;
  aspect-ratio: 16 / 9;
  background: #000;
  cursor: pointer;
}
.vtp-stage:fullscreen .vtp-screen {
  aspect-ratio: auto;
}
.vtp-video {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #000;
}
.vtp-big {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 12px;
  background: linear-gradient(180deg, rgba(8, 16, 13, 0.12), rgba(8, 16, 13, 0.55));
  border: 0;
  cursor: pointer;
  opacity: 1;
  transition: opacity 0.25s ease;
}
.vtp-stage.is-playing .vtp-big,
.vtp-stage.is-started.is-playing .vtp-big {
  opacity: 0;
  pointer-events: none;
}
.vtp-stage.is-ended .vtp-big,
.vtp-stage.is-error .vtp-big {
  display: none;
}
.vtp-big-btn {
  position: relative;
  display: grid;
  place-items: center;
  width: 76px;
  height: 76px;
  border-radius: 50%;
  color: var(--on-accent);
  background: var(--accent);
  box-shadow: 0 10px 28px -8px rgba(0, 0, 0, 0.6);
  transition: transform 0.2s ease, background-color 0.2s ease;
}
.vtp-big:hover .vtp-big-btn {
  transform: scale(1.06);
  background: var(--accent-hover);
}
.vtp-big-btn::before,
.vtp-big-btn::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.55);
  animation: vtp-pulse 2.4s ease-out infinite;
}
.vtp-big-btn::after {
  animation-delay: 1.2s;
}
.vtp-big-btn svg {
  width: 30px;
  height: 30px;
  fill: currentColor;
  margin-inline-start: -3px; /* مثلث پلی از نظر بصری وسط بیفته */
}
.vtp-big-label {
  padding: 6px 14px;
  font-size: 14px;
  font-weight: 700;
  color: #f2f4ee;
  background: rgba(8, 16, 13, 0.62);
  border-radius: var(--r-pill);
}
.vtp-big-label small.vtp-dur {
  margin-inline-start: 6px;
  padding: 1px 8px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  background: rgba(255, 255, 255, 0.16);
  border-radius: var(--r-pill);
}
/* لودینگ بافر */
.vtp-spin {
  position: absolute;
  inset: 0;
  display: none;
  place-items: center;
  pointer-events: none;
}
.vtp-stage.is-buffering .vtp-spin {
  display: grid;
}
.vtp-spin i {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 3px solid rgba(255, 255, 255, 0.28);
  border-top-color: #fff;
  animation: vtp-rot 0.9s linear infinite;
}
/* پایان / خطا */
.vtp-end {
  position: absolute;
  inset: 0;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 16px;
  text-align: center;
  background: rgba(8, 16, 13, 0.82);
  animation: vtp-in 0.3s ease both;
}
.vtp-stage.is-ended .vtp-end,
.vtp-stage.is-error .vtp-end {
  display: flex;
}
.vtp-end-title {
  font-size: 17px;
  font-weight: 800;
}
.vtp-end-text {
  margin: -6px 0 0;
  max-width: 34ch;
  font-size: 13.5px;
  line-height: 1.8;
  opacity: 0.85;
}
.vtp-end-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
}
.vtp-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  padding: 0 18px;
  font-size: 14px;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-md);
  transition: background-color 0.15s ease, transform 0.15s ease;
}
.vtp-btn:hover {
  background: var(--surface-3);
}
.vtp-btn:active {
  transform: translateY(1px);
}
.vtp-btn.is-primary {
  color: var(--on-accent);
  background: var(--accent);
  border-color: var(--accent);
}
.vtp-btn.is-primary:hover {
  background: var(--accent-hover);
}
.vtp-btn svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* نوار کنترل (زیر تصویر؛ هیچ‌وقت روی ویدیو نمی‌افتد تا متن‌های داخل ویدیو دیده بشن) */
.vtp-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px 10px;
  background: #0b1210;
}
.vtp-ic {
  flex: none;
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  padding: 0;
  cursor: pointer;
  color: #f2f4ee;
  background: transparent;
  border: 0;
  border-radius: var(--r-sm);
  transition: background-color 0.15s ease;
}
.vtp-ic:hover {
  background: rgba(255, 255, 255, 0.12);
}
.vtp-ic svg {
  width: 20px;
  height: 20px;
  fill: currentColor;
}
.vtp-ic .i-pause,
.vtp-stage.is-playing .vtp-ic .i-play {
  display: none;
}
.vtp-stage.is-playing .vtp-ic .i-pause {
  display: block;
}
.vtp-time {
  flex: none;
  min-width: 82px;
  font-size: 12.5px;
  font-variant-numeric: tabular-nums;
  direction: rtl;
  color: rgba(242, 244, 238, 0.85);
  text-align: center;
}
.vtp-track {
  position: relative;
  flex: 1;
  min-width: 60px;
  height: 28px;
  display: flex;
  align-items: center;
  cursor: pointer;
  touch-action: none;
  outline-offset: 2px;
}
.vtp-rail {
  position: relative;
  width: 100%;
  height: 6px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.2);
  border-radius: var(--r-pill);
  transition: height 0.15s ease;
}
.vtp-track:hover .vtp-rail,
.vtp-track.is-drag .vtp-rail {
  height: 8px;
}
.vtp-fill {
  position: absolute;
  inset: 0;
  background: #8bb99a;
  border-radius: inherit;
  transform-origin: right center; /* RTL: از راست پر می‌شه */
  transform: scaleX(0);
}
.vtp-tick {
  position: absolute;
  top: 50%;
  width: 2px;
  height: 12px;
  margin-top: -6px;
  transform: translateX(50%);
  background: rgba(11, 18, 16, 0.9);
  pointer-events: none;
}
.vtp-thumb {
  position: absolute;
  top: 50%;
  width: 14px;
  height: 14px;
  background: #fff;
  border-radius: 50%;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.5);
  pointer-events: none;
  right: 0;
  transform: translate(50%, -50%);
}
.vtp-speed {
  direction: ltr;
  flex: none;
  width: auto;
  min-width: 46px;
  padding: 0 8px;
  font-size: 12.5px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

/* ---------- فهرست مراحل (فصل‌ها) ---------- */
.vtp-side h3 {
  margin: 0 0 10px;
  font-size: 15px;
  font-weight: 800;
}
.vtp-chaps {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 6px;
}
.vtp-chap {
  position: relative;
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  min-height: 46px;
  padding: 8px 12px;
  text-align: start;
  cursor: pointer;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  transition: border-color 0.18s ease, background-color 0.18s ease;
}
.vtp-chap::before {
  /* پیشرفت داخل همین مرحله */
  content: "";
  position: absolute;
  inset: auto 0 0 0;
  height: 3px;
  background: var(--accent);
  transform-origin: right center;
  transform: scaleX(var(--p, 0));
  opacity: 0;
}
.vtp-chap:hover {
  border-color: var(--accent-line);
}
.vtp-chap.is-active {
  border-color: var(--accent);
  background: var(--accent-soft);
}
.vtp-chap.is-active::before {
  opacity: 1;
}
.vtp-chap.is-done .vtp-num {
  color: var(--on-accent);
  background: var(--accent);
  border-color: var(--accent);
}
.vtp-num {
  flex: none;
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  font-size: 12.5px;
  font-weight: 800;
  color: var(--accent-ink);
  background: var(--accent-soft-2);
  border: 1px solid var(--accent-line);
  border-radius: 50%;
  transition: background-color 0.2s ease, color 0.2s ease;
}
.vtp-chap-text {
  flex: 1;
  min-width: 0;
  font-size: 13.5px;
  font-weight: 700;
  line-height: 1.6;
}
.vtp-chap-time {
  flex: none;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  color: var(--ink-3);
}

/* ---------- بعد از تماشا ---------- */
.vtp-after {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
  background: var(--accent-soft);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
}
.vtp-after svg {
  flex: none;
  width: 24px;
  height: 24px;
  margin-top: 2px;
  fill: none;
  stroke: var(--accent-ink);
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.vtp-after strong {
  display: block;
  font-size: 15px;
  font-weight: 800;
  line-height: 1.6;
}
.vtp-after p {
  margin: 2px 0 0;
  font-size: 13.5px;
  line-height: 1.85;
  color: var(--ink-2);
}

/* ---------- پایین: CTA همیشه در دسترس ---------- */
.vtp-foot {
  flex: none;
  padding: 12px 24px 14px;
  background: var(--surface);
  border-top: 1px solid var(--line);
}
.vtp-cta {
  width: 100%;
  min-height: 52px;
  font-size: 16px;
  font-weight: 800;
}
.vtp-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 0 6px;
  margin-top: 6px;
  font-size: 13px;
}
.vtp-links a,
.vtp-links button {
  min-height: 36px;
  padding: 4px 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--accent-ink);
  text-decoration: underline;
  text-underline-offset: 3px;
  background: none;
  border: 0;
  cursor: pointer;
}
.vtp-links span {
  color: var(--ink-3);
}

.vtp-sr {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

@keyframes vtp-pulse {
  from {
    opacity: 0.8;
    transform: scale(1);
  }
  to {
    opacity: 0;
    transform: scale(1.7);
  }
}
@keyframes vtp-rot {
  to {
    transform: rotate(360deg);
  }
}
@keyframes vtp-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

/* ---------- موبایل ---------- */
@media (max-width: 899px) {
  .vtp-body {
    grid-template-columns: minmax(0, 1fr);
    gap: 14px;
  }
  .vtp-player,
  .vtp-side,
  .vtp-after {
    grid-column: 1;
  }
}
@media (max-width: 639px) {
  .vtp-overlay {
    align-items: flex-end;
    padding: 0;
  }
  .vtp-modal {
    width: 100%;
    max-height: 95vh;
    max-height: 95dvh;
    border-radius: var(--r-lg) var(--r-lg) 0 0;
    border-bottom: 0;
    transform: translateY(40px);
  }
  .vtp-head {
    padding: 16px 16px 10px;
  }
  .vtp-head h2 {
    font-size: 18.5px;
  }
  .vtp-head p {
    font-size: 13px;
  }
  .vtp-body {
    padding: 0 16px 14px;
  }
  .vtp-big-btn {
    width: 62px;
    height: 62px;
  }
  .vtp-big-btn svg {
    width: 25px;
    height: 25px;
  }
  .vtp-big-label {
    font-size: 12.5px;
  }
  .vtp-bar {
    gap: 4px;
    padding: 4px 6px 6px;
  }
  .vtp-time {
    min-width: 66px;
    font-size: 11.5px;
  }
  .vtp-foot {
    padding: 10px 16px calc(12px + env(safe-area-inset-bottom, 0px));
  }
}

@media (prefers-reduced-motion: reduce) {
  .vtp-overlay,
  .vtp-modal,
  .vtp-big,
  .vtp-big-btn,
  .vtp-chap,
  .vtp-num,
  .vtp-rail,
  .vtp-end {
    transition: none !important;
    animation: none !important;
  }
  .vtp-big-btn::before,
  .vtp-big-btn::after,
  .vtp-spin i {
    animation: none !important;
  }
}
