/* answer-actions-1 (08-10, owner request): the answer's action row gains Copy, a rate menu (Good / Bad response)
   and labelled ⬇ .md / ⬇ .docx boxes. style.css's colour tokens only, so dark and light themes both follow. */

/* Labelled boxes: as wide as their label, same height and look as the square boxes. */
.msg-action-btn.msg-action-labelled {
  width: auto;
  min-width: 30px;
  padding: 0 9px;
  font-size: .78rem;
  white-space: nowrap;
}
.msg-action-btn:focus-visible { outline: 2px solid var(--link, var(--accent)); outline-offset: 2px; }

/* Copy: the two-squares icon, a tick for 1.2 s after copying (same icons as Copy under the prompt). */
.msg-action-copy svg { width: 16px; height: 16px; flex: none; }
.msg-action-copy .copy-done { display: none; }
.msg-action-copy.is-copied .copy-idle { display: none; }
.msg-action-copy.is-copied .copy-done { display: inline; color: var(--success, currentColor); }

/* Rate: one box with both thumbs; the menu opens above it. */
.feedback-controls { position: relative; }
.msg-action-btn.msg-action-feedback { width: auto; padding: 0 6px; gap: 2px; }
.msg-action-feedback[aria-expanded="true"] {
  background: var(--bg-hover);
  border-color: var(--border-strong, var(--border));
  color: var(--text);
}
/* Rated: the chosen thumb, filled and highlighted, stays in the row (it still opens the menu to change the rating). */
.msg-action-btn.msg-action-feedback.is-rated-good,
.msg-action-btn.msg-action-feedback.is-rated-bad {
  width: 30px;
  padding: 0;
  color: var(--bg);
  background: var(--text);
  border-color: var(--text);
}
.msg-action-feedback.is-rated-good svg,
.msg-action-feedback.is-rated-bad svg { fill: currentColor; }
.msg-action-btn.msg-action-feedback.is-rated-good:hover,
.msg-action-btn.msg-action-feedback.is-rated-bad:hover { opacity: .85; color: var(--bg); }
.feedback-menu-item[aria-checked="true"] { background: var(--bg-hover); font-weight: 600; }
.feedback-menu {
  position: absolute;
  left: 0;
  bottom: calc(100% + 6px);
  z-index: 30;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 190px;
  padding: 6px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: 0 8px 24px var(--shadow-overlay, rgba(0, 0, 0, 0.25));
}
.feedback-menu[hidden] { display: none; }
.feedback-menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 12px;
  font-size: .9rem;
  text-align: left;
  color: var(--text);
  background: transparent;
  border: 0;
  border-radius: 9px;
  cursor: pointer;
}
.feedback-menu-item svg { flex: none; color: var(--text-muted); }
.feedback-menu-item:hover, .feedback-menu-item:focus-visible { background: var(--bg-hover); outline: none; }

/* research-footer-1: one factual status line under the answer of a turn that executed a web search. Colour AND an icon AND
   words (never colour alone); four states, each from the stored record only (app.js researchFooterState). */
.research-footer {
  --rf-fg: var(--text-muted); --rf-bg: transparent; --rf-border: var(--border);
  display: flex; align-items: flex-start; gap: 0.45rem; width: fit-content; max-width: 100%; margin-top: 0.55rem;
  padding: 0.28rem 0.7rem 0.28rem 0.55rem; border: 1px solid var(--rf-border); border-radius: 14px;
  background: var(--rf-bg); color: var(--rf-fg); font-size: 0.78rem; line-height: 1.4; overflow-wrap: anywhere;
}
.research-footer .rf-icon { flex: none; width: 15px; height: 15px; margin-top: 0.14rem; }
.research-footer .rf-text { min-width: 0; }
/* research-footer-2: the second sentence says where the answer's information came from; the non-green chips can open the list of
   pages the search read (a real button: keyboard, aria-expanded, focus ring; the list is built by app.js with textContent only). */
.research-footer { flex-wrap: wrap; }
.research-footer.rf-has-pages .rf-text { flex: 1 1 calc(100% - 15px - 0.45rem); }
.research-footer .rf-toggle {
  display: inline-flex; align-items: center; gap: 0.35rem; margin: 0 0 0 calc(15px + 0.45rem); padding: 0.1rem 0.15rem;
  border: 0; border-radius: 4px; background: none; color: inherit; font: inherit; text-decoration: underline; cursor: pointer;
}
.research-footer .rf-toggle::after {
  content: ""; width: 0.42em; height: 0.42em; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor;
  transform: translateY(-0.12em) rotate(45deg); transition: transform 0.15s;
}
.research-footer .rf-toggle[aria-expanded="true"]::after { transform: translateY(0.1em) rotate(225deg); }
.research-footer .rf-toggle:focus-visible { outline: 2px solid currentColor; outline-offset: 2px; }
.research-footer .rf-pages { flex: 1 1 100%; min-width: 0; padding-left: calc(15px + 0.45rem); font-size: 0.74rem; }
.research-footer .rf-pages-head { margin-top: 0.2rem; font-weight: 600; }
.research-footer .rf-pages ul { margin: 0.2rem 0 0.1rem; padding-left: 1.1rem; }
.research-footer .rf-pages li { margin: 0.1rem 0; overflow-wrap: anywhere; }
.research-footer .rf-pages a { color: inherit; text-decoration: underline; }
.research-footer .rf-pages a:focus-visible { outline: 2px solid currentColor; outline-offset: 2px; border-radius: 2px; }
@media (hover: none) { .research-footer .rf-toggle { padding: 0.4rem 0.15rem; } }
.research-footer.rf-cited { --rf-fg: var(--badge-green-text); --rf-bg: var(--badge-green-bg); --rf-border: color-mix(in srgb, var(--badge-green) 38%, transparent); }
.research-footer.rf-unused { --rf-fg: #9fb2cc; --rf-bg: rgba(125, 150, 190, 0.10); --rf-border: rgba(125, 150, 190, 0.38); }
.research-footer.rf-none { --rf-fg: var(--warn-fg); --rf-bg: color-mix(in srgb, var(--warn-fg) 10%, transparent); --rf-border: color-mix(in srgb, var(--warn-fg) 42%, transparent); }
.research-footer.rf-failed { --rf-fg: var(--danger-text); --rf-bg: var(--danger-bg); --rf-border: var(--danger-border); }
[data-theme="light"] .research-footer.rf-cited { --rf-fg: #166534; }
[data-theme="light"] .research-footer.rf-none { --rf-fg: #92400e; }
[data-theme="light"] .research-footer.rf-unused { --rf-fg: #435a78; --rf-bg: rgba(71, 98, 140, 0.09); --rf-border: rgba(71, 98, 140, 0.35); }
@media (max-width: 520px) {
  .research-footer { border-radius: 12px; }
}
