/* ============================================================================
   Shared components — buttons, modal, small icon buttons, spinner.
   ========================================================================== */

/* ---------- Buttons ---------- */
.btn {
  padding: 0.45rem 0.9rem;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  border: 1px solid transparent;
  transition: background .12s, color .12s, opacity .12s;
  text-align: center;
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-primary { background: var(--accent); color: #0b0b0b; }
.btn-primary:hover:not(:disabled) { background: var(--accent-hover); }

.btn-danger { background: var(--danger); color: #0b0b0b; }
.btn-danger:hover:not(:disabled) { filter: brightness(0.92); }

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border-color: var(--border);
}
.btn-ghost:hover:not(:disabled) {
  background: var(--bg-hover);
  color: var(--text-primary);
}

/* ---------- Modal ---------- */
.modal {
  border: none;
  padding: 0;
  background: var(--bg-surface);
  color: var(--text-primary);
  border-radius: var(--radius);
  max-width: 440px;
  width: 90%;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.55);
  margin: auto;
}
.modal::backdrop {
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(3px);
}

.modal-body {
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.modal-body h3 {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 0.15rem;
}

.modal-message {
  color: var(--text-muted);
  font-size: 12.5px;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: var(--font-mono);
  background: var(--bg-code);
  padding: 0.7rem 0.85rem;
  border-radius: var(--radius-sm);
  max-height: 260px;
  overflow-y: auto;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.4rem;
  margin-top: 0.85rem;
}

/* ---------- Small icon-only buttons (shared) ---------- */
.msg-action,
.side-icon-btn {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  padding: 0;
  color: var(--text-muted);
  border-radius: var(--radius-sm);
  flex-shrink: 0;
  transition: background .12s, color .12s;
}
.msg-action:hover,
.side-icon-btn:hover {
  background: var(--bg-surface);
  color: var(--text-primary);
}
.msg-action .icon,
.side-icon-btn .icon { width: 14px; height: 14px; }

/* ---------- Spinner (used by CoT + sidebar loading) ---------- */
.cot-spinner {
  display: inline-block;
  width: 10px;
  height: 10px;
  border: 1.5px solid currentColor;
  border-top-color: transparent;
  border-radius: 50%;
  animation: mc-spin 0.8s linear infinite;
  flex-shrink: 0;
}
@keyframes mc-spin { to { transform: rotate(360deg); } }