/*
 * Train Online wireframe design system
 *
 * This file owns the visual language shared by the product-journey states.
 * Keep page-specific content and state differences in product-journeys.html;
 * make systemic visual changes here.
 */

:root {
  --actionbar-height: 60px;
  --ink: var(--color-text);
  --muted: var(--color-text-muted);
  --canvas: var(--color-canvas);
  --surface: var(--color-surface);
  --line: var(--color-border);
  --accent: var(--color-accent);
  --accent-pale: var(--color-selected);
  --terminal: var(--color-panel);
  --green: var(--color-success);
  --warning: var(--color-warning);
}

body {
  background: var(--color-canvas);
  color: var(--color-text);
  font-family: var(--font-ui);
  font-size: 13px;
}

header {
  padding: 42px max(28px, calc((100vw - 1160px) / 2));
  border-bottom: 1px solid var(--color-border);
  background: var(--color-titlebar);
  color: #ffffff;
}

header p {
  color: var(--color-text-muted);
}

main {
  padding-top: 32px;
}

.intro,
.questions {
  border: 1px solid var(--color-border);
  border-radius: 0;
  background: var(--color-titlebar);
}

.tag {
  border: 1px solid var(--color-border-strong);
  border-radius: 2px;
  background: var(--color-selected);
  color: var(--color-text);
  font-weight: 600;
}

.number {
  color: var(--color-accent);
}

.wireframe {
  overflow: hidden;
  border: 1px solid var(--color-border-strong);
  border-radius: 0;
  background: var(--color-surface);
  box-shadow: none;
}

/* Application chrome */
.browser {
  height: 28px;
  gap: 5px;
  padding: 0 10px;
  border-bottom: 1px solid #111111;
  background: var(--color-titlebar);
}

.dot {
  width: 7px;
  height: 7px;
  background: var(--color-text-subtle);
}

.url {
  max-width: 360px;
  margin-left: 8px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--color-text-subtle);
}

.app-bar {
  height: 35px;
  padding: 0 14px;
  border-bottom: 1px solid var(--color-border);
  background: var(--color-titlebar);
}

.brand {
  color: var(--color-text);
  font-weight: 600;
  letter-spacing: 0;
}

.brand i {
  color: var(--color-text-muted);
}

.avatar {
  width: 22px;
  height: 22px;
  border-radius: 2px;
  background: var(--color-selected);
  color: var(--color-text);
  font-size: .65rem;
}

/* Reusable controls */
code {
  border-radius: 2px;
  padding: 1px 3px;
  background: var(--color-selected);
  color: #dcdcaa;
  font-family: var(--font-code);
}

/* Start and review states */
.screen {
  min-height: 370px;
  padding: 28px;
  background: var(--color-surface);
}

.screen-title {
  color: #ffffff;
  font-size: 1.25rem;
  font-weight: 400;
}

.exercise-card,
.check {
  border: 1px solid var(--color-border);
  border-radius: 0;
  background: var(--color-titlebar);
}

.exercise-card:hover {
  background: var(--color-hover);
}

.meta,
.screen-subtitle,
.journey-purpose,
.intro p,
.note,
.check small {
  color: var(--color-text-muted);
}

.review-note {
  border-left-color: var(--color-accent);
  background: var(--color-selected);
  color: var(--color-text);
}

.check .ok,
.status,
.run-state {
  color: var(--color-success);
}

.check .pending {
  color: var(--color-warning);
}

/* Workspace layout: assistant sidebar and active editor pane. */
.workspace,
.run-workspace {
  grid-template-columns: minmax(230px, .85fr) minmax(360px, 1.5fr);
  background: var(--color-surface);
}

.agent-panel {
  border-right: 1px solid var(--color-border);
  background: #181818;
}

.panel-head,
.filebar,
.actionbar,
.composer,
.terminal-actions {
  border-color: var(--color-border);
  background: var(--color-titlebar);
}

.panel-head {
  min-height: 35px;
  padding: 0 16px;
  color: var(--color-text);
  font-size: .75rem;
  font-weight: 600;
  letter-spacing: 0;
  text-transform: none;
}

.messages {
  overflow-y: auto;
  padding: 22px 18px 28px;
}

