/* ════════════════════════════════════════════════
   BLOCK 3 CSS — DASHBOARD
   ════════════════════════════════════════════════ */

/* SPACE-1 (заход №2): отступы в этом файле идут по шкале --sp-*, сырых
   значений в padding/margin/gap не осталось — кроме микро-сдвигов 1–2px
   (`.stat-chip-unit`, `.session-meta`, `.rec-block-strip`, `.rec-info` /
   `.rec-ex-info` / `.stat-chip-content`, вертикаль `.rec-pr-badge`).
   Они лежат ниже нижней ступени шкалы (--sp-0-5 = 4px) и служат
   оптическому выравниванию строки, а не ритму блоков: поднять их до 4px
   значит разорвать «12» и «т» или растащить имя и причину внутри строки.
   То же решение принято в PP-4 (`.pp-goal-lbl-v2`) и в заходе №1 по
   `css/profile.css`.
   Межблочный ритм здесь --sp-2 (16), а не --sp-3 (24) как в профиле:
   это уже ступень шкалы, а не хардкод, и сведение двух экранов к одному
   ритму — вопрос к Gio, не побочный эффект перевода единиц. */

/* ── Hero ── */
.dash-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-2);
  background: linear-gradient(135deg, rgba(0, 230, 118, 0.06), rgba(139, 92, 246, 0.04));
  border: 1px solid rgba(0, 230, 118, 0.12);
  border-radius: var(--r-xl);
  padding: var(--sp-3) var(--sp-2);
  margin-bottom: var(--sp-2);
}
.dash-hero-label {
  font-size: var(--fs-1);
  font-weight: var(--fw-md);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--c-text-3);
  margin-bottom: var(--sp-0-5);
}
.dash-hero-title {
  font-size: var(--fs-5);
  font-weight: var(--fw-black);
  letter-spacing: -0.03em;
  color: var(--c-text-1);
  line-height: 1;
  margin-bottom: var(--sp-0-5);
}
.dash-hero-date {
  font-size: var(--fs-2);
  font-weight: var(--fw-md);
  color: var(--c-text-3);
}
.dash-cta {
  display: flex;
  align-items: center;
  gap: var(--sp-1);
  padding: var(--sp-1-5) var(--sp-2);
  background: var(--c-accent);
  color: var(--c-text-inverse);
  border: none;
  border-radius: var(--r-m);
  font-size: var(--fs-3);
  font-weight: var(--fw-md);
  cursor: pointer;
  flex-shrink: 0;
  transition:
    background var(--t-fast),
    transform var(--t-fast);
  -webkit-tap-highlight-color: transparent;
}
.dash-cta svg {
  width: 15px;
  height: 15px;
}
.dash-cta:active {
  background: var(--c-accent-d);
  transform: scale(var(--press-scale));
}

/* ── 7-day streak strip ── */
.streak-card {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--r-l);
  padding: var(--sp-2);
  margin-bottom: var(--sp-2);
}
.streak-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--sp-1);
}
.streak-count {
  font-size: var(--fs-1);
  font-weight: var(--fw-md);
  color: var(--c-gold);
  letter-spacing: 0.04em;
}
.streak-strip {
  display: flex;
  justify-content: space-between;
  gap: var(--sp-1);
  width: 100%;
}
.streak-day {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--sp-0-5);
  flex: 1;
  min-width: 0;
}
.streak-day-label {
  font-size: var(--fs-1);
  font-weight: var(--fw-md);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--c-text-3);
}
.streak-dot {
  width: 100%;
  aspect-ratio: 1;
  max-width: 40px;
  max-height: 40px;
  border-radius: var(--r-sm);
  background: var(--c-bg-3);
  border: 1.5px solid var(--c-border);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform var(--t-fast), opacity var(--t-fast);
}
.streak-dot.has-workout {
  border-color: transparent;
}
.streak-dot.today {
  box-shadow: 0 0 0 2px var(--c-border-h);
}
.streak-dot svg {
  width: 12px;
  height: 12px;
}

/* ── Stat chips ── */
.stat-row {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: var(--sp-1);
  margin-bottom: var(--sp-2);
}
/* border-radius здесь не объявляется намеренно: `.stat-chip` входит в группу
   AIR Tier 1 (css/base.css), а та прибивает радиус через `--r-l !important`.
   Стоявший тут `var(--r-m)` не применялся ни разу — чип всегда был 18px. */
