/* jarchi weekly class (classes.js): the home page («ساخت کلاس»), the teacher's panel, the student's class page.
   The frame (.pg, .pg-head, link cards) is in pages.css. */

/* ---------- home ---------- */
.pg-home { display: flex; flex-direction: column; }
.pg-intro { margin: 4px 0 6px; }
.pg-title-2 { display: block; }
.pg-makebox > * + * { margin-top: 0; }
#class-new .btn { margin-top: 6px; }
#class-new h2 { font-size: 19px; }
.card.made {
  display: flex; gap: 12px; align-items: flex-start;
  background: var(--accent-soft); border-color: transparent; box-shadow: none;
}
.card.made h2 { color: var(--accent); margin-bottom: 2px; overflow-wrap: anywhere; }
.card.made .hint { margin: 0; color: var(--ink); }
.card.made .pg-done-mark { margin: 0; }
#class-open-panel { margin-bottom: 14px; }
#class-open-panel .pg-ic { width: 18px; height: 18px; }

.pg-oneoff { margin: 2px 0 18px; text-align: center; color: var(--muted); font-size: 15px; }
.pg-oneoff > p { margin: 0; }
.pg-oneoff .err:empty { display: none; }
.pg-oneoff-out:empty { display: none; }
.pg-oneoff-card { text-align: start; color: var(--ink); margin-top: 10px; }
.pg-oneoff-card > .hint { margin-bottom: 14px; }
.pg-linkblock { padding: 12px 0; border-top: 1px solid var(--line); }
.pg-linkblock h3 { display: flex; align-items: center; gap: 8px; font-size: 15px; margin: 0 0 2px; }
.pg-linkblock h3 .pg-ic { color: var(--accent); width: 18px; height: 18px; }
.pg-linkblock .hint { margin-bottom: 8px; }
.pg-oneoff-card > .btn { margin-top: 6px; }

.pg-points { list-style: none; padding: 0; margin: 0 0 18px; display: grid; gap: 10px; }
.pg-points li { display: flex; align-items: flex-start; gap: 12px; color: var(--ink); font-size: 15px; }
.pg-points .pg-ic {
  width: 36px; height: 36px; padding: 8px; border-radius: 12px;
  background: var(--accent-soft); color: var(--accent);
}
.pg-points span { padding-top: 6px; }

.pg-mine h2 { font-size: 16px; }
.mine { list-style: none; padding: 0; margin: 4px 0 0; }
.mine li { border-top: 1px solid var(--line); }
.mine li:first-child { border-top: 0; }
.mine a {
  display: flex; align-items: center; gap: 10px; min-height: 48px; padding: 6px 0;
  color: var(--ink); font-weight: 700; text-decoration: none;
}
.mine a > span:not(.pg-ic) { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mine a .pg-ic { color: var(--accent); }
.mine a .pg-go { color: var(--muted); width: 18px; height: 18px; }
.mine a:hover { color: var(--accent); }

@container (min-width: 860px) {
  .pg-home {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 460px);
    grid-template-areas: "intro make" "points make" "mine make" "oneoff make" ". make";
    grid-template-rows: auto auto auto auto 1fr;
    column-gap: 64px;
    align-items: start;
  }
  .pg-intro { grid-area: intro; margin-top: 36px; }
  .pg-points { grid-area: points; margin-top: 10px; }
  .pg-mine { grid-area: mine; }
  .pg-makebox { grid-area: make; }
  .pg-oneoff { grid-area: oneoff; text-align: start; }
  .pg-intro .pg-title { font-size: 36px; line-height: 1.4; }
}

/* ---------- the teacher's panel ---------- */
.pg-classhead { margin: 0 0 16px; }
.pg-classhead .pg-title { margin-bottom: 2px; }
.pg-classhead .pg-lede { margin: 0; }
.pg-loading { color: var(--muted); text-align: center; padding: 40px 0; }

