/* Test hesabi: cevap geri bildirimi penceresi (docs/otomatik-iyilestirme.md)
   Suruklenebilir bagimsiz pencere; acik ve koyu temada calisir. */

.msg-action-btn.msg-feedback-btn.active {
  color: var(--brand);
  background: var(--brand-soft);
}

/* Hangi cevaba geri bildirim verildigi */
.msg.bot.fb-target .msg-bubble {
  outline: 2px solid var(--brand-soft-border);
  outline-offset: 6px;
  border-radius: 6px;
}

.fb-window {
  position: fixed;
  z-index: 900;
  width: 340px;
  max-width: calc(100vw - 16px);
  max-height: calc(100vh - 32px);
  display: flex;
  flex-direction: column;
  border: 1px solid var(--panel-border);
  border-radius: 12px;
  background: var(--panel-card, var(--panel));
  color: var(--text-primary);
  font-family: var(--font-family, system-ui, sans-serif);
  font-size: 13px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.28);
}

:root[data-theme="light"] .fb-window {
  background: #ffffff;
  border-color: rgba(15, 23, 42, 0.14);
  box-shadow: 0 12px 32px rgba(15, 23, 42, 0.18);
}

.fb-window.dragging {
  user-select: none;
  opacity: 0.94;
}

.fb-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--panel-border);
  cursor: move;
  touch-action: none;
}

.fb-head:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: -2px;
  border-radius: 12px 12px 0 0;
}

.fb-titles {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.fb-sub {
  border: 0;
  padding: 0;
  background: transparent;
  color: var(--text-muted);
  font: inherit;
  font-size: 12px;
  text-align: left;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 260px;
}

.fb-sub:hover {
  color: var(--brand);
}

.fb-close {
  border: 0;
  background: transparent;
  color: var(--text-muted);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  padding: 0 4px;
}

.fb-body {
  padding: 12px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.fb-form,
.fb-status {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.fb-label {
  color: var(--text-secondary);
  font-weight: 600;
  font-size: 12px;
}

.fb-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.fb-chip {
  border: 1px solid var(--panel-border);
  background: transparent;
  color: var(--text-secondary);
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 12px;
  cursor: pointer;
}

.fb-chip[aria-pressed="true"] {
  border-color: var(--brand-soft-border);
  background: var(--brand-soft);
  color: var(--text-primary);
}

.fb-text,
.fb-select {
  width: 100%;
  box-sizing: border-box;
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text-primary);
  font: inherit;
  padding: 8px;
  resize: vertical;
}

:root[data-theme="light"] .fb-text,
:root[data-theme="light"] .fb-select {
  background: #f8fafc;
  border-color: rgba(15, 23, 42, 0.16);
}

.fb-text:focus,
.fb-select:focus,
.fb-chip:focus-visible,
.fb-submit:focus-visible,
.fb-undo:focus-visible,
.fb-secondary:focus-visible,
.fb-link:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 1px;
}

.fb-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.fb-row .fb-select {
  width: auto;
  flex: 1;
}

.fb-submit,
.fb-secondary {
  border: 0;
  border-radius: 8px;
  background: var(--brand);
  color: #fff;
  font-weight: 600;
  padding: 8px 14px;
  cursor: pointer;
}

.fb-secondary {
  align-self: flex-start;
  padding: 6px 12px;
}

.fb-submit:disabled,
.fb-undo:disabled {
  opacity: 0.6;
  cursor: default;
}

.fb-error {
  margin: 0;
  color: var(--accent-red);
  font-size: 12px;
}

.fb-note-ok {
  margin: 0;
  color: var(--accent-green);
  font-weight: 600;
}

.fb-badge {
  align-self: flex-start;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--brand-soft);
  border: 1px solid var(--brand-soft-border);
  font-weight: 600;
  font-size: 12px;
}

.fb-badge[data-status="applied"] {
  background: var(--accent-soft);
  border-color: var(--accent-soft-border);
}

.fb-badge[data-status="failed"] {
  background: rgba(239, 68, 68, 0.1);
  border-color: rgba(239, 68, 68, 0.3);
}

.fb-events {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 300px;
  overflow-y: auto;
}

.fb-event {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 8px;
  line-height: 1.4;
}

.fb-time {
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
  font-size: 11px;
  padding-top: 1px;
}

.fb-event[data-stage="error"] .fb-msg,
.fb-event[data-stage="warning"] .fb-msg {
  color: var(--accent-red);
}

