/* jarchi recording (recording.js): the «در حال ضبط» badge in the class header (everyone), the teacher's «ضبط»
   tile among the class tools, its confirmation, and the «ضبط‌ها» list. The --rec tokens (style.css): recording is
   the danger family (red, a dot and the timer); paused waits in a calm amber (two bars instead of the dot). */

.rec:empty { display: none; }

/* The badge: calm but unmistakable, with a slow pulsing dot. */
.rec-badge {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 32px; padding: 4px 12px;
  border-radius: var(--r-pill);
  background: var(--rec-soft); color: var(--rec-ink);
  border: 1px solid var(--rec-line);
  font-weight: var(--fw-b); font-size: var(--fs-s); line-height: 1.4;
  animation: kit-fade var(--t-med) var(--ease);
  white-space: nowrap;
}
.rec-timer { font-variant-numeric: tabular-nums; font-weight: 700; direction: ltr; unicode-bidi: isolate; }
/* The page is RTL: the timer sits left of «در حال ضبط»; the rule separates them. */
.rec-timer { border-right: 1px solid var(--rec-line); padding-right: 8px; }

.rec-dot {
  flex: none; width: 8px; height: 8px; border-radius: 50%;
  background: var(--rec);
  animation: rec-pulse 1.6s ease-in-out infinite;
}
@keyframes rec-pulse { 50% { opacity: .35; } }
@media (prefers-reduced-motion: reduce) { .rec-dot { animation: none; } }
/* Paused (the recording lane's chip, data-state="paused"): calm amber, the dot becomes two still bars. */
.rec-badge[data-state="paused"] { background: var(--rec-paused-soft); color: var(--rec-paused-ink); border-color: var(--rec-paused-line); }
.rec-badge[data-state="paused"] .rec-timer { border-color: var(--rec-paused-line); }
.rec-badge[data-state="paused"] .rec-dot {
  width: 8px; height: 10px; border-radius: 1px; animation: none;
  background: linear-gradient(90deg, currentColor 0 35%, transparent 35% 65%, currentColor 65% 100%);
}

/* The tile (a .tool in style.css) and its toggle. */
.rec-tool .rec-dot { animation: none; width: 14px; height: 14px; background: var(--muted); }
.rec-tool[data-on="1"] .tool-ic { background: var(--danger); }
.rec-tool[data-on="1"] .tool-ic .rec-dot { background: var(--on-solid); animation: rec-pulse 1.6s ease-in-out infinite; }
.rec-tool[data-on="1"] small { color: var(--danger-ink); }
.btn.rec-toggle { flex: none; display: inline-flex; align-items: center; gap: 8px; color: var(--danger-ink); border-color: var(--danger-line); }
.rec-toggle .rec-dot { animation: none; }
.rec-toggle.on { background: var(--danger); color: var(--on-solid); border-color: var(--danger); }
.rec-toggle.on .rec-dot { background: var(--on-solid); border-radius: 2px; width: 9px; height: 9px; }
@media (hover: hover) {
  .btn.rec-toggle:where(:not(:disabled)):hover { background: var(--danger-soft); border-color: var(--danger); }
  .btn.rec-toggle.on:where(:not(:disabled)):hover { background: var(--danger-hover); }
}

.rec-below:empty { display: none; }
.rec-below .err:empty { display: none; }
.rec-confirm {
  margin-top: 12px;
  background: var(--danger-soft); border: 1px solid var(--danger-line);
  border-radius: var(--r); padding: 12px 14px;
}
.rec-confirm p { margin: 0 0 6px; }
.rec-confirm p:first-child { font-weight: 800; color: var(--danger-ink); }
.rec-confirm .hint { color: var(--ink); }
.rec-row { display: flex; gap: 8px; flex-wrap: wrap; }
.btn.rec-yes { background: var(--danger); color: var(--on-solid); }
@media (hover: hover) { .btn.rec-yes:where(:not(:disabled)):hover { background: var(--danger-hover); } }

