/**
 * Article Feedback — styles for the text-selection toolbar + modal that
 * `article-feedback.js` injects. Aligned to the current help-site brand
 * palette (blue / ink scale) — replaces the legacy magenta theme so the UI
 * matches the rest of the site.
 */

:root {
  --af-brand: #2563eb;
  --af-brand-dark: #1d4ed8;
  --af-brand-soft: #eef4ff;
  --af-ink-900: #0f1419;
  --af-ink-700: #404757;
  --af-ink-500: #6b7384;
  --af-ink-400: #9aa3b3;
  --af-ink-200: #dde2eb;
  --af-ink-100: #eef1f6;
  --af-ink-50: #f7f9fc;
  --af-success-bg: #ecfdf5;
  --af-success-fg: #065f46;
  --af-success-border: #a7f3d0;
  --af-error-bg: #fef2f2;
  --af-error-fg: #991b1b;
  --af-error-border: #fecaca;
}

/* ── Floating toolbar (appears on text selection) ── */
.af-toolbar {
  position: absolute;
  z-index: 10000;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  background: var(--af-brand);
  color: #ffffff;
  border-radius: 9999px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.01em;
  cursor: pointer;
  box-shadow: 0 6px 18px rgba(37, 99, 235, 0.28);
  white-space: nowrap;
  transition: background 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
  user-select: none;
  animation: af-fade-in 0.15s ease;
}
.af-toolbar:hover {
  background: var(--af-brand-dark);
  transform: translateY(-1px);
  box-shadow: 0 8px 22px rgba(37, 99, 235, 0.36);
}
.af-toolbar svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

/* ── Modal overlay ── */
.af-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 10001;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(15, 20, 25, 0.45);
  backdrop-filter: blur(4px);
  animation: af-fade-in 0.15s ease;
}

.af-modal {
  background: #ffffff;
  color: var(--af-ink-900);
  border: 1px solid var(--af-ink-200);
  border-radius: 16px;
  padding: 24px;
  width: 92%;
  max-width: 480px;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: 0 24px 64px rgba(15, 20, 25, 0.18);
  animation: af-slide-up 0.2s ease;
}

.af-modal h2 {
  margin: 0 0 4px;
  font-size: 18px;
  font-weight: 600;
  color: var(--af-ink-900);
  letter-spacing: -0.01em;
}

.af-subtitle {
  margin: 0 0 16px;
  font-size: 13px;
  color: var(--af-ink-500);
  line-height: 1.5;
}

/* ── Selected text preview ── */
.af-selected-text {
  background: var(--af-brand-soft);
  border-left: 3px solid var(--af-brand);
  padding: 10px 14px;
  margin-bottom: 16px;
  border-radius: 0 8px 8px 0;
  font-size: 13px;
  line-height: 1.5;
  color: var(--af-ink-700);
  max-height: 120px;
  overflow-y: auto;
  word-break: break-word;
}

/* ── Labels ── */
.af-label {
  display: block;
  margin-bottom: 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--af-ink-900);
}

/* ── Feedback type buttons ── */
.af-types {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}

.af-type-btn {
  padding: 6px 14px;
  border: 1px solid var(--af-ink-200);
  border-radius: 9999px;
  background: #ffffff;
  color: var(--af-ink-700);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease;
}

.af-type-btn:hover {
  border-color: var(--af-brand);
  color: var(--af-brand);
  background: var(--af-brand-soft);
}

.af-type-btn.active {
  background: var(--af-brand);
  color: #ffffff;
  border-color: var(--af-brand);
}

/* ── Comment textarea ── */
.af-comment {
  width: 100%;
  min-height: 96px;
  padding: 10px 12px;
  border: 1px solid var(--af-ink-200);
  border-radius: 10px;
  font-size: 14px;
  font-family: inherit;
  resize: vertical;
  margin-bottom: 12px;
  background: #ffffff;
  color: var(--af-ink-900);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  box-sizing: border-box;
}

.af-comment:focus {
  outline: none;
  border-color: var(--af-brand);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.16);
}

.af-comment::placeholder {
  color: var(--af-ink-400);
}

/* ── Status messages ── */
.af-status {
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 13px;
  margin-bottom: 12px;
}

.af-status-success {
  background: var(--af-success-bg);
  color: var(--af-success-fg);
  border: 1px solid var(--af-success-border);
}

.af-status-error {
  background: var(--af-error-bg);
  color: var(--af-error-fg);
  border: 1px solid var(--af-error-border);
}

/* ── Footer buttons ── */
.af-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.af-btn {
  padding: 8px 18px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.af-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.af-btn-cancel {
  background: var(--af-ink-50);
  color: var(--af-ink-700);
  border-color: var(--af-ink-200);
}

.af-btn-cancel:hover:not(:disabled) {
  background: var(--af-ink-100);
  color: var(--af-ink-900);
}

.af-btn-submit {
  background: var(--af-brand);
  color: #ffffff;
}

.af-btn-submit:hover:not(:disabled) {
  background: var(--af-brand-dark);
}

/* ── Floating feedback button (bottom-right) — currently unused on prerendered pages
   but kept styled so the script can re-enable it without further work. ── */
.af-floating-btn {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  /* Matches #docs-side-nav/#toc-list .text-brand-primary (css-builder.ts) —
     the page's actual visible blue accent — not the generic --af-brand
     blue-600 the rest of this file uses, which read off-brand next to it. */
  background: #1a78c1;
  color: #ffffff;
  border: none;
  border-radius: 9999px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(26, 120, 193, 0.30);
  transition: background 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

.af-floating-btn:hover {
  background: #15629e;
  transform: translateY(-2px);
  box-shadow: 0 10px 28px rgba(26, 120, 193, 0.40);
}

.af-floating-btn svg {
  width: 16px;
  height: 16px;
}

/* ── Animations ── */
@keyframes af-fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes af-slide-up {
  from { opacity: 0; transform: translateY(12px) scale(0.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
