/* AlbertMath workspace — cognitive calculator UI */

.albert-math-workspace {
  display: flex;
  flex-direction: column;
  gap: var(--space-lg);
}

.albert-math-workspace__grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-areas: "calculator panel";
  gap: var(--space-lg);
  align-items: start;
}

@media (max-width: 48rem) {
  .albert-math-workspace__grid {
    grid-template-columns: 1fr;
    grid-template-areas:
      "calculator"
      "panel";
  }
}

.albert-math-workspace__scratchpad,
.albert-math-workspace__panel-card {
  background: var(--theme-card);
  border: 1px solid var(--theme-border);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  box-shadow: var(--shadow-card);
}

.albert-math-workspace__panel-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: var(--space-md);
  margin-block-end: var(--space-md);
}

.albert-math-workspace__panel-title,
.albert-math-workspace__scratchpad-title,
.albert-math-workspace__graph-title {
  font-family: var(--font-display);
  font-size: var(--text-sm);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-math-tint);
  margin: 0;
}

.albert-math-workspace__panel-lead {
  margin: var(--space-xs) 0 0;
  color: var(--theme-muted);
  font-size: var(--text-sm);
  line-height: var(--leading-relaxed);
}

.albert-math-workspace__notes-input {
  inline-size: 100%;
  min-block-size: 20rem;
  resize: vertical;
  padding: var(--space-md);
  border: 1px solid var(--theme-border);
  border-radius: var(--radius-md);
  background: var(--theme-surface);
  color: var(--theme-text);
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  line-height: var(--leading-relaxed);
}

.albert-math-workspace__notes-input:focus {
  outline: none;
  border-color: var(--color-math-tint);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--color-math-tint) 24%, transparent);
}

.albert-math-workspace__notes-status {
  margin: var(--space-sm) 0 0;
  color: var(--theme-muted);
  font-size: var(--text-xs);
}

.albert-math-workspace__notes-actions {
  display: flex;
  justify-content: flex-end;
  margin-block-end: var(--space-sm);
}

.albert-math-workspace__input-group {
  display: flex;
  gap: var(--space-sm);
  margin-block-end: var(--space-md);
}

.albert-math-workspace__input {
  flex: 1;
  font-family: var(--font-mono);
  font-size: var(--text-base);
  padding: var(--space-sm) var(--space-md);
  border: 1px solid var(--theme-border);
  border-radius: var(--radius-md);
  background: var(--theme-surface);
  color: var(--theme-text);
  transition: border-color var(--transition-fast);
}

.albert-math-workspace__input:focus {
  outline: none;
  border-color: var(--color-math-tint);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--color-math-tint) 24%, transparent);
}

.albert-math-workspace__actions {
  display: flex;
  gap: var(--space-sm);
  flex-wrap: wrap;
}

.albert-math-workspace__keypad {
  margin-block-end: var(--space-md);
  padding: var(--space-md);
  border: 1px solid color-mix(in srgb, var(--color-math-tint) 18%, var(--theme-border));
  border-radius: var(--radius-lg);
  background: color-mix(in srgb, var(--color-math-tint-subtle) 60%, var(--theme-card));
}

.albert-math-workspace__keypad-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-sm);
  margin-block-end: var(--space-sm);
}

.albert-math-workspace__keypad-title {
  margin: 0;
  font-size: var(--text-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--theme-muted);
}

.albert-math-workspace__keypad-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--space-xs);
}

.albert-math-workspace__function-pad {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-xs);
  margin-block-start: var(--space-sm);
}

.albert-math-workspace__keypad-btn {
  appearance: none;
  border: 1px solid var(--theme-border);
  border-radius: var(--radius-md);
  background: var(--theme-surface);
  color: var(--theme-text);
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  font-weight: 600;
  padding: 0.7rem 0.5rem;
  cursor: pointer;
  transition: transform var(--transition-fast), border-color var(--transition-fast), background var(--transition-fast);
}

.albert-math-workspace__keypad-btn:hover,
.albert-math-workspace__keypad-btn:focus-visible {
  border-color: var(--color-math-tint);
  background: color-mix(in srgb, var(--color-math-tint) 10%, var(--theme-surface));
  outline: none;
  transform: translateY(-1px);
}