.stat-chip {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  padding: var(--sp-1-5) var(--sp-1);
  display: flex;
  flex-direction: column;
  gap: var(--sp-0-5);
}
.stat-chip-purple {
  border-color: var(--c-border-purple);
}
.stat-chip-blue {
  border-color: var(--c-border-blue);
}
.stat-chip-val {
  font-size: var(--fs-4);
  font-weight: var(--fw-md);
  letter-spacing: -0.03em;
  color: var(--c-text-1);
  font-variant-numeric: tabular-nums;
  line-height: 1;
}
.stat-chip-unit {
  font-size: var(--fs-1);
  font-weight: var(--fw-md);
  color: var(--c-text-3);
  margin-left: 2px;
}
.stat-chip-label {
  font-size: var(--fs-1);
  font-weight: var(--fw-md);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--c-text-3);
}

/* ── PPL balance gauge card (component styles in base.css) ── */
.ppl-gauge-card {
  padding: var(--sp-2);
  margin-bottom: var(--sp-2);
}

/* ── Recent session items ── */
.session-item {
  display: flex;
  align-items: center;
  gap: var(--sp-1);
  padding: var(--sp-1-5) var(--sp-2);
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--r-m);
  margin-bottom: var(--sp-1-5); /* list-density: ступень ниже --sp-2 между карточками, но выше исходных 6px */
  transition: background var(--t-fast);
  cursor: pointer;
}
.session-item:active {
  background: var(--c-surface-h);
}
.session-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.session-info {
  flex: 1;
  min-width: 0;
}
/* Строка списка Recent — тот же паттерн, что .jr-* в Журнале
   (journal.css:200): заголовок --fs-3/bold, вторичное --fs-1, объём --fw-black. */
.session-title {
  font-size: var(--fs-3);
  font-weight: var(--fw-bold);
  color: var(--c-text-1);
}
.session-meta {
  font-size: var(--fs-1);
  font-weight: var(--fw-md);
  color: var(--c-text-3);
  margin-top: 1px;
}
.session-vol {
  font-size: var(--fs-2);
  font-weight: var(--fw-black);
  color: var(--c-text-2);
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
}

/* ── W-2-D-3: Recent card enrichments ── */
.session-title-row {
  display: flex;
  align-items: center;
  gap: var(--sp-1);
}

/* PR badge — gold 1px outline, AIR */
.rec-pr-badge {
  font-size: var(--fs-1);
  font-weight: var(--fw-black);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--c-gold);
  border: 1px solid color-mix(in srgb, var(--c-gold) 35%, transparent);
  border-radius: 5px;
  padding: 1px var(--sp-0-5);
  flex-shrink: 0;
}

/* Duration chip inline in meta row */
.rec-dur {
  font-variant-numeric: tabular-nums;
  color: var(--c-text-3);
}

/* Block indicator strip: proportional flex bars */
.rec-block-strip {
  display: flex;
  gap: 2px;
  margin-top: var(--sp-1);
  height: 3px;
  border-radius: 2px;
  overflow: hidden;
}

.rec-block-pill {
  height: 100%;
  border-radius: 2px;
  min-width: 6px;
  transition: opacity var(--t-fast);
}

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--sp-2);
  padding: var(--sp-5) var(--sp-3);
  text-align: center;
}
.empty-icon {
  width: 52px;
  height: 52px;
  border-radius: var(--r-l);
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  display: flex;
  align-items: center;
  justify-content: center;
}
.empty-icon svg {
  width: 22px;
  height: 22px;
  color: var(--c-text-3);
}
.empty-title {
  font-size: var(--fs-3);
  font-weight: var(--fw-md);
  color: var(--c-text-2);
}
.empty-desc {
  font-size: var(--fs-2);
  font-weight: var(--fw-md);
  color: var(--c-text-3);
  line-height: 1.6;
}

/* ── Empty Dashboard (onboarding) ── */
.empty-dashboard {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  min-height: 70vh;
  padding: var(--sp-3);
  animation: fadeSlideUp 0.26s var(--ease-out) both;
}
.empty-dash-mascot-wrap {
  position: relative;
  width: 150px;
  height: 150px;
  margin-bottom: var(--sp-3);
  cursor: grab;
  touch-action: none;
  user-select: none;
  z-index: 10;
  transition: opacity var(--t-enter);
  animation: emptyFloat 3s ease-in-out infinite;
}
.empty-dash-mascot-wrap:active { cursor: grabbing; animation-play-state: paused; }

