/* BuildTrainer page — Chessable MoveTrainer parity. */

.trainer-page {
  display: flex;
  flex-direction: column;
  height: 100vh;
  max-height: 100vh;
  background: #0d0f12;
  overflow: hidden;
}

/* Top bar */

.trainer-page__topbar {
  display: grid;
  grid-template-columns: 1fr 2fr 1fr;
  align-items: center;
  gap: 16px;
  padding: 8px 16px;
  background: var(--color-surface, #1a1d22);
  border-bottom: 1px solid var(--color-border, #2a2f36);
  height: 56px;
  flex-shrink: 0;
}

.trainer-page__topbar-left {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.trainer-page__exit-link {
  color: var(--color-text-muted, #8a8f98);
  text-decoration: none;
  font-size: 14px;
}

.trainer-page__exit-link:hover { color: var(--color-text, #fff); }

.trainer-page__course-title {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.trainer-page__topbar-center {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.trainer-page__progress-text {
  font-size: 12px;
  color: var(--color-text-muted, #8a8f98);
}

.trainer-page__progress-track {
  height: 6px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 999px;
  overflow: hidden;
}

.trainer-page__progress-track > div {
  height: 100%;
  background: var(--color-accent, #ff7f00);
  transition: width 0.2s ease;
}

.trainer-page__topbar-right {
  display: flex;
  justify-content: flex-end;
}

/* Stats overlay */

.trainer-stats {
  display: flex;
  gap: 12px;
  font-size: 12px;
}

.trainer-stats__cell {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 48px;
  gap: 1px;
}

.trainer-stats__icon { font-size: 14px; line-height: 1; }
.trainer-stats__num { font-weight: 700; font-size: 14px; }
.trainer-stats__label {
  color: var(--color-text-muted, #8a8f98);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Body grid: viewer (60%) | sidebar (25%) on top half, card area on bottom */

.trainer-page__body {
  display: grid;
  grid-template-columns: 1fr 320px;
  grid-template-rows: 1fr auto;
  gap: 12px;
  padding: 12px;
  flex: 1;
  min-height: 0;
}

.trainer-page__viewer {
  grid-row: 1;
  grid-column: 1;
  background: var(--color-surface, #1a1d22);
  border: 1px solid var(--color-border, #2a2f36);
  border-radius: 8px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.trainer-page__viewer-placeholder {
  text-align: center;
  color: var(--color-text-muted, #6a6f78);
  padding: 32px;
}

/* Position display — minimap snapshot or SVG fallback */
.trainer-position-display {
  width: 100%;
  aspect-ratio: 1 / 1;
  max-height: 600px;
  background: rgba(15, 19, 28, 0.6);
  border: 1px solid var(--color-border, #2a2f36);
  border-radius: var(--radius-lg, 8px);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.trainer-position-fallback {
  text-align: center;
  color: var(--color-text-muted, #8a8f98);
  padding: var(--space-5, 24px);
}

.trainer-position-fallback-text {
  margin-top: var(--space-3, 12px);
  font-size: var(--text-sm, 13px);
}

.trainer-page__sidebar {
  grid-row: 1;
  grid-column: 2;
  min-height: 0;
}

.trainer-page__card-area {
  grid-row: 2;
  grid-column: 1 / -1;
  min-height: 240px;
}

/* Mobile: stack everything */

@media (max-width: 768px) {
  .trainer-page__topbar {
    grid-template-columns: 1fr auto;
    height: auto;
    padding: 8px;
    gap: 8px;
  }
  .trainer-page__topbar-center {
    grid-column: 1 / -1;
  }
  .trainer-page__topbar-right {
    grid-row: 1;
    grid-column: 2;
  }
  .trainer-page__body {
    grid-template-columns: 1fr;
    grid-template-rows: 240px auto auto;
    padding: 8px;
    gap: 8px;
  }
  .trainer-page__viewer { grid-row: 1; grid-column: 1; }
  .trainer-page__sidebar { grid-row: 3; grid-column: 1; max-height: 240px; }
  .trainer-page__card-area { grid-row: 2; grid-column: 1; }
  .trainer-stats__cell { min-width: 40px; }
  .trainer-stats__num { font-size: 12px; }
}