.class-start { text-align: center; }
.class-start .pg-eyebrow { margin-bottom: 0; }
.class-start .lead { font-weight: 800; font-size: 20px; margin: 0 0 2px; line-height: 1.5; }
.class-start .hint { margin-bottom: 14px; }
.class-start .pj-box { text-align: start; margin-bottom: 16px; }
.class-start .bigbtn { min-height: 60px; font-size: 20px; }
.class-start[data-live="1"] { border-color: var(--accent-line); }
.class-start[data-live="1"] .lead { color: var(--accent); }
.class-start .err.quiet { margin: 10px 0 0; }
.pg-livepill {
  display: inline-flex; align-items: center; gap: 8px; margin: 0 0 6px;
  background: var(--accent-soft); color: var(--accent);
  border-radius: 999px; padding: 2px 12px; font-size: 13px; font-weight: 800;
}
.pg-livedot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; animation: pg-blink 1.6s ease-in-out infinite; }
@keyframes pg-blink { 50% { opacity: .35; } }
@media (prefers-reduced-motion: reduce) { .pg-livedot { animation: none; } }

.pg-keep { display: flex; gap: 12px; align-items: flex-start; background: transparent; box-shadow: none; }
.pg-keep > .pg-ic { color: var(--muted); margin-top: 2px; }
.pg-keep b { display: block; font-size: 15px; }
.pg-keep .hint { margin: 2px 0 0; }

.pg-cardhead { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 4px; }
.pg-cardhead h2 { margin: 0; }
.sessions { list-style: none; padding: 0; margin: 8px 0 0; }
.sessions > li {
  display: grid; grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas: "head head" "info acts" "recs recs" "err err";
  gap: 4px 12px; align-items: center;
  padding: 14px 0; border-top: 1px solid var(--line);
}
.sessions > li:first-child { border-top: 0; padding-top: 6px; }
.s-head { grid-area: head; display: flex; flex-direction: column; min-width: 0; }
.s-head b { font-size: 16px; }
.s-date { color: var(--muted); font-size: 14px; }
.s-info { grid-area: info; display: flex; flex-wrap: wrap; gap: 4px 18px; color: var(--ink); font-size: 14px; }
.s-len, .s-meta { display: inline-flex; align-items: center; gap: 6px; }
.s-info .pg-ic { width: 17px; height: 17px; color: var(--muted); }
.s-acts { grid-area: acts; display: flex; gap: 8px; }
.s-recs { grid-area: recs; list-style: none; padding: 0; margin: 6px 0 0; display: grid; gap: 8px; }
.sessions > li > .err { grid-area: err; }
.sessions .err.quiet { margin: 6px 0 0; }

/* A recording: [▶] name + time over the seek bar, «دانلود». */
.pg-rec {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 12px;
  background: var(--bg-sunken); border-radius: 14px; padding: 8px 10px;
}
.pg-play {
  appearance: none; border: 0; cursor: pointer;
  width: 44px; height: 44px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--accent); color: var(--accent-ink);
  touch-action: manipulation;
}
.pg-play .pg-ic { width: 20px; height: 20px; }
.pg-play:disabled { background: var(--line); color: var(--faint); cursor: default; }
@media (hover: hover) { .pg-play:where(:not(:disabled)):hover { background: var(--accent-strong); } }
.pg-rec-main { min-width: 0; }
.pg-rec-top { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 0 8px; }
.pg-rec:not([data-state="ready"]) { grid-template-columns: auto minmax(0, 1fr); }
.pg-rec-top b { font-size: 14px; }
.pg-rec-time { color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.pg-rec-note { color: var(--muted); font-size: 13px; }
.pg-rec[data-state="failed"] .pg-rec-note { color: var(--danger-ink); }
.pg-seek {
  -webkit-appearance: none; appearance: none;
  display: block; width: 100%; height: 44px; margin: -10px 0; background: transparent; cursor: pointer;
  accent-color: var(--accent);
}
.pg-seek:disabled { cursor: default; opacity: .6; }
.pg-seek::-webkit-slider-runnable-track { height: 4px; border-radius: 999px; background: var(--line); }
.pg-seek::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none; width: 16px; height: 16px; margin-top: -6px;
  border-radius: 50%; background: var(--accent); border: 2px solid var(--card);
}
.pg-seek::-moz-range-track { height: 4px; border-radius: 999px; background: var(--line); }
.pg-seek::-moz-range-progress { height: 4px; border-radius: 999px; background: var(--accent); }
.pg-seek::-moz-range-thumb { width: 14px; height: 14px; border-radius: 50%; background: var(--accent); border: 2px solid var(--card); }
.pg-seek:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
.pg-rec .btn.small { padding-inline: 12px; }
@container (max-width: 420px) {
  .pg-rec .btn.small > span:not(.pg-ic) { display: none; }
  .pg-rec .btn.small { width: 44px; padding: 0; }
}