.message {
  max-width: 100%;
  margin: 0 0 28px;
  border: 0;
  border-radius: 0;
  padding: 0;
  background: transparent;
  color: var(--color-text);
  font-size: .86rem;
  line-height: 1.6;
}

.message.user {
  width: fit-content;
  max-width: 88%;
  margin: 0 0 28px auto;
  border: 0;
  border-radius: 18px;
  padding: 10px 14px;
  background: #214b83;
  color: #ffffff;
}

.message .speaker {
  display: none;
}

.input {
  min-height: 42px;
  border-color: var(--color-border-strong);
  border-radius: 22px;
  padding: 10px 14px;
  background: #252525;
  color: var(--color-text-muted);
}

.send {
  display: none;
}

.composer {
  position: relative;
  gap: 0;
  padding: 12px 16px 16px;
  border-top: 0;
  background: #181818;
}

/* Editor and terminal primitives */
.code-area,
.run-code {
  background: var(--color-surface);
}

.filebar {
  min-height: 35px;
  padding: 0 12px;
  align-items: center;
  font-size: .75rem;
}

.tabs {
  align-self: stretch;
  gap: 0;
  margin-left: -12px;
}

.tab {
  display: inline-flex;
  min-width: 86px;
  align-items: center;
  border-right: 1px solid var(--color-border);
  padding: 0 12px;
  color: var(--color-text-muted);
}

.tab.active {
  border-top: 1px solid var(--color-accent);
  background: var(--color-tab-active);
  color: var(--color-text);
  font-weight: 400;
}

.editor {
  background: var(--color-surface);
  color: #d4d4d4;
  font-family: var(--font-code);
}

.ln {
  width: 48px;
  color: #858585;
}

.comment { color: #6a9955; }
.keyword { color: #569cd6; }
.string { color: #ce9178; }

.actionbar {
  height: var(--actionbar-height);
  min-height: var(--actionbar-height);
}

.save-state {
  color: var(--color-text-muted);
}

/* Terminal styling applies only to the existing drawer and its controls. */
.terminal-drawer {
  position: absolute;
  z-index: 1;
  height: 52%;
  right: 0;
  bottom: var(--actionbar-height);
  left: 0;
  overflow: hidden;
  border-top: 1px solid var(--color-border-strong);
  background: #181818;
  box-shadow: none;
}

.terminal {
  height: 100% !important;
  padding: 58px 17px 17px;
  background: #181818;
  color: #d4d4d4;
  font-family: var(--font-code);
}

.term-dim { color: #858585; }
.term-green { color: var(--color-success); }
.cursor { background: #d4d4d4; }

.terminal-actions {
  display: contents;
}

.terminal-actions .ui-button {
  position: absolute;
  z-index: 1;
  top: 9px;
  display: grid;
  width: 24px;
  height: 24px;
  place-items: center;
  border-color: transparent;
  background: transparent;
  color: var(--color-text-muted);
  font-size: 0;
}

.terminal-actions .ui-button:first-child {
  right: 42px;
}

.terminal-actions .ui-button:nth-child(2) {
  right: 12px;
}

.terminal-actions .terminal-actions .ui-button:first-child::before {
  content: "⌫";
  font: 19px/1 var(--font-ui);
}

.terminal-actions .ui-button.warning::before {
  content: "■";
  font: 12px/1 var(--font-ui);
}

.terminal-actions .ui-button:nth-child(2):not(.warning)::before {
  content: "×";
  font: 24px/.75 var(--font-ui);
}

/* The action bar remains visible while a terminal drawer is open. */
.run-code > .actionbar {
  position: relative;
  z-index: 2;
}

.actionbar .run-state {
  margin: 0;
  align-self: center;
  color: var(--color-success);
  font-size: .75rem;
  font-weight: 700;
}

.run-code > .actionbar .ui-button {
  margin-left: auto;
}

.run-code > .actionbar .ui-button.is-disabled {
  border-color: #3a3d41;
  background: #3a3d41;
  color: #8e8e8e;
  pointer-events: none;
}

.questions li {
  color: var(--color-text-muted);
}

.questions strong {
  color: var(--color-text);
}

@media (max-width: 720px) {
  .workspace,
  .run-workspace {
    grid-template-columns: 1fr;
  }

  .agent-panel {
    border-right: 0;
    border-bottom: 1px solid var(--color-border);
  }
}