.empty-dash-mascot {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  overflow: hidden;
  border: 2px solid rgba(0, 230, 118, 0.15);
  background: var(--c-surface);
  box-shadow: 0 0 40px rgba(0, 230, 118, 0.08), 0 8px 32px rgba(0, 0, 0, 0.4);
}

.empty-dash-mascot video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  pointer-events: none;
  transform-origin: 50% 32%;
  will-change: transform;
}
@media (prefers-reduced-motion: reduce) {
  .empty-dash-mascot video {
    transform: none !important;
    will-change: auto;
  }
}
/* Тап по маскоту = тумблер озвучки (флаг 'fab-video') */
.empty-dash-mascot-wrap[data-action] { cursor: pointer; }
.empty-dash-mascot.sound-on {
  border-color: color-mix(in srgb, var(--c-accent) 45%, transparent);
  box-shadow:
    0 0 40px color-mix(in srgb, var(--c-accent) 20%, transparent),
    0 8px 32px color-mix(in srgb, var(--c-black) 40%, transparent);
}

/* Волна реплики (компонент .talk в base.css) на большом маскоте: круг 150px
   против 64px у FAB, поэтому только масштаб — геометрия и логика общие. */
.empty-dash-mascot-wrap .talk {
  --talk-bar-w: 3px;
  --talk-bar-h: 18px;
  --talk-gap: 3px;
  bottom: -8px;
  padding: 5px 9px;
}

.mascot-close-btn {
  position: absolute;
  top: -8px;
  right: -8px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--c-bg-3);
  border: 1.5px solid var(--c-border);
  color: var(--c-text-1);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 20;
  opacity: 0.6;
  transform: scale(1);
  transition: transform 0.2s ease, opacity 0.2s ease;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.mascot-close-btn:active {
  opacity: 1;
  transform: scale(var(--press-scale));
  background: var(--c-red-bg);
  color: var(--c-red);
}
.mascot-sound-btn {
  position: absolute;
  top: -8px;
  left: -8px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--c-bg-3);
  border: 1.5px solid var(--c-border);
  color: var(--c-text-1);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 20;
  opacity: 0.6;
}
.mascot-sound-btn:active {
  opacity: 1;
  transform: scale(var(--press-scale));
}

@keyframes emptyFloat {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-8px); }
}
.empty-dash-title {
  font-size: var(--fs-5);
  font-weight: var(--fw-black);
  letter-spacing: -0.03em;
  color: var(--c-text-1);
  margin-bottom: var(--sp-1);
}
.empty-dash-sub {
  font-size: var(--fs-2);
  font-weight: var(--fw-md);
  color: var(--c-text-3);
  line-height: 1.6;
  max-width: 260px;
  margin-bottom: var(--sp-4);
}
.btn-start-workout {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-1);
  width: 100%;
  max-width: 280px;
  padding: var(--sp-2) var(--sp-3);
  background: var(--c-accent-bg);
  color: var(--c-accent);
  border: 1.5px solid rgba(0, 230, 118, 0.25);
  border-radius: var(--r-l);
  font-family: 'Manrope', sans-serif;
  font-size: var(--fs-3);
  font-weight: var(--fw-md);
  cursor: pointer;
  touch-action: manipulation;
  transition: transform var(--t-fast);
  box-shadow: 0 0 20px rgba(0, 230, 118, 0.12), 0 4px 16px rgba(0, 0, 0, 0.3);
  animation: glowPulse 2.5s ease-in-out infinite;
  pointer-events: auto;
  user-select: none;
}
.btn-start-workout:hover {
  background: rgba(0, 230, 118, 0.12);
  transform: scale(1.02);
}
.btn-start-workout:active {
  transform: scale(var(--press-scale));
}
.btn-start-workout svg {
  width: 18px;
  height: 18px;
}
@keyframes glowPulse {
  0%, 100% { box-shadow: 0 0 20px rgba(0, 230, 118, 0.12), 0 4px 16px rgba(0, 0, 0, 0.3); }
  50%      { box-shadow: 0 0 32px rgba(0, 230, 118, 0.22), 0 4px 16px rgba(0, 0, 0, 0.3); }
}