@container (min-width: 860px) {
  .pg-panel {
    display: grid;
    grid-template-columns: minmax(0, 1.45fr) minmax(0, 1fr);
    grid-template-areas: "head head" "start link" "start keep" "sessions sessions";
    grid-template-rows: auto auto 1fr auto;
    column-gap: 20px;
    align-items: start;
  }
  .pg-classhead { grid-area: head; margin-bottom: 20px; }
  .class-start { grid-area: start; padding: 24px 28px; }
  .pg-panel > .pg-linkcard { grid-area: link; }
  .pg-keep { grid-area: keep; }
  #class-sessions { grid-area: sessions; padding: 20px 24px; }
  .sessions > li {
    grid-template-columns: minmax(0, 1.3fr) minmax(0, 1.2fr) auto;
    grid-template-areas: "head info acts" "recs recs recs" "err err err";
  }
  .s-head { flex-direction: row; align-items: baseline; gap: 12px; }
}

/* ---------- the student link ---------- */
.pg-classid { display: flex; gap: 14px; align-items: center; margin-bottom: 14px; }
.pg-classtile {
  flex: none; width: 52px; height: 52px; border-radius: 16px;
  display: grid; place-items: center;
  background: var(--accent-soft); color: var(--accent);
}
.pg-classtile .pg-ic { width: 26px; height: 26px; }
.pg-classid h1 { font-size: 21px; line-height: 1.45; margin: 0; font-weight: 800; overflow-wrap: anywhere; }
.pg-classid .hint { margin: 0; }

.status {
  display: flex; gap: 10px; align-items: flex-start;
  font-weight: 700; font-size: 15px;
  background: var(--hand); color: var(--hand-ink); border: 1px solid var(--hand-line);
  border-radius: 12px; padding: 10px 12px; margin: 0 0 16px;
}
.status:empty { display: none; }
.status b, .status span span { display: block; }
.status > span:last-child { min-width: 0; }
.status span span { font-weight: 400; font-size: 14px; margin-top: 2px; }
.status-dot { flex: none; width: 10px; height: 10px; margin-top: 8px; border-radius: 50%; background: currentColor; }
.status[data-state="live"] { background: var(--ok-soft); color: var(--ok-ink); border-color: var(--speak-line); }
.status[data-state="live"] .status-dot { animation: pg-blink 1.6s ease-in-out infinite; }

.class-wait { text-align: center; padding-block: 32px 24px; }
.class-wait h1 { font-size: 21px; line-height: 1.5; margin: 14px 0 6px; font-weight: 800; }
.class-wait .hint { margin: 0 auto 16px; max-width: 34ch; }
.class-wait .err { margin-top: 12px; }
.pulse {
  display: inline-block; width: 18px; height: 18px; border-radius: 50%; margin-top: 8px;
  background: var(--accent);
  box-shadow: 0 0 0 0 var(--accent-soft);
  animation: class-pulse 1.8s ease-out infinite;
}
@keyframes class-pulse {
  0% { box-shadow: 0 0 0 0 var(--accent-soft); }
  70% { box-shadow: 0 0 0 18px transparent; }
  100% { box-shadow: 0 0 0 0 transparent; }
}
@media (prefers-reduced-motion: reduce) { .pulse { animation: none; } }
.pg-facts {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px;
  margin: 0; text-align: start;
}
.pg-facts > div { background: var(--bg-sunken); border-radius: 12px; padding: 8px 12px; min-width: 0; }
.pg-facts dt { color: var(--muted); font-size: 12.5px; }
.pg-facts dd { margin: 0; font-weight: 700; overflow-wrap: anywhere; }
