/* CipherKit — feedback.css
   Feedback & Error Reporting Widget — Three layers:
   1. Passive thumbs bar (bottom of tool content)
   2. FAB (floating action button, bottom-right)
   3. Popover (context-aware feedback/report form) */

/* ── LAYER 1: PASSIVE THUMBS BAR ─────────────────────────────────────────── */
.ck-feedback-bar {
  position: sticky;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--sf2);
  border-top: 1px solid var(--border);
  padding: 10px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  z-index: 50;
  transition: opacity .3s, transform .3s;
}
.ck-feedback-bar.hidden {
  opacity: 0;
  transform: translateY(100%);
  pointer-events: none;
}
.ck-feedback-bar-label {
  font-size: 12px;
  color: var(--muted);
}
.ck-feedback-bar-btns {
  display: flex;
  gap: 12px;
}
.ck-feedback-vote-btn {
  background: none;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 6px 10px;
  cursor: pointer;
  transition: all .2s;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  color: var(--muted);
}
.ck-feedback-vote-btn:hover {
  border-color: var(--green);
  background: rgba(61,214,140,.06);
}
.ck-feedback-vote-btn svg {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.8;
  transition: all .2s;
}
.ck-feedback-vote-btn.voted-yes {
  border-color: var(--green);
  background: rgba(61,214,140,.12);
  color: var(--green);
}
.ck-feedback-vote-btn.voted-yes svg {
  fill: var(--green);
  stroke: var(--green);
}
.ck-feedback-vote-btn.voted-no {
  border-color: var(--red);
  background: rgba(229,83,75,.12);
  color: var(--red);
}
.ck-feedback-vote-btn.voted-no svg {
  fill: var(--red);
  stroke: var(--red);
}

/* ── LAYER 2: FAB (Floating Action Button) ──────────────────────────────── */
.ck-fab {
  position: fixed;
  bottom: 28px;
  right: 28px;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: #111;
  border: 1px solid #1e1e1e;
  display: grid;
  place-items: center;
  cursor: pointer;
  z-index: 9000;
  transition: all .25s;
  box-shadow: 0 4px 12px rgba(0,0,0,.3);
}
.ck-fab:hover {
  border-color: #333;
  transform: scale(1.05);
}
.ck-fab svg {
  width: 22px;
  height: 22px;
  stroke: #555;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: stroke .25s;
}
.ck-fab:hover svg {
  stroke: #888;
}

/* Error state */
.ck-fab.error {
  border-color: rgba(255,80,80,0.5);
  animation: ck-fab-pulse 1.8s ease-in-out infinite;
}
.ck-fab.error svg {
  stroke: #ff6b6b;
}
@keyframes ck-fab-pulse {
  0%, 100% {
    box-shadow: 0 4px 12px rgba(0,0,0,.3), 0 0 0 0 rgba(255,107,107,0.4);
  }
  50% {
    box-shadow: 0 4px 12px rgba(0,0,0,.3), 0 0 0 8px rgba(255,107,107,0);
  }
}

/* Success state */
.ck-fab.success svg {
  stroke: var(--green);
}
.ck-fab.success {
  animation: ck-fab-pulse-green .8s ease-out;
}
@keyframes ck-fab-pulse-green {
  0% {
    box-shadow: 0 4px 12px rgba(0,0,0,.3), 0 0 0 0 rgba(61,214,140,0.5);
  }
  100% {
    box-shadow: 0 4px 12px rgba(0,0,0,.3), 0 0 0 12px rgba(61,214,140,0);
  }
}

/* ── LAYER 3: POPOVER ────────────────────────────────────────────────────── */
.ck-feedback-popover {
  position: fixed;
  bottom: 84px;
  right: 28px;
  width: 300px;
  background: #131313;
  border: 1px solid #222;
  border-radius: 14px;
  box-shadow: 0 12px 32px rgba(0,0,0,.6);
  padding: 0;
  z-index: 9001;
  opacity: 0;
  transform: scale(0.92) translateY(10px);
  transform-origin: bottom right;
  pointer-events: none;
  transition: opacity .22s cubic-bezier(0.34, 1.56, 0.64, 1),
              transform .22s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.ck-feedback-popover.show {
  opacity: 1;
  transform: scale(1) translateY(0);
  pointer-events: all;
}

.ck-fp-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 18px;
  border-bottom: 1px solid #222;
}
.ck-fp-title {
  font-family: var(--sans);
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
}
.ck-fp-close {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  padding: 4px;
  transition: color .15s;
}
.ck-fp-close:hover {
  color: var(--text);
}