/* DESIGN-3: Staggered entrance animations */
.dash-hero {
  animation: fadeSlideUp 0.26s var(--ease-out) both;
}
.stat-row {
  animation: fadeSlideUp 0.26s var(--ease-out) 0.06s both;
}
.streak-card {
  animation: fadeSlideUp 0.26s var(--ease-out) 0.12s both;
}
.ppl-gauge-card {
  animation: fadeSlideUp 0.26s var(--ease-out) 0.18s both;
}
.session-item {
  animation: fadeSlideUp 0.3s ease both;
}
.session-item:nth-child(1) {
  animation-delay: 0.22s;
}
.session-item:nth-child(2) {
  animation-delay: 0.26s;
}
.session-item:nth-child(3) {
  animation-delay: 0.3s;
}
.session-item:nth-child(4) {
  animation-delay: 0.34s;
}
.session-item:nth-child(5) {
  animation-delay: 0.38s;
}

@media (hover: hover) {
  .stat-chip:hover {
    border-color: var(--c-border-h);
    background: var(--c-surface-h);
  }
  .session-item:hover {
    background: var(--c-surface-h);
  }
  .dash-cta:hover {
    background: var(--c-accent-d);
    transform: scale(1.02);
  }
}

/* ════════════════════════════════════════════════
   RECOMMENDATIONS MODAL
   ════════════════════════════════════════════════ */

.recommendations-modal {
  display: flex;
  flex-direction: column;
  gap: var(--sp-1);
  margin: var(--sp-2) 0;
  max-height: 35vh;
  overflow-y: auto;
}

.rec-ex-row {
  display: flex;
  align-items: center;
  gap: var(--sp-1);
  padding: var(--sp-1-5) var(--sp-2);
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--r-m);
  transition: background var(--t-fast);
}

.rec-ex-row:hover {
  background: var(--c-surface-h);
}

.rec-ex-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
  box-shadow: 0 0 8px currentColor;
}

.rec-ex-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.rec-ex-name {
  font-size: var(--fs-2);
  font-weight: var(--fw-md);
  color: var(--c-text-1);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.rec-ex-reason {
  font-size: var(--fs-1);
  font-weight: var(--fw-md);
  color: var(--c-text-3);
}

.rec-ex-weights {
  display: flex;
  align-items: center;
  gap: var(--sp-1);
  flex-shrink: 0;
}

.rec-old {
  font-size: var(--fs-2);
  font-weight: var(--fw-md);
  color: var(--c-text-3);
  text-decoration: line-through;
}

.rec-arrow {
  font-size: var(--fs-2);
  font-weight: var(--fw-md);
  color: var(--c-accent);
}

.rec-new {
  font-size: var(--fs-2);
  font-weight: var(--fw-black);
  color: var(--c-accent);
  text-shadow: 0 0 12px rgba(0, 230, 118, 0.4);
}

.rec-more {
  font-size: var(--fs-2);
  font-weight: var(--fw-md);
  color: var(--c-text-3);
  text-align: center;
  padding: var(--sp-1);
}

.ai-notes-card {
  display: flex;
  align-items: flex-start;
  gap: var(--sp-1);
  padding: var(--sp-2);
  background: rgba(139, 92, 246, 0.08);
  border: 1px solid rgba(139, 92, 246, 0.2);
  border-radius: var(--r-m);
  margin-bottom: var(--sp-1);
}

.ai-notes-icon {
  font-size: var(--fs-4);
  flex-shrink: 0;
}

.ai-notes-text {
  font-size: var(--fs-2);
  font-weight: var(--fw-md);
  color: var(--c-text-2);
  line-height: 1.5;
}

.ai-notes-text strong {
  color: var(--c-text-1);
  font-weight: var(--fw-bold);
}

.fatigue-warning {
  display: flex;
  align-items: center;
  gap: var(--sp-1);
  padding: var(--sp-2);
  background: rgba(255, 179, 0, 0.08);
  border: 1px solid rgba(255, 179, 0, 0.2);
  border-radius: var(--r-m);
  margin-bottom: var(--sp-1);
}

.fatigue-icon {
  font-size: var(--fs-3);
  flex-shrink: 0;
}

.fatigue-text {
  font-size: var(--fs-2);
  font-weight: var(--fw-md);
  color: var(--c-text-2);
}

/* Recommendations card on Dashboard */
.recommendations-card {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--r-l);
  padding: var(--sp-2);
  display: flex;
  flex-direction: column;
  gap: var(--sp-1);
}

