/* ============================================================
   AI Tutor Chat — appears below failing test results
   ============================================================ */

.tvm-tutor-chat {
  margin-top: 16px;
  border: 1px solid #2a2a38;
  border-radius: 8px;
  overflow: hidden;
  background: #14141c;
}

.tvm-tutor-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  background: #1a1a26;
  cursor: pointer;
  user-select: none;
  font-size: 0.9em;
  font-weight: 600;
  color: #b0b0c8;
  border-bottom: 1px solid #2a2a38;
}
.tvm-tutor-header:hover { background: #22222e; }
.tvm-tutor-icon { font-size: 1.1em; }
.tvm-tutor-toggle {
  margin-left: auto;
  background: none; border: none; color: #8080a0;
  font-size: 0.85em; cursor: pointer; padding: 0;
  transition: transform 0.2s;
}
.tvm-tutor-chat.collapsed .tvm-tutor-toggle { transform: rotate(-90deg); }
.tvm-tutor-chat.collapsed .tvm-tutor-body { display: none; }

/* Status bar (model loading / unavailable) */
.tvm-tutor-status {
  padding: 12px 14px;
  font-size: 0.85em;
  color: #8080a0;
  text-align: center;
}
.tvm-tutor-status a {
  color: #5b9bd5;
  text-decoration: underline;
}
.tvm-tutor-status a:hover { color: #7bb8ee; }

/* Hints area */
.tvm-tutor-hints {
  padding: 10px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.tvm-tutor-hint {
  padding: 10px 12px;
  border-radius: 6px;
  background: #1a2230;
  border: 1px solid #2a3a4a;
}
.tvm-tutor-hint-title {
  font-weight: 600;
  font-size: 0.9em;
  color: #8bb8e8;
  margin-bottom: 4px;
}
.tvm-tutor-hint-body {
  font-size: 0.85em;
  line-height: 1.5;
  color: #c0c8d8;
}
.tvm-tutor-hint-body p { margin: 0 0 0.4em; }
.tvm-tutor-hint-body p:last-child { margin-bottom: 0; }
.tvm-tutor-hint-body code {
  background: rgba(255,255,255,0.08);
  padding: 1px 4px;
  border-radius: 3px;
  font-size: 0.92em;
}
html:not(.dark-mode) .tvm-tutor-hint { background: #eef4fa; border-color: #c8d8e8; }
html:not(.dark-mode) .tvm-tutor-hint-title { color: #2774AE; }
html:not(.dark-mode) .tvm-tutor-hint-body { color: #444; }
html:not(.dark-mode) .tvm-tutor-hint-body code { background: rgba(0,0,0,0.06); }

/* Message area */
.tvm-tutor-messages {
  max-height: 320px;
  overflow-y: auto;
  padding: 10px 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.tvm-tutor-msg {
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 0.88em;
  line-height: 1.5;
  max-width: 85%;
  word-wrap: break-word;
}
.tvm-tutor-msg.user { white-space: pre-wrap; }
.tvm-tutor-msg.assistant p { margin: 0 0 0.5em; }
.tvm-tutor-msg.assistant p:last-child { margin-bottom: 0; }
.tvm-tutor-msg.assistant pre {
  background: rgba(0,0,0,0.2);
  padding: 6px 8px;
  border-radius: 4px;
  overflow-x: auto;
  font-size: 0.92em;
}
html:not(.dark-mode) .tvm-tutor-msg.assistant pre { background: rgba(0,0,0,0.05); }
.tvm-tutor-msg.assistant {
  background: #1e2a3a;
  color: #c8d8e8;
  border: 1px solid #2a3a4a;
  align-self: flex-start;
}
.tvm-tutor-msg.user {
  background: #2a2a38;
  color: #d0d0e0;
  border: 1px solid #3a3a48;
  align-self: flex-end;
}
.tvm-tutor-msg code {
  background: rgba(255,255,255,0.08);
  padding: 1px 4px;
  border-radius: 3px;
  font-size: 0.92em;
}

/* Typing indicator */
.tvm-tutor-typing {
  display: flex; gap: 4px; padding: 8px 12px; align-self: flex-start;
}
.tvm-tutor-typing span {
  width: 6px; height: 6px; border-radius: 50%; background: #5080a0;
  animation: tvm-tutor-dot 1.2s infinite;
}
.tvm-tutor-typing span:nth-child(2) { animation-delay: 0.2s; }
.tvm-tutor-typing span:nth-child(3) { animation-delay: 0.4s; }
@keyframes tvm-tutor-dot {
  0%, 60%, 100% { opacity: 0.3; transform: scale(0.8); }
  30% { opacity: 1; transform: scale(1); }
}

/* Input row */
.tvm-tutor-input-row {
  display: flex;
  gap: 6px;
  padding: 8px 10px;
  border-top: 1px solid #2a2a38;
  background: #18181f;
}
.tvm-tutor-input {
  flex: 1;
  background: #1e1e2a;
  border: 1px solid #3a3a48;
  border-radius: 6px;
  padding: 7px 10px;
  color: #d0d0e0;
  font-size: 0.88em;
  font-family: inherit;
  outline: none;
}
.tvm-tutor-input:focus { border-color: #5080a0; }
.tvm-tutor-input:disabled { opacity: 0.5; }
.tvm-tutor-send {
  background: #2774AE;
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 7px 14px;
  font-size: 0.85em;
  font-weight: 600;
  cursor: pointer;
}
.tvm-tutor-send:hover { background: #3388c4; }
.tvm-tutor-send:disabled { opacity: 0.4; cursor: default; }

/* ── Light mode overrides ── */
html:not(.dark-mode) .tvm-tutor-chat { background: #fff; border-color: #d0d0d8; }
html:not(.dark-mode) .tvm-tutor-header { background: #f4f4f8; color: #444; border-color: #d0d0d8; }
html:not(.dark-mode) .tvm-tutor-header:hover { background: #eaeaf0; }
html:not(.dark-mode) .tvm-tutor-msg.assistant { background: #eef4fa; color: #333; border-color: #c8d8e8; }
html:not(.dark-mode) .tvm-tutor-msg.user { background: #f0f0f4; color: #333; border-color: #d8d8e0; }
html:not(.dark-mode) .tvm-tutor-input { background: #f8f8fc; border-color: #c0c0c8; color: #333; }
html:not(.dark-mode) .tvm-tutor-input-row { background: #fafafa; border-color: #d0d0d8; }
html:not(.dark-mode) .tvm-tutor-status { color: #666; }
html:not(.dark-mode) .tvm-tutor-msg code { background: rgba(0,0,0,0.06); }
