/* ═══════════════════════════════════════════
   WordPress (Avada) Feedback Widget
   ═══════════════════════════════════════════ */

/* ── 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-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;
}

/* ── Viewport / device badge ── */
.fb-device-badge {
  display: inline-block;
  margin-top: 6px;
  font-size: 11px;
  color: #666;
  background: #eef0f3;
  border-radius: 4px;
  padding: 2px 8px;
}

.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;
  /* button reset */
  border: none;
  cursor: pointer;
  font-family: inherit;
  text-align: left;
}
.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;
  }
}

/* ── 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;
}

/* ── Audience Badges ── */
.fb-audience-badge {
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 4px;
  font-weight: 600;
  margin-left: 6px;
  vertical-align: middle;
}
.fb-audience-designer {
  background: #fce7f3;
  color: #be185d;
}
.fb-audience-developer {
  background: #e0e7ff;
  color: #4338ca;
}
.fb-audience-select {
  appearance: none;
  -webkit-appearance: none;
  font-size: 11px;
  font-weight: 600;
  font-family: inherit;
  padding: 2px 10px 2px 0;
  border: none;
  border-radius: 0;
  color: #6b2d8b;
  background-color: transparent;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='8' height='5' viewBox='0 0 8 5'%3E%3Cpath d='M1 1l3 3 3-3' fill='none' stroke='%236b2d8b' stroke-width='1.3' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right center;
  cursor: pointer;
}
.fb-audience-select:hover {
  text-decoration: underline;
}
.fb-audience-select:focus {
  outline: none;
  text-decoration: underline;
}
.fb-audience-select[data-audience="designer"] {
  color: #be185d;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='8' height='5' viewBox='0 0 8 5'%3E%3Cpath d='M1 1l3 3 3-3' fill='none' stroke='%23be185d' stroke-width='1.3' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}
.fb-audience-select[data-audience="developer"] {
  color: #4338ca;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='8' height='5' viewBox='0 0 8 5'%3E%3Cpath d='M1 1l3 3 3-3' fill='none' stroke='%234338ca' stroke-width='1.3' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}
.fb-audience-retag {
  margin-left: auto;
}

/* ── 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; }

/* ── Element-level fallback highlight (used when the selected text can no
   longer be found verbatim, e.g. after a content edit in WP) ── */
.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;
}

/* ── Attachment preview modal ── */
.fb-att-modal {
  position: fixed;
  inset: 0;
  z-index: 10001;       /* above the panel */
}
.fb-att-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
}
.fb-att-modal-content {
  position: relative;
  z-index: 1;
  background: #fff;
  width: min(90vw, 900px);
  max-height: 90vh;
  margin: 5vh auto;
  border-radius: 12px;
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.3);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.fb-att-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid #eee;
  background: #fafafa;
  flex-shrink: 0;
}
.fb-att-modal-title {
  font-size: 14px;
  font-weight: 600;
  color: #1a1a2e;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex: 1 1 auto;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.fb-att-modal-meta {
  font-size: 11px;
  color: #888;
  font-weight: 400;
}
.fb-att-modal-close {
  background: none;
  border: none;
  cursor: pointer;
  color: #666;
  padding: 4px;
  border-radius: 4px;
  display: flex;
  align-items: center;
}
.fb-att-modal-close:hover { background: #eee; color: #000; }

.fb-att-modal-body {
  flex: 1 1 auto;
  overflow: auto;
  padding: 16px;
  background: #f4f4f4;
  min-height: 200px;
}
.fb-att-modal-loading {
  text-align: center;
  padding: 60px 20px;
  color: #888;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 13px;
}
.fb-att-preview-image {
  display: block;
  max-width: 100%;
  max-height: 70vh;
  margin: 0 auto;
  border-radius: 4px;
  background: #fff;
}
.fb-att-preview-iframe {
  width: 100%;
  height: 70vh;
  border: none;
  background: #fff;
  border-radius: 4px;
}
.fb-att-preview-fallback {
  text-align: center;
  padding: 60px 20px;
  color: #555;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}
.fb-att-preview-icon { color: #aaa; margin-bottom: 12px; }
.fb-att-preview-msg { font-size: 14px; font-weight: 600; }
.fb-att-preview-msg-sub { font-size: 12px; color: #888; margin-top: 4px; }

.fb-att-modal-footer {
  padding: 12px 16px;
  border-top: 1px solid #eee;
  background: #fafafa;
  display: flex;
  justify-content: flex-end;
  flex-shrink: 0;
}
.fb-att-modal-download {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: #6b2d8b;
  color: white;
  border: none;
  padding: 8px 16px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}
.fb-att-modal-download:hover { background: #5a2576; }