.rec-item {
  display: flex;
  align-items: center;
  gap: var(--sp-1);
  padding: var(--sp-1-5) var(--sp-2);
  background: var(--c-bg-2);
  border: 1px solid var(--c-border);
  border-radius: var(--r-m);
  transition: background var(--t-fast);
}

.rec-item:hover {
  background: var(--c-bg-3);
}

.rec-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
  box-shadow: 0 0 6px currentColor;
}

.rec-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.rec-name {
  font-size: var(--fs-2);
  font-weight: var(--fw-md);
  color: var(--c-text-1);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.rec-reason {
  font-size: var(--fs-1);
  font-weight: var(--fw-md);
  color: var(--c-text-3);
}

.rec-weights {
  display: flex;
  align-items: center;
  gap: var(--sp-1);
  flex-shrink: 0;
}

/* ВНИМАНИЕ: .rec-old / .rec-arrow / .rec-new объявлены выше (блок модалки,
   dashboard.css:~559) — эти правила их перебивают. После перевода на ступени
   оба блока совпали; верхний фактически мёртв, как и вся модалка рекомендаций
   (.recommendations-modal / .rec-ex-* / .ai-notes-* / .fatigue-* нигде не
   рендерятся). Снос — отдельная карточка, не в типографике. */
.rec-old {
  font-size: var(--fs-2);
  font-weight: var(--fw-md);
  color: var(--c-text-3);
  text-decoration: line-through;
}

.rec-arrow {
  font-size: var(--fs-2);
  font-weight: var(--fw-md);
  color: var(--c-accent);
}

.rec-new {
  font-size: var(--fs-2);
  font-weight: var(--fw-black);
  color: var(--c-accent);
  text-shadow: 0 0 10px rgba(0, 230, 118, 0.3);
}

/* ── Weekly Summary Chip — icon layout ── */
.weekly-summary-chip {
  flex-direction: row;
  align-items: center;
  gap: var(--sp-1);
  padding: var(--sp-1-5) var(--sp-2);
}
.weekly-summary-chip .stat-chip-icon {
  color: var(--c-accent);
  display: flex;
  align-items: center;
  flex-shrink: 0;
}
.weekly-summary-chip .stat-chip-content {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
/* Ступень ниже обычного .stat-chip-val (--fs-4): чип с иконкой занят
   горизонтальной раскладкой, значению остаётся меньше ширины. */
.weekly-summary-chip .stat-chip-val {
  font-size: var(--fs-3);
}
/* ── Weekly Summary Chip — icon layout ── */


/* ── Recent → Журнал ──────────────────────────────────────
   Заголовок секции с текстовым действием справа — тот же паттерн,
   что «Edit Plan» / «Add» на экране Train (css/workout.css:76).
   Отрицательный margin гасит сдвиг от padding: тап-зона растёт,
   а строка выше не становится. */
.dash-recent-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.dash-recent-header .btn-text {
  padding: var(--sp-1-5) var(--sp-1);
  margin: calc(-1 * var(--sp-1-5)) calc(-1 * var(--sp-1));
}

/* ── Collapsible tail (Top Lifts / Recent) ─────────────────────────
   Pinned items render up-front; anything past that sits in .list-collapse,
   closed by default. grid-template-rows 0fr→1fr collapses without measuring
   heights in JS; the inner wrapper clips content while the row grows. */
.list-collapse {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows var(--t-normal);
}
.list-collapse.expanded {
  grid-template-rows: 1fr;
}
.list-collapse-inner {
  overflow: hidden;
}

.list-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-0-5);
  width: 100%;
  background: none;
  border: none;
  padding: var(--sp-2) var(--sp-1);
  font-size: var(--fs-1);
  font-weight: var(--fw-bold);
  color: var(--c-text-3);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  cursor: pointer;
  transition: opacity var(--t-fast);
}
.list-toggle:active {
  opacity: 0.6;
}
.list-toggle-icon {
  flex-shrink: 0;
  transition: transform var(--t-fast);
}
.list-toggle.expanded .list-toggle-icon {
  transform: rotate(180deg);
}