.fb-bulk {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.fb-bulk:empty,
.fb-changes:empty {
  display: none;
}

.fb-undo {
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  background: transparent;
  color: var(--text-primary);
  font-weight: 600;
  padding: 7px 12px;
  cursor: pointer;
}

.fb-change-list summary {
  cursor: pointer;
  color: var(--text-secondary);
  font-weight: 600;
  font-size: 12px;
}

.fb-change {
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  padding: 10px;
  margin-top: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.fb-change-title {
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 6px;
}

.fb-tag {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  border: 1px solid var(--panel-border);
  border-radius: 999px;
  padding: 0 6px;
}

.fb-change-sum {
  color: var(--text-secondary);
  line-height: 1.45;
}

.fb-link {
  align-self: flex-start;
  border: 0;
  padding: 0;
  background: transparent;
  color: var(--brand);
  font: inherit;
  font-size: 12px;
  cursor: pointer;
}

@media (max-width: 560px) {
  .fb-window {
    width: calc(100vw - 16px);
  }
}


/* Gecmis penceresi + baslatici (yalniz test hesabi) */
.fb-window-wide {
  width: 460px;
}

.fb-launcher {
  position: fixed;
  left: 16px;
  bottom: 16px;
  z-index: 880;
  border: 1px solid var(--brand-soft-border);
  border-radius: 999px;
  background: var(--panel-card, var(--panel));
  color: var(--text-primary);
  font: 600 12px var(--font-family, system-ui, sans-serif);
  padding: 7px 14px;
  cursor: pointer;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.22);
}

:root[data-theme="light"] .fb-launcher {
  background: #ffffff;
  box-shadow: 0 6px 18px rgba(15, 23, 42, 0.15);
}

.fb-launcher:hover,
.fb-launcher:focus-visible {
  border-color: var(--brand);
  outline: none;
}

.fb-tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--panel-border);
}

.fb-tab {
  border: 0;
  border-bottom: 2px solid transparent;
  background: transparent;
  color: var(--text-secondary);
  font: inherit;
  font-weight: 600;
  padding: 6px 10px;
  cursor: pointer;
}

.fb-tab[aria-selected="true"] {
  color: var(--text-primary);
  border-bottom-color: var(--brand);
}

.fb-tab:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: -2px;
}

.fb-tabpanel {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.fb-muted {
  margin: 0;
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1.45;
}

.fb-hist {
  display: flex;
  flex-direction: column;
}

.fb-change[data-status="rolled_back"] {
  opacity: 0.7;
}

.fb-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.fb-table th,
.fb-table td {
  text-align: left;
  padding: 6px 4px;
  border-bottom: 1px solid var(--panel-border);
}

.fb-table th {
  color: var(--text-secondary);
  font-weight: 600;
}

.fb-num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.fb-link:disabled {
  color: var(--text-muted);
  cursor: default;
}

@media (max-width: 560px) {
  .fb-window-wide {
    width: calc(100vw - 16px);
  }
}

/* Surum zinciri (Iyilestirmeler > Surumler) */
.fb-vgroup {
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  margin-top: 8px;
  overflow: hidden;
}

.fb-vhead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 10px;
  border-bottom: 1px solid var(--panel-border);
}

.fb-vrow {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 8px 10px;
  border-top: 1px solid var(--panel-border);
}

.fb-vhead + .fb-vrow {
  border-top: 0;
}

.fb-vmain {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.fb-vline {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 6px;
}

.fb-vnum {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  min-width: 24px;
}

.fb-vlabel {
  color: var(--text-primary);
  overflow-wrap: anywhere;
}

.fb-vrow[data-status="current"] {
  box-shadow: inset 3px 0 0 var(--brand);
}

.fb-vrow[data-status="current"] .fb-tag {
  color: var(--brand);
  border-color: var(--brand);
}

.fb-vrow[data-status="undone"],
.fb-vrow[data-status="dead"] {
  opacity: 0.7;
}

.fb-vrow .fb-undo {
  flex: none;
  white-space: nowrap;
}

/* Cevap basina tek oy: secili begen / begenme */
.msg-action-btn[data-vote].voted {
  color: var(--brand);
}

/* Duzeltmenin sonucu (tester begendi mi) */
.fb-outcome {
  align-self: flex-start;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
}

.fb-outcome[data-outcome="accepted"] {
  color: var(--accent-green);
}

.fb-outcome[data-outcome="rejected"] {
  color: #ef4444;
}

/* Iyilestirmeler > Rapor */
.fb-section {
  margin-top: 6px;
  font-size: 13px;
}

.fb-scroll {
  overflow-x: auto;
  max-width: 100%;
}

.fb-scroll .fb-table {
  min-width: 420px;
}

.fb-report-items {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.fb-report-item {
  display: flex;
  flex-direction: column;
  gap: 3px;
  width: 100%;
  text-align: left;
  font: inherit;
  color: inherit;
  background: transparent;
  border: 1px solid var(--panel-border);
  border-left-width: 3px;
  border-radius: 8px;
  padding: 8px 10px;
  cursor: pointer;
}

.fb-report-item:hover {
  background: var(--brand-soft);
}

.fb-report-item:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 1px;
}

.fb-report-item[data-outcome="accepted"] {
  border-left-color: var(--accent-green);
}

.fb-report-item[data-outcome="rejected"],
.fb-report-item[data-outcome="failed"] {
  border-left-color: #ef4444;
}

.fb-report-item[data-outcome="waiting"] {
  border-left-color: var(--brand);
}
