/* ═══════════════════════════════════════════
   Standalone Prototype Feedback System
   ═══════════════════════════════════════════ */

/* ── Floating Action Button ── */
.fb-fab {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9998;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: #6b2d8b;
  color: white;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 20px rgba(107, 45, 139, 0.4);
  transition: all 0.3s ease;
  animation: fb-pulse 3s ease-in-out infinite;
}
.fb-fab:hover {
  transform: scale(1.08);
  box-shadow: 0 6px 28px rgba(107, 45, 139, 0.5);
}
.fb-fab-active {
  background: #333;
  animation: none;
}
@keyframes fb-pulse {
  0%, 100% { box-shadow: 0 4px 20px rgba(107, 45, 139, 0.4); }
  50% { box-shadow: 0 4px 30px rgba(107, 45, 139, 0.7), 0 0 0 8px rgba(107, 45, 139, 0.1); }
}

/* ── Badge ── */
.fb-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  background: #e74c3c;
  color: white;
  font-size: 11px;
  font-weight: 700;
  min-width: 20px;
  height: 20px;
  border-radius: 10px;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 0 5px;
  font-family: system-ui, sans-serif;
}

/* ── Side Panel ── */
.fb-panel {
  position: fixed;
  top: 0;
  right: -420px;
  z-index: 9999;
  width: 400px;
  max-width: 90vw;
  height: 100vh;
  background: #fff;
  box-shadow: -4px 0 30px rgba(0, 0, 0, 0.15);
  display: flex;
  flex-direction: column;
  transition: right 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}
.fb-panel-open {
  right: 0;
}

.fb-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid #eee;
  background: #f8f9fa;
}
.fb-panel-header h3 {
  font-size: 16px;
  font-weight: 700;
  color: #1a1a2e;
  margin: 0;
}
.fb-panel-actions {
  display: flex;
  gap: 4px;
}

.fb-panel-path {
  padding: 8px 20px;
  font-size: 12px;
  color: #888;
  background: #fafafa;
  border-bottom: 1px solid #eee;
  font-family: monospace;
}

.fb-author-row {
  padding: 12px 20px;
  border-bottom: 1px solid #eee;
}

/* ── Inputs ── */
.fb-input {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid #ddd;
  border-radius: 8px;
  font-size: 13px;
  outline: none;
  transition: border-color 0.2s;
  box-sizing: border-box;
  font-family: inherit;
}
.fb-input:focus {
  border-color: #6b2d8b;
  box-shadow: 0 0 0 3px rgba(107, 45, 139, 0.1);
}

.fb-textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #ddd;
  border-radius: 8px;
  font-size: 13px;
  outline: none;
  resize: vertical;
  min-height: 70px;
  transition: border-color 0.2s;
  box-sizing: border-box;
  font-family: inherit;
}
.fb-textarea:focus {
  border-color: #6b2d8b;
  box-shadow: 0 0 0 3px rgba(107, 45, 139, 0.1);
}

/* ── Buttons ── */
.fb-btn-icon {
  width: 36px;
  height: 36px;
  border: none;
  background: transparent;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #666;
  transition: all 0.2s;
}
.fb-btn-icon:hover {
  background: #eee;
  color: #333;
}
.fb-btn-active {
  background: #6b2d8b !important;
  color: white !important;
}

.fb-submit {
  width: 100%;
  padding: 10px;
  background: #6b2d8b;
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
  font-family: inherit;
}
.fb-submit:hover {
  background: #5a2578;
}
.fb-submit:disabled {
  background: #999;
  cursor: not-allowed;
}

/* ── Comments List ── */
.fb-comments-list {
  flex: 1;
  overflow-y: auto;
  padding: 12px 20px;
}

.fb-empty {
  text-align: center;
  color: #aaa;
  font-size: 13px;
  padding: 40px 20px;
  line-height: 1.6;
}

.fb-comment {
  background: #f8f9fa;
  border-radius: 10px;
  padding: 12px 14px;
  margin-bottom: 10px;
  border-left: 3px solid #6b2d8b;
  transition: opacity 0.3s;
}
.fb-comment.fb-resolved {
  opacity: 0.5;
  border-left-color: #28a745;
}
.fb-comment:hover {
  opacity: 1;
}

.fb-comment-header {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 6px;
}
.fb-comment-type {
  font-size: 14px;
}
.fb-comment-author {
  font-size: 13px;
  color: #333;
}
.fb-comment-time {
  font-size: 11px;
  color: #999;
  margin-left: auto;
}

.fb-selection-preview {
  font-size: 12px;
  color: #6b2d8b;
  background: rgba(107, 45, 139, 0.06);
  border-radius: 6px;
  padding: 6px 10px;
  margin-bottom: 6px;
  font-style: italic;
  border-left: 2px solid #6b2d8b;
}

