/* =============================================================================
   Feedback — Submit form, profile section, admin badge + popup, thread views
   ============================================================================= */

/* --- Submit Widget Form (inside .floating-feedback-panel) --- */

.floating-feedback-panel {
  width: 320px;
}

.feedback-form {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.feedback-type-selector {
  display: flex;
  gap: 0.25rem;
}

.feedback-type-btn {
  flex: 1;
  padding: 0.35rem 0.5rem;
  font-size: 0.75rem;
  border: 1px solid var(--border-primary);
  border-radius: 4px;
  background: var(--bg-secondary);
  color: var(--text-secondary);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.feedback-type-btn:hover {
  background: var(--bg-hover);
}

.feedback-type-btn.active {
  background: var(--accent-red);
  color: #ffffff;
  border-color: var(--accent-red);
}

.feedback-textarea {
  width: 100%;
  padding: 0.5rem;
  background: var(--bg-secondary);
  border: 1px solid var(--border-primary);
  border-radius: 4px;
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.85rem;
  resize: vertical;
}

.feedback-textarea::placeholder {
  color: var(--text-disabled);
}

.feedback-textarea:focus {
  outline: none;
  border-color: var(--accent-red);
}

.feedback-success {
  text-align: center;
}

.feedback-success .message-box {
  margin-bottom: 0.75rem;
}

/* --- Profile Section --- */

.feedback-profile-section {
  margin-top: 2rem;
  border-top: 1px solid var(--border-primary);
  padding-top: 1.5rem;
}

.feedback-profile-section h3 {
  margin: 0 0 1rem 0;
  font-size: 1.1rem;
  color: var(--text-primary);
}

.feedback-item-row {
  cursor: pointer;
  transition: background 0.15s;
}

.feedback-item-row:hover {
  background: var(--bg-hover);
}

/* --- Thread View (shared by profile and admin) --- */

.feedback-thread {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.feedback-thread-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.feedback-thread-meta {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.feedback-thread-info {
  margin-bottom: 0.5rem;
}

.feedback-thread-info .admin-table {
  font-size: 0.85rem;
}

.feedback-thread-info .admin-table td:first-child {
  font-weight: 600;
  color: var(--text-muted);
  width: 60px;
}

.feedback-message {
  padding: 0.75rem;
  border-radius: 6px;
  border: 1px solid var(--border-primary);
  background: var(--bg-secondary);
}

.feedback-message.original {
  border-left: 3px solid var(--accent-red);
}

.feedback-message.admin {
  border-left: 3px solid var(--info);
  background: var(--info-bg);
}

.feedback-message.user {
  border-left: 3px solid var(--text-muted);
}

.feedback-message-meta {
  display: flex;
  justify-content: space-between;
  margin-bottom: 0.35rem;
  font-size: 0.75rem;
}

.feedback-author {
  font-weight: 600;
  color: var(--text-secondary);
}

.feedback-timestamp {
  color: var(--text-muted);
}

.feedback-message-body {
  font-size: 0.85rem;
  color: var(--text-primary);
  white-space: pre-wrap;
  line-height: 1.4;
}

.feedback-messages {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.feedback-reply {
  margin-top: 0.5rem;
}

.feedback-reply-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

/* --- Admin Badge (eyebrow bar) --- */

.feedback-admin-trigger {
  position: relative;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1.1rem;
  color: var(--text-secondary);
  padding: 0.25rem 0.5rem;
  transition: color 0.15s;
}

.feedback-admin-trigger:hover {
  color: var(--text-primary);
}

.feedback-badge-count {
  position: absolute;
  top: -2px;
  right: 0;
  background: var(--accent-red);
  color: #ffffff;
  font-size: 0.6rem;
  font-weight: 700;
  min-width: 16px;
  height: 16px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 3px;
}

/* --- Admin Popup --- */

.feedback-admin-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1100;
  background: rgba(0, 0, 0, 0.3);
}

.feedback-admin-popup {
  position: fixed;
  top: 3.5rem;
  right: 2rem;
  z-index: 1101;
  width: 480px;
  max-height: calc(100vh - 5rem);
  overflow-y: auto;
  background: var(--bg-primary);
  border: 1px solid var(--border-primary);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.6);
  padding: 1rem 1.25rem;
}

.feedback-admin-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
  border-bottom: 2px solid var(--accent-red);
  padding-bottom: 0.5rem;
}

.feedback-admin-header h3 {
  margin: 0;
  font-size: 1rem;
  color: var(--text-primary);
}

.feedback-admin-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.3rem;
  cursor: pointer;
  padding: 0 0.25rem;
}

.feedback-admin-close:hover {
  color: var(--text-primary);
}

/* Tabs */
.feedback-admin-tabs {
  display: flex;
  gap: 0;
  margin-bottom: 0.75rem;
  border-bottom: 1px solid var(--border-primary);
}

.feedback-tab {
  padding: 0.5rem 1rem;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 0.85rem;
  transition: color 0.15s, border-color 0.15s;
}

.feedback-tab:hover {
  color: var(--text-primary);
}

.feedback-tab.active {
  color: var(--accent-red);
  border-bottom-color: var(--accent-red);
}

/* Item cards in admin list */
.feedback-admin-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.feedback-admin-item {
  padding: 0.75rem;
  border: 1px solid var(--border-primary);
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

.feedback-admin-item:hover {
  background: var(--bg-hover);
  border-color: var(--border-emphasis);
}

.feedback-admin-item-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.25rem;
}

.feedback-admin-email {
  font-weight: 500;
  color: var(--text-primary);
  font-size: 0.85rem;
}

.feedback-admin-item-preview {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-bottom: 0.25rem;
}

.feedback-admin-item-date {
  font-size: 0.7rem;
  color: var(--text-muted);
}

/* Responsive */
@media (max-width: 768px) {
  .feedback-admin-popup {
    width: calc(100vw - 2rem);
    right: 1rem;
    top: 4rem;
  }

  .floating-feedback-panel {
    width: calc(100vw - 2rem);
  }

  /* Feedback table: Type fits, Message truncates, Status fits */
  .feedback-profile-section .admin-table {
    table-layout: fixed;
    width: 100%;
  }

  .feedback-profile-section .admin-table th:first-child,
  .feedback-profile-section .admin-table td:first-child {
    width: 3.5rem;
    white-space: nowrap;
    overflow: visible;
  }

  .feedback-profile-section .admin-table td:nth-child(2) {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .feedback-profile-section .admin-table th:nth-child(3),
  .feedback-profile-section .admin-table td:nth-child(3) {
    width: 4rem;
    white-space: nowrap;
  }
}