.albert-math-workspace__keypad-btn--function {
  font-size: var(--text-xs);
  padding-inline: 0.75rem;
}

.albert-math-workspace__panel-card {
  grid-area: panel;
}

.albert-math-workspace__panel-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  padding: 0.2rem;
  border-radius: var(--radius-full);
  background: color-mix(in srgb, var(--theme-border) 28%, var(--theme-surface));
}

.albert-math-workspace__panel-toggle-btn {
  appearance: none;
  border: 0;
  border-radius: var(--radius-full);
  background: transparent;
  color: var(--theme-muted);
  cursor: pointer;
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: 0.04em;
  padding: 0.45rem 0.8rem;
  text-transform: uppercase;
  transition: background var(--transition-fast), color var(--transition-fast);
}

.albert-math-workspace__panel-toggle-btn[data-state="active"] {
  background: var(--theme-card);
  color: var(--theme-text);
  box-shadow: var(--shadow-sm);
}

.albert-math-workspace__panel-body {
  min-block-size: 22rem;
}

.albert-math-workspace__panel-view[hidden] {
  display: none;
}

/* Result area */
.albert-math-workspace__result {
  background: var(--theme-card);
  border: 1px solid var(--theme-border);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  box-shadow: var(--shadow-card);
  min-block-size: 6rem;
}

.albert-math-workspace__result-title {
  font-family: var(--font-display);
  font-size: var(--text-sm);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--theme-muted);
  margin-block-end: var(--space-sm);
}

.albert-math-workspace__result-value {
  font-family: var(--font-mono);
  font-size: var(--text-xl);
  font-weight: 600;
  color: var(--theme-text);
  margin-block-end: var(--space-sm);
}

.albert-math-workspace__latex {
  padding: var(--space-md);
  background: var(--color-math-tint-subtle);
  border-radius: var(--radius-md);
  overflow-x: auto;
  min-block-size: 2rem;
}

.albert-math-workspace__error {
  color: var(--color-danger);
  font-size: var(--text-sm);
  padding: var(--space-sm) var(--space-md);
  background: color-mix(in srgb, var(--color-danger) 8%, transparent);
  border-radius: var(--radius-md);
  display: none;
}

.albert-math-workspace__error.is-visible {
  display: block;
}

.albert-math-workspace__scratchpad {
  grid-area: calculator;
}

.albert-math-workspace__graph-board {
  aspect-ratio: 4 / 3;
  inline-size: 100%;
  border-radius: var(--radius-md);
  background: var(--theme-surface);
}

/* Examples row */
.albert-math-workspace__examples {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm);
  padding-block: var(--space-sm);
}

.albert-math-workspace__examples-title {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--theme-muted);
  margin-block-end: var(--space-xs);
}

.albert-math-workspace__example-btn {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  padding: var(--space-xs) var(--space-sm);
  border: 1px solid var(--theme-border);
  border-radius: var(--radius-full);
  background: var(--theme-surface);
  color: var(--theme-text);
  cursor: pointer;
  transition: background var(--transition-fast), border-color var(--transition-fast);
  text-decoration: none;
}

.albert-math-workspace__example-btn:hover {
  background: var(--color-math-tint-subtle);
  border-color: var(--color-math-tint);
}

@media (max-width: 48rem) {
  .albert-math-workspace__panel-header {
    flex-direction: column;
    align-items: stretch;
  }

  .albert-math-workspace__panel-toggle {
    inline-size: 100%;
    justify-content: stretch;
  }

  .albert-math-workspace__panel-toggle-btn {
    flex: 1;
  }

  .albert-math-workspace__keypad-header {
    flex-direction: column;
    align-items: stretch;
  }
}

/* Hint ladder (Phase 4 DOM contract) */
.albert-math-workspace__hint-ladder {
  background: var(--theme-card);
  border: 1px solid var(--theme-border);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  box-shadow: var(--shadow-card);
}

.albert-math-workspace__hint-content {
  font-size: var(--text-sm);
  color: var(--theme-text);
  padding: var(--space-md);
  background: var(--color-math-tint-subtle);
  border-radius: var(--radius-md);
  margin-block-end: var(--space-md);
}

.albert-math-workspace__step-feedback {
  font-size: var(--text-sm);
  padding: var(--space-sm) var(--space-md);
  border-radius: var(--radius-md);
  margin-block-start: var(--space-sm);
}