.fb-comment-body {
  font-size: 13px;
  color: #444;
  line-height: 1.5;
  white-space: pre-wrap;
}

.fb-comment-actions {
  display: flex;
  gap: 8px;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid #eee;
}

.fb-action-btn {
  font-size: 11px;
  color: #6b2d8b;
  background: none;
  border: none;
  cursor: pointer;
  padding: 2px 0;
  font-weight: 600;
  font-family: inherit;
}
.fb-action-btn:hover {
  text-decoration: underline;
}
.fb-action-delete {
  color: #dc3545;
}

/* ── Attachments ── */
.fb-attachments {
  margin-top: 6px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.fb-attachment {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  color: #6b2d8b;
  background: rgba(107, 45, 139, 0.08);
  padding: 3px 8px;
  border-radius: 4px;
  text-decoration: none;
}
.fb-attachment:hover {
  background: rgba(107, 45, 139, 0.15);
}

/* ── New Comment Area ── */
.fb-new-comment {
  padding: 16px 20px;
  border-top: 1px solid #eee;
  background: #fafafa;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.fb-file-upload {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.fb-file-label {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  color: #666;
  cursor: pointer;
  padding: 4px 10px;
  border: 1px dashed #ccc;
  border-radius: 6px;
  transition: all 0.2s;
}
.fb-file-label:hover {
  border-color: #6b2d8b;
  color: #6b2d8b;
}
.fb-file-hidden {
  display: none;
}
.fb-file-names {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}
.fb-file-name {
  font-size: 11px;
  color: #6b2d8b;
  background: rgba(107, 45, 139, 0.08);
  padding: 2px 8px;
  border-radius: 4px;
}
.fb-file-error {
  font-size: 11px;
  color: #dc3545;
}

/* ── Selection Tooltip ── */
.fb-sel-tooltip {
  position: absolute;
  z-index: 9997;
  transform: translateX(-50%);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s;
}
.fb-sel-tooltip.fb-sel-visible {
  opacity: 1;
  pointer-events: auto;
}

.fb-sel-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #1a1a2e;
  color: white;
  border: none;
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  transition: background 0.2s;
}
.fb-sel-btn:hover {
  background: #6b2d8b;
}

/* ── Pin Overlay ── */
.fb-pin-overlay {
  position: fixed;
  inset: 0;
  z-index: 9990;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s;
}
.fb-pin-overlay-active {
  pointer-events: auto;
  opacity: 1;
  cursor: crosshair;
}
.fb-pin-banner {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  padding: 12px 20px;
  background: #6b2d8b;
  color: white;
  text-align: center;
  font-size: 14px;
  font-weight: 600;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  z-index: 9991;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* ── Pin Markers ── */
.fb-pins {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 0;
  pointer-events: none;
  z-index: 9000;
}
.fb-pin-marker {
  position: absolute;
  transform: translate(-50%, -100%);
  cursor: pointer;
  pointer-events: auto;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.3));
  transition: transform 0.2s;
  animation: fb-pin-drop 0.4s ease-out;
}
.fb-pin-marker:hover {
  transform: translate(-50%, -100%) scale(1.2);
}
@keyframes fb-pin-drop {
  0% { opacity: 0; transform: translate(-50%, -150%) scale(0.5); }
  60% { transform: translate(-50%, -95%) scale(1.05); }
  100% { opacity: 1; transform: translate(-50%, -100%) scale(1); }
}

/* ── Text Selection Highlights ── */
.fb-highlight {
  background: rgba(107, 45, 139, 0.15);
  border-bottom: 2px solid #6b2d8b;
  cursor: pointer;
  padding: 1px 0;
  border-radius: 2px;
  transition: background 0.2s;
  position: relative;
}
.fb-highlight:hover {
  background: rgba(107, 45, 139, 0.3);
}
.fb-highlight::after {
  content: "💬";
  font-size: 12px;
  position: relative;
  top: -4px;
  margin-left: 2px;
}

/* ── Mobile ── */
@media (max-width: 480px) {
  .fb-panel {
    width: 100vw;
    right: -100vw;
  }
  .fb-fab {
    bottom: 16px;
    right: 16px;
    width: 48px;
    height: 48px;
  }
}

/* ── Edit Mode ── */
/* Static dashed outline on prose-level edit targets */
body.fb-edit-mode main p,
body.fb-edit-mode main h1,
body.fb-edit-mode main h2,
body.fb-edit-mode main h3,
body.fb-edit-mode main h4,
body.fb-edit-mode main h5,
body.fb-edit-mode main h6,
body.fb-edit-mode main li,
body.fb-edit-mode main blockquote,
body.fb-edit-mode main figcaption,
body.fb-edit-mode main button {
  cursor: text;
  outline: 1px dashed rgba(107, 45, 139, 0.3);
  outline-offset: 2px;
  border-radius: 2px;
}
body.fb-edit-mode main p:hover,
body.fb-edit-mode main h1:hover,
body.fb-edit-mode main h2:hover,
body.fb-edit-mode main h3:hover,
body.fb-edit-mode main h4:hover,
body.fb-edit-mode main h5:hover,
body.fb-edit-mode main h6:hover,
body.fb-edit-mode main li:hover,
body.fb-edit-mode main blockquote:hover,
body.fb-edit-mode main figcaption:hover,
body.fb-edit-mode main button:hover {
  outline-color: #6b2d8b;
  background: rgba(107, 45, 139, 0.03);
}