/* The «ضبط‌ها» list (teacher). */
.rec-card { margin-bottom: 0; }
.rec-card h2 { margin-bottom: 8px; }
.rec-items { list-style: none; padding: 0; margin: 0; }
.rec-items li { padding: 10px 0; border-top: 1px solid var(--line); }
.rec-items li:first-child { border-top: 0; }
.rec-line { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.rec-meta { display: flex; flex-direction: column; min-width: 0; }
.rec-meta b { font-size: var(--fs-body); }
.rec-meta small { color: var(--muted); font-size: var(--fs-meta); }
.rec-items audio { display: block; width: 100%; margin-top: 8px; }
.rec-items audio[hidden] { display: none; }

/* A switch (recording.js's «این کلاس ضبط بشه» in the prep room; classes.js's «شاگردها ببینن» on a recording). */
.rec-switch {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; width: 100%; min-height: 44px; padding: 0;
  border: 0; background: transparent; color: var(--ink); font: inherit; font-weight: 600; cursor: pointer; text-align: start;
}
.rec-switch:disabled { cursor: default; opacity: .7; }
.rec-switch-track { position: relative; width: 40px; height: 24px; flex: none; border-radius: 12px; background: var(--line-strong); transition: background-color var(--t-fast, 120ms); }
.rec-switch-track i { position: absolute; top: 3px; right: 3px; width: 18px; height: 18px; border-radius: 50%; background: var(--knob); box-shadow: var(--shadow-1); transition: transform var(--t-fast, 120ms); }
.rec-switch[aria-checked="true"] .rec-switch-track { background: var(--accent); }
.rec-switch[aria-checked="true"] .rec-switch-track i { transform: translateX(-16px); }
.rec-switch:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: var(--r-sm); }
.rec-prep h2 { display: flex; align-items: center; gap: 8px; }
.rec-prep .hint { margin: 4px 0 0; line-height: 1.8; }
.rec-prep[hidden] { display: none; }
@media (prefers-reduced-motion: reduce) { .rec-switch-track, .rec-switch-track i { transition: none; } }

/* The top bar's recording chip (RECORD2.md): the teacher's control, a small menu under it; everyone else sees the
   badge. Recording is red; a pause is the calm amber of the warning family. */
.rec-head { position: relative; display: flex; align-items: center; }
.rec-head[hidden] { display: none; }
.rec-chip {
  display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 12px;
  border: 1px solid var(--line-strong); border-radius: var(--r-pill); background: transparent; color: var(--ink);
  font: inherit; font-size: var(--fs-s); font-weight: var(--fw-b); white-space: nowrap; cursor: pointer;
  transition: background-color var(--t-fast), border-color var(--t-fast);
}
.rec-chip .rec-dot { animation: none; }
.rec-chip[data-state="on"] { background: var(--rec-soft); color: var(--rec-ink); border-color: var(--rec-line); }
/* Recording: the dot pops in once and holds (motion.css; WCAG 2.2.2). Paused: calm amber, two still bars. */
.rec-chip[data-state="on"] .rec-dot { background: var(--rec); }
.rec-chip[data-state="paused"], .rec-badge[data-state="paused"] { background: var(--rec-paused-soft); color: var(--rec-paused-ink); border-color: var(--rec-paused-line); }
.rec-chip[data-state="paused"] .rec-dot, .rec-badge[data-state="paused"] .rec-dot {
  width: 8px; height: 10px; border-radius: 1px; animation: none;
  background: linear-gradient(90deg, currentColor 0 35%, transparent 35% 65%, currentColor 65% 100%);
}
@media (hover: hover) { .rec-chip:where(:not(:disabled)):hover { background: var(--bg-sunken); } .rec-chip[data-state="on"]:hover { background: var(--rec-soft); } }
.rec-chip:focus-visible, .rec-item:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.rec-menu {
  position: absolute; top: calc(100% + 8px); inset-inline-end: 0; z-index: 40; width: min(300px, calc(100vw - 24px));
  display: grid; gap: 6px; padding: 12px;
  background: var(--surface-raised); color: var(--ink); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow-2);
  animation: kit-fade var(--t-fast) var(--ease);
}
.rec-menu[hidden] { display: none; }
.rec-menu-title { margin: 0; font-weight: var(--fw-b); }
.rec-menu-note { margin: 0 0 4px; font-size: var(--fs-xs); color: var(--muted); line-height: 1.8; }
.rec-item {
  min-height: 44px; padding: 0 12px; border: 1px solid var(--line-strong); border-radius: var(--r-sm);
  background: transparent; color: var(--ink); font: inherit; font-weight: 600; cursor: pointer; text-align: center;
}
.rec-item[hidden] { display: none; }
.rec-item.danger { background: var(--danger); border-color: var(--danger); color: var(--on-solid); }
@media (hover: hover) { .rec-item:where(:not(:disabled)):hover { background: var(--bg-sunken); } .rec-item.danger:where(:not(:disabled)):hover { background: var(--danger-hover); } }
/* A phone: the chip keeps its dot and time; the menu says the rest. */
@media (max-width: 480px) {
  .rec-chip[data-state="on"] .rec-word, .rec-chip[data-state="paused"] .rec-word { display: none; }
  .rec-chip { padding: 0 10px; gap: 6px; }
}
@media (prefers-reduced-motion: reduce) { .rec-chip[data-state="on"] .rec-dot { animation: none; } }
