/* Digit the maths tutor (wwwroot/js/digit.js): "Ask Digit" buttons next to questions / theory, and a side drawer. */
.digit-btn {
  display: inline-flex; align-items: center; gap: 6px;
  border: 1px solid #5b4bd6; background: #fff; color: #5b4bd6; border-radius: 999px;
  padding: 4px 12px; font-size: 13px; font-weight: 600; cursor: pointer; line-height: 1.4; white-space: nowrap;
}
.digit-btn:hover { background: #5b4bd6; color: #fff; }
.digit-btn .digit-dot { width: 18px; height: 18px; border-radius: 50%; background: #5b4bd6; color: #fff; display: inline-flex;
  align-items: center; justify-content: center; font-size: 11px; font-weight: 700; }
.digit-btn:hover .digit-dot { background: #fff; color: #5b4bd6; }
.digit-btn.d-none { display: none !important; }

.digit-drawer {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 1200; /* above the public site's fixed top bar (.cm-nav 1100) */
  width: 420px; max-width: 100vw; display: flex; flex-direction: column;
  background: #fff; box-shadow: -6px 0 30px rgba(0, 0, 0, .2);
  transform: translateX(105%); transition: transform .2s ease;
  font-size: 15px; color: #1f2937; line-height: 1.45;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
}
.digit-drawer.open { transform: none; }
.digit-head { background: #5b4bd6; color: #fff; padding: 12px 14px; display: flex; align-items: center; gap: 10px; }
.digit-head .digit-avatar { width: 34px; height: 34px; border-radius: 50%; background: #fff; color: #5b4bd6; font-weight: 800;
  display: flex; align-items: center; justify-content: center; flex: none; }
.digit-head b { font-size: 16px; display: block; }
.digit-head small { display: block; opacity: .85; font-size: 12px; }
.digit-head .digit-title { flex: 1; min-width: 0; }
.digit-head .digit-context { font-size: 12px; opacity: .9; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.digit-head button { background: none; border: 0; color: #fff; cursor: pointer; }
.digit-close { font-size: 26px; line-height: 1; }
.digit-new { font-size: 12px; border: 1px solid rgba(255,255,255,.6) !important; border-radius: 6px; padding: 3px 8px; }
.digit-body { flex: 1; overflow-y: auto; padding: 12px; background: #f6f5fe; }
.digit-msg { margin: 0 0 10px; padding: 9px 12px; border-radius: 12px; max-width: 88%; word-wrap: break-word; }
.digit-msg.user { margin-left: auto; background: #5b4bd6; color: #fff; border-bottom-right-radius: 4px; white-space: pre-wrap; }
.digit-msg.assistant { background: #fff; border: 1px solid #e5e7eb; border-bottom-left-radius: 4px; }
.digit-msg.thinking { color: #6b7280; font-style: italic; }
.digit-rate { margin: -6px 0 10px; display: flex; gap: 6px; align-items: center; font-size: 12px; color: #6b7280; }
.digit-rate button { border: 1px solid #d1d5db; background: #fff; border-radius: 999px; padding: 1px 8px; cursor: pointer; font-size: 13px; }
.digit-rate button.on { border-color: #5b4bd6; background: #ece9fd; }
.digit-why { margin: -4px 0 10px; padding: 8px; background: #fff; border: 1px solid #c7c2f3; border-radius: 10px; font-size: 13px; }
.digit-why label { display: block; margin: 2px 0; }
.digit-why textarea { width: 100%; margin-top: 4px; border: 1px solid #d1d5db; border-radius: 6px; padding: 4px 6px; font-size: 13px; }
.digit-why button { margin-top: 4px; border: 0; border-radius: 6px; padding: 4px 10px; background: #5b4bd6; color: #fff; cursor: pointer; }
.digit-quick { display: flex; flex-wrap: wrap; gap: 6px; padding: 8px 12px 0; }
.digit-quick button { border: 1px solid #5b4bd6; background: #fff; color: #5b4bd6; border-radius: 999px; padding: 4px 11px; font-size: 13px; cursor: pointer; }
.digit-foot { border-top: 1px solid #e5e7eb; padding: 8px 12px 10px; }
.digit-form { display: flex; flex-direction: column; gap: 6px; }
.digit-form textarea { width: 100%; resize: vertical; min-height: 72px; max-height: 200px; padding: 9px 10px; border: 1px solid #d1d5db; border-radius: 8px; font-size: 15px; line-height: 1.4; }
.digit-actions { display: flex; justify-content: flex-end; gap: 8px; }
.digit-form button { border: 0; border-radius: 8px; padding: 8px 18px; background: #5b4bd6; color: #fff; font-weight: 600; cursor: pointer; }
.digit-form button.digit-mic { background: #fff; color: #5b4bd6; border: 1px solid #5b4bd6; }
.digit-form button.digit-mic.rec { background: #dc2626; color: #fff; border-color: #dc2626; }
.digit-voice { display: flex; align-items: center; gap: 8px; margin-top: 6px; font-size: 12px; color: #4b5563; flex-wrap: wrap; }
.digit-voice select { font-size: 12px; padding: 1px 4px; border: 1px solid #d1d5db; border-radius: 6px; }
.digit-note { font-size: 11px; color: #6b7280; margin-top: 6px; }
.digit-signin { padding: 18px; }
.digit-signin a { display: inline-block; margin-top: 8px; background: #5b4bd6; color: #fff; padding: 8px 16px; border-radius: 8px; text-decoration: none; font-weight: 600; }
@media (max-width: 480px) { .digit-drawer { width: 100vw; } }

/* Wide screens: Digit sits beside the page instead of over it - the page narrows to make a column for the chat. */
@media (min-width: 1100px) {
  body { transition: padding-right .2s ease; }
  body.digit-open { padding-right: 420px; }
  body.digit-open .cm-nav { left: 0; right: 420px; width: auto; }
  body.digit-open .header,
  body.digit-open .navbar.fixed-top,
  body.digit-open header.fixed-top { right: 420px; width: auto; }
  .digit-drawer { box-shadow: -1px 0 0 #e5e7eb, -6px 0 18px rgba(0, 0, 0, .08); }
}