/* Hover-only outline on span/div leaf containers. Keeping this hover-only
   avoids covering every structural element on the page in dashed outlines. */
body.fb-edit-mode main span:hover,
body.fb-edit-mode main div:hover {
  cursor: text;
  outline: 1px dashed #6b2d8b;
  outline-offset: 2px;
  border-radius: 2px;
}

/* Active contenteditable element */
.fb-editing {
  outline: 2px solid #6b2d8b !important;
  background: rgba(107, 45, 139, 0.05) !important;
}

/* Edit mode banner */
.fb-edit-banner {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 9995;
  background: #fef3c7;
  border-bottom: 1px solid #f59e0b;
  padding: 8px 20px;
  font-size: 13px;
  font-weight: 600;
  color: #92400e;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}
.fb-edit-banner button {
  background: #92400e;
  color: white;
  border: none;
  padding: 4px 12px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}
.fb-edit-banner button:hover {
  background: #78350f;
}

/* ── Active / Activated Comment Card ── */
.fb-comment.fb-comment-active {
  border-left-color: #f59e0b;
  background: #fffbeb;
  box-shadow: 0 0 0 2px rgba(245, 158, 11, 0.2);
}

/* ── Reopening Comment Card (mid-reopen flow) ── */
.fb-comment.fb-comment-reopening {
  border-left-color: #f59e0b;
  background: #fffbeb;
  box-shadow: 0 0 0 2px rgba(245, 158, 11, 0.25);
  opacity: 1;   /* override the dimmed look from .fb-resolved when reopening from Resolved tab */
}

/* ── Client Review Card ── */
.fb-comment.fb-client-review {
  border-left-color: #0369a1;
  opacity: 0.9;
}

/* ── Status Badges ── */
.fb-status-badge {
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 4px;
  font-weight: 600;
  margin-left: 6px;
  vertical-align: middle;
}
.fb-status-review {
  background: #e0f2fe;
  color: #0369a1;
}
.fb-status-resolved {
  background: #dcfce7;
  color: #15803d;
}

/* ── Reply Thread ── */
.fb-replies {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid #eee;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.fb-reply {
  background: #fff;
  border-left: 2px solid #ddd;
  padding: 8px 10px;
  border-radius: 6px;
  margin-left: 12px;
}
.fb-reply-header {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 4px;
}
.fb-reply-header strong {
  font-size: 12px;
  color: #555;
}
.fb-reply-body {
  font-size: 12px;
  color: #555;
  line-height: 1.4;
}

/* ── All Pages tab — color legend ── */
.fb-legend {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 8px 20px;
  background: #fafafa;
  border-bottom: 1px solid #f0f0f0;
  font-size: 11px;
  color: #666;
}
.fb-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.fb-legend-swatch {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  display: inline-block;
}

/* ── All Pages tab — per-page count badges ── */
.fb-page-badge {
  font-size: 11px;
  font-weight: 700;
  color: white;
  min-width: 24px;
  height: 24px;
  padding: 0 8px;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.fb-page-badge-open { background: #f59e0b; }
.fb-page-badge-review { background: #0369a1; }

/* ── Edited-text fallback highlight (element-level, when original text is gone) ── */
.fb-highlight-edited {
  background: rgba(107, 45, 139, 0.12);
  outline: 1px solid rgba(107, 45, 139, 0.35);
  outline-offset: 3px;
  border-radius: 2px;
  cursor: pointer;
}
.fb-highlight-edited:hover {
  background: rgba(107, 45, 139, 0.22);
}

/* ── Pin Bounce Animation ── */
@keyframes fb-pin-bounce {
  0%, 100% { transform: translate(-50%, -100%) scale(1); }
  25%       { transform: translate(-50%, -120%) scale(1.1); }
  50%       { transform: translate(-50%, -95%)  scale(0.95); }
  75%       { transform: translate(-50%, -110%) scale(1.05); }
}
.fb-pin-bounce {
  animation: fb-pin-bounce 0.7s ease-in-out !important;
}

/* ── Highlight Flash Animation ── */
@keyframes fb-highlight-flash {
  0%, 100% { background: rgba(107, 45, 139, 0.15); }
  40%      { background: rgba(107, 45, 139, 0.55); }
}
.fb-highlight-flash {
  animation: fb-highlight-flash 0.9s ease-in-out !important;
}