.albert-math-workspace__step-feedback--correct {
  color: var(--color-success);
  background: color-mix(in srgb, var(--color-success) 8%, transparent);
}

.albert-math-workspace__step-feedback--incorrect {
  color: var(--color-danger);
  background: color-mix(in srgb, var(--color-danger) 8%, transparent);
}

/* ──────────────────────────────────────
   Session panel — tutor/solver interface
   ────────────────────────────────────── */

.albert-math-session {
  background: var(--theme-card);
  border: 1px solid var(--color-math-tint);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  box-shadow: var(--shadow-card);
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

.albert-math-session__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.albert-math-session__mode-badge {
  font-family: var(--font-display);
  font-size: var(--text-sm);
  font-weight: 600;
  padding: var(--space-xs) var(--space-sm);
  border-radius: var(--radius-full);
  background: var(--color-math-tint);
  color: #fff;
}

.albert-math-session__mode-badge[data-mode="fast"] {
  background: var(--color-warning, #f59e0b);
}

.albert-math-session__mode-badge[data-mode="research"] {
  background: var(--color-info, #06b6d4);
}

.albert-math-session__gold {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-warning, #f59e0b);
}

.albert-math-session__expression {
  font-family: var(--font-mono);
  font-size: var(--text-lg);
  padding: var(--space-md);
  background: var(--color-math-tint-subtle);
  border-radius: var(--radius-md);
  color: var(--theme-text);
}

/* Steps */
.albert-math-session__steps {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
}

.albert-math-session__step {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-md);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  border-inline-start: 3px solid var(--theme-border);
}

.albert-math-session__step--correct {
  border-inline-start-color: var(--color-success);
  background: color-mix(in srgb, var(--color-success) 6%, transparent);
}

.albert-math-session__step--incorrect {
  border-inline-start-color: var(--color-danger);
  background: color-mix(in srgb, var(--color-danger) 6%, transparent);
}

.albert-math-session__step-icon {
  font-weight: 700;
  font-size: var(--text-base);
}

.albert-math-session__step--correct .albert-math-session__step-icon {
  color: var(--color-success);
}

.albert-math-session__step--incorrect .albert-math-session__step-icon {
  color: var(--color-danger);
}

.albert-math-session__step-input {
  font-family: var(--font-mono);
  color: var(--theme-text);
}

.albert-math-session__step-feedback {
  color: var(--theme-muted);
  margin-inline-start: auto;
}

/* Input row */
.albert-math-session__input-row {
  display: flex;
  gap: var(--space-sm);
}

.albert-math-session__input-row .albert-math-workspace__input {
  flex: 1;
}

/* Feedback */
.albert-math-session__feedback {
  font-size: var(--text-sm);
  padding: var(--space-sm) var(--space-md);
  border-radius: var(--radius-md);
  min-block-size: 1.5rem;
}

.albert-math-session__feedback--correct {
  color: var(--color-success);
  background: color-mix(in srgb, var(--color-success) 8%, transparent);
}

.albert-math-session__feedback--incorrect {
  color: var(--color-danger);
  background: color-mix(in srgb, var(--color-danger) 8%, transparent);
}

/* Hints */
.albert-math-session__hint {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
}

.albert-math-session__hint-item {
  display: flex;
  align-items: flex-start;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-md);
  background: var(--color-math-tint-subtle);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
}

.albert-math-session__hint-badge {
  font-family: var(--font-display);
  font-size: var(--text-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 2px var(--space-xs);
  border-radius: var(--radius-sm);
  background: var(--color-math-tint);
  color: #fff;
  white-space: nowrap;
}

.albert-math-session__hint-badge[data-level="2"] {
  background: var(--color-warning, #f59e0b);
}

.albert-math-session__hint-badge[data-level="3"] {
  background: var(--color-danger);
}

.albert-math-session__hint-text {
  color: var(--theme-text);
  line-height: 1.5;
}

/* Actions */
.albert-math-session__actions {
  display: flex;
  gap: var(--space-sm);
  flex-wrap: wrap;
}

/* Solution */
.albert-math-session__solution {
  font-size: var(--text-sm);
  color: var(--theme-text);
}