.ck-fp-body {
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* Error chip */
.ck-fp-error-chip {
  background: rgba(255,80,80,.08);
  border: 1px solid rgba(255,80,80,.2);
  border-radius: 6px;
  padding: 10px 12px;
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 11px;
  color: #ff8080;
  line-height: 1.5;
}
.ck-fp-error-chip svg {
  flex-shrink: 0;
  width: 14px;
  height: 14px;
  stroke: currentColor;
  margin-top: 1px;
}
.ck-fp-error-text {
  font-family: var(--mono);
  word-break: break-word;
}

/* Debug toggle */
.ck-fp-debug-toggle {
  background: #0a0a0a;
  border: 1px solid #1e1e1e;
  border-radius: 6px;
  padding: 12px;
}
.ck-fp-debug-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}
.ck-fp-debug-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
}
.ck-fp-toggle {
  position: relative;
  width: 38px;
  height: 20px;
  background: #1e1e1e;
  border-radius: 10px;
  cursor: pointer;
  transition: background .2s;
}
.ck-fp-toggle.on {
  background: var(--green);
}
.ck-fp-toggle::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  background: #fff;
  border-radius: 50%;
  transition: transform .2s;
}
.ck-fp-toggle.on::after {
  transform: translateX(18px);
}
.ck-fp-debug-sublabel {
  font-size: 10px;
  color: var(--muted);
  line-height: 1.4;
}

/* Preview section */
.ck-fp-preview {
  margin-top: 8px;
  max-height: 0;
  overflow: hidden;
  transition: max-height .3s;
}
.ck-fp-preview.show {
  max-height: 180px;
}
.ck-fp-preview-box {
  background: #0a0a0a;
  border: 1px solid #1e1e1e;
  border-radius: 4px;
  padding: 8px;
  max-height: 120px;
  overflow-y: auto;
  font-size: 10px;
  font-family: var(--mono);
  color: var(--muted);
  line-height: 1.6;
}
.ck-fp-preview-row {
  margin-bottom: 6px;
}
.ck-fp-preview-row:last-child {
  margin-bottom: 0;
}
.ck-fp-preview-label {
  color: var(--green);
  font-weight: 600;
}
.ck-fp-preview-value {
  color: var(--muted);
  word-break: break-word;
}

/* Thumb buttons (for normal feedback) */
.ck-fp-thumbs {
  display: flex;
  gap: 12px;
  justify-content: center;
}
.ck-fp-thumb-btn {
  flex: 1;
  background: #0a0a0a;
  border: 1px solid #1e1e1e;
  border-radius: 8px;
  padding: 16px 12px;
  cursor: pointer;
  transition: all .2s;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}
.ck-fp-thumb-btn:hover {
  border-color: var(--border);
  background: #111;
}
.ck-fp-thumb-btn.selected {
  border-color: var(--green);
  background: rgba(61,214,140,.08);
}
.ck-fp-thumb-btn svg {
  width: 28px;
  height: 28px;
  stroke: var(--muted);
  fill: none;
  stroke-width: 1.8;
  transition: all .2s;
}
.ck-fp-thumb-btn:hover svg,
.ck-fp-thumb-btn.selected svg {
  stroke: var(--green);
}
.ck-fp-thumb-btn:hover svg circle,
.ck-fp-thumb-btn.selected svg circle {
  fill: rgba(61,214,140,.15);
}
.ck-fp-thumb-btn.negative svg {
  stroke: var(--muted);
}
.ck-fp-thumb-btn.negative:hover svg,
.ck-fp-thumb-btn.negative.selected svg {
  stroke: var(--red);
}
.ck-fp-thumb-btn.negative:hover svg circle,
.ck-fp-thumb-btn.negative.selected svg circle {
  fill: rgba(229,83,75,.15);
}

/* Comment textarea */
.ck-fp-textarea {
  width: 100%;
  background: #0a0a0a;
  border: 1px solid #1e1e1e;
  border-radius: 6px;
  padding: 10px 12px;
  color: var(--text);
  font-family: var(--mono);
  font-size: 12px;
  resize: vertical;
  min-height: 50px;
  max-height: 120px;
  outline: none;
  transition: border-color .2s;
}
.ck-fp-textarea:focus {
  border-color: var(--green);
}
.ck-fp-textarea::placeholder {
  color: var(--muted);
}

/* Submit button */
.ck-fp-submit {
  width: 100%;
  background: #00ff88;
  color: #0a0a0a;
  border: none;
  border-radius: 8px;
  padding: 11px 16px;
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: all .2s;
}
.ck-fp-submit:hover {
  background: #32c27d;
}
.ck-fp-submit:disabled {
  background: #1e1e1e;
  color: #555;
  cursor: not-allowed;
}
.ck-fp-submit.sent {
  background: #1e1e1e;
  color: var(--green);
  cursor: default;
}

/* ── RESPONSIVE ──────────────────────────────────────────────────────────── */
@media (max-width: 480px) {
  .ck-feedback-popover {
    right: 16px;
    left: 16px;
    width: auto;
  }
  .ck-fab {
    bottom: 20px;
    right: 20px;
  }
}
