/* =====================================================
   ADMIN FEEDBACK — MINIMAL ELEGANT (v2)
   ===================================================== */

#adminFeedbackView .afv-shell {
  --afv-bg: #ffffff;
  --afv-bg-faint: #fbfafd;
  --afv-border: rgba(124, 58, 237, 0.08);
  --afv-border-hover: rgba(124, 58, 237, 0.18);
  --afv-text: #0f0f1a;
  --afv-text-soft: #4b4b66;
  --afv-muted: #8a8aa3;
  --afv-faint: rgba(124, 58, 237, 0.04);
  --afv-accent: #7c3aed;
  --afv-accent-hover: #6d28d9;

  max-width: 760px;
  margin: 0 auto;
  padding: 56px 28px 96px;
  display: flex;
  flex-direction: column;
  gap: 28px;
  color: var(--afv-text);
}

[data-theme="dark"] #adminFeedbackView .afv-shell,
html:not([data-theme="light"]) #adminFeedbackView .afv-shell {
  --afv-bg: rgba(255, 255, 255, 0.03);
  --afv-bg-faint: rgba(255, 255, 255, 0.015);
  --afv-border: rgba(167, 139, 250, 0.1);
  --afv-border-hover: rgba(167, 139, 250, 0.22);
  --afv-text: #f1f5f9;
  --afv-text-soft: rgba(241, 245, 249, 0.78);
  --afv-muted: rgba(241, 245, 249, 0.5);
  --afv-faint: rgba(167, 139, 250, 0.05);
  --afv-accent: #a78bfa;
  --afv-accent-hover: #c4b5fd;
}

/* ---------- Head ---------- */
#adminFeedbackView .afv-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 4px;
}

#adminFeedbackView .afv-title {
  font-size: 26px;
  letter-spacing: -0.02em;
  font-weight: 700;
  margin: 0;
  color: var(--afv-text);
  line-height: 1.2;
}

#adminFeedbackView .afv-counter {
  font-size: 14px;
  font-weight: 500;
  color: var(--afv-muted);
  margin-left: 8px;
  letter-spacing: 0;
}

#adminFeedbackView .afv-counter:empty {
  display: none;
}

#adminFeedbackView .afv-icon-btn {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: transparent;
  border: 1px solid var(--afv-border);
  color: var(--afv-muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: color 0.15s ease, background 0.15s ease, border-color 0.15s ease;
  flex-shrink: 0;
}

#adminFeedbackView .afv-icon-btn:hover {
  color: var(--afv-accent);
  background: var(--afv-faint);
  border-color: var(--afv-border-hover);
}

#adminFeedbackView .afv-icon-btn:active {
  transform: scale(0.95);
}

#adminFeedbackView .afv-icon-btn.is-loading svg {
  animation: afv-spin 0.85s linear infinite;
}

/* ---------- Toolbar ---------- */
#adminFeedbackView .afv-toolbar {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

#adminFeedbackView .afv-tabs {
  display: inline-flex;
  gap: 2px;
  padding: 4px;
  background: var(--afv-faint);
  border-radius: 12px;
}

#adminFeedbackView .afv-tab {
  appearance: none;
  border: none;
  background: transparent;
  padding: 8px 16px;
  border-radius: 9px;
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  color: var(--afv-muted);
  cursor: pointer;
  transition: color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  letter-spacing: -0.01em;
}

#adminFeedbackView .afv-tab:hover {
  color: var(--afv-text);
}

#adminFeedbackView .afv-tab.is-active {
  color: var(--afv-accent);
  background: var(--afv-bg);
  box-shadow: 0 1px 3px rgba(124, 58, 237, 0.08), 0 0 0 1px var(--afv-border);
  font-weight: 600;
}

#adminFeedbackView .afv-tab-count {
  font-size: 11.5px;
  font-weight: 500;
  color: var(--afv-muted);
  font-variant-numeric: tabular-nums;
  padding: 1px 7px;
  border-radius: 99px;
  background: var(--afv-bg);
  border: 1px solid var(--afv-border);
  min-width: 22px;
  text-align: center;
}

#adminFeedbackView .afv-tab.is-active .afv-tab-count {
  color: var(--afv-accent);
  background: var(--afv-faint);
  border-color: transparent;
}

#adminFeedbackView .afv-tab-count:empty {
  display: none;
}

#adminFeedbackView .afv-search {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  /* Sit right next to the tabs as one cohesive filter cluster (a fixed,
     comfortable width). NOT stretched (looked half-empty) and NOT pushed to the
     far right with margin-left:auto (left a big empty gap / floated alone).
     Height matches the segmented tabs. */
  flex: 0 1 auto;
  width: 260px;
  min-width: 160px;
  max-width: 100%;
  padding: 10px 14px;
  background: var(--afv-bg-faint);
  border: 1px solid var(--afv-border);
  border-radius: 12px;
  color: var(--afv-muted);
  transition: border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease, color 0.18s ease;
}

#adminFeedbackView .afv-search:hover {
  border-color: var(--afv-border-hover);
  background: var(--afv-bg);
}

#adminFeedbackView .afv-search:focus-within {
  border-color: var(--afv-accent);
  background: var(--afv-bg);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--afv-accent) 15%, transparent);
  color: var(--afv-text);
}

#adminFeedbackView .afv-search svg {
  flex-shrink: 0;
  opacity: 0.55;
  transition: opacity 0.18s ease, color 0.18s ease;
}

#adminFeedbackView .afv-search:focus-within svg {
  opacity: 1;
  color: var(--afv-accent);
}

#adminFeedbackView .afv-search input {
  flex: 1;
  /* !important to defeat the global `input { border/background !important }` reset
     in minimal.css — otherwise the inner input renders its own box (double border). */
  border: none !important;
  outline: none !important;
  background: transparent !important;
  box-shadow: none !important;
  min-height: 0 !important;
  height: auto !important;
  padding: 0 !important;
  font: inherit;
  font-size: 13px;
  letter-spacing: 0.01em;
  color: var(--afv-text) !important;
  min-width: 0;
}

#adminFeedbackView .afv-search input::placeholder {
  color: var(--afv-muted);
  opacity: 0.85;
}

/* ---------- List ---------- */
#adminFeedbackView .afv-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* ---------- Card ---------- */
#adminFeedbackView .afv-card {
  padding: 20px 22px;
  border-radius: 14px;
  background: var(--afv-bg);
  border: 1px solid var(--afv-border);
  animation: afv-fade-in 0.25s ease;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

#adminFeedbackView .afv-card:hover {
  border-color: var(--afv-border-hover);
  box-shadow: 0 3px 14px rgba(124, 58, 237, 0.05);
}

#adminFeedbackView .afv-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

#adminFeedbackView .afv-user {
  display: inline-flex;
  align-items: baseline;
  gap: 10px;
  min-width: 0;
  flex-wrap: wrap;
}

#adminFeedbackView .afv-user-name {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--afv-accent);
  /* Show the full email/username — the previous nowrap+ellipsis+max-width:240
     clipped longer addresses (and the source chip that used to live inside).
     Wrap long unbroken strings instead of cutting them off. */
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
  max-width: 100%;
  letter-spacing: -0.005em;
}

#adminFeedbackView .afv-user-sub {
  font-size: 12px;
  color: var(--afv-muted);
  letter-spacing: 0;
  font-variant-numeric: tabular-nums;
}

/* Status pill */
#adminFeedbackView .afv-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 600;
  padding: 4px 11px;
  border-radius: 99px;
  white-space: nowrap;
  letter-spacing: 0.01em;
  flex-shrink: 0;
}

#adminFeedbackView .afv-status::before {
  content: "";
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
}

#adminFeedbackView .afv-status--new {
  background: rgba(124, 58, 237, 0.08);
  color: #6d28d9;
}

#adminFeedbackView .afv-status--replied {
  background: rgba(16, 185, 129, 0.1);
  color: #059669;
}

[data-theme="dark"] #adminFeedbackView .afv-status--new,
html:not([data-theme="light"]) #adminFeedbackView .afv-status--new {
  background: rgba(167, 139, 250, 0.16);
  color: #c4b5fd;
}

[data-theme="dark"] #adminFeedbackView .afv-status--replied,
html:not([data-theme="light"]) #adminFeedbackView .afv-status--replied {
  background: rgba(16, 185, 129, 0.16);
  color: #6ee7b7;
}

/* Message */
#adminFeedbackView .afv-message {
  font-size: 14.5px;
  line-height: 1.55;
  color: var(--afv-text);
  font-weight: 400;
  white-space: pre-wrap;
  word-break: break-word;
  letter-spacing: -0.005em;
}

/* Reply */
#adminFeedbackView .afv-reply {
  margin-top: 14px;
  padding: 12px 16px;
  border-radius: 11px;
  background: var(--afv-bg-faint);
  border-left: 2px solid var(--afv-accent);
}

#adminFeedbackView .afv-reply-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}

#adminFeedbackView .afv-reply-title {
  font-size: 10px;
  font-weight: 700;
  color: var(--afv-accent);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

#adminFeedbackView .afv-reply-edit {
  appearance: none;
  background: transparent;
  border: none;
  color: var(--afv-muted);
  font: inherit;
  font-size: 11.5px;
  cursor: pointer;
  padding: 0;
  transition: color 0.15s ease;
}

#adminFeedbackView .afv-reply-edit:hover {
  color: var(--afv-accent);
}

#adminFeedbackView .afv-reply-text {
  font-size: 13.5px;
  line-height: 1.55;
  color: var(--afv-text-soft);
  white-space: pre-wrap;
  word-break: break-word;
}

/* Card actions */
#adminFeedbackView .afv-card-actions {
  margin-top: 14px;
}

/* ---------- Buttons ---------- */
#adminFeedbackView .afv-btn {
  appearance: none;
  border: none;
  cursor: pointer;
  font: inherit;
  font-size: 12.5px;
  font-weight: 500;
  padding: 7px 16px;
  border-radius: 9px;
  transition: all 0.15s ease;
  line-height: 1.2;
  letter-spacing: -0.005em;
}

#adminFeedbackView .afv-btn--ghost {
  background: transparent;
  color: var(--afv-muted);
}

#adminFeedbackView .afv-btn--ghost:hover {
  color: var(--afv-text);
  background: var(--afv-faint);
}

#adminFeedbackView .afv-btn--primary {
  color: #fff;
  background: var(--afv-accent);
  box-shadow: 0 1px 3px rgba(124, 58, 237, 0.2);
}

#adminFeedbackView .afv-btn--primary:hover {
  background: var(--afv-accent-hover);
  box-shadow: 0 3px 10px rgba(124, 58, 237, 0.28);
  transform: translateY(-1px);
}

#adminFeedbackView .afv-btn--primary:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

#adminFeedbackView .afv-btn--link {
  background: transparent;
  border: 1px solid var(--afv-border);
  color: var(--afv-accent);
  padding: 6px 14px;
  border-radius: 8px;
  font-size: 12.5px;
  font-weight: 500;
}

#adminFeedbackView .afv-btn--link:hover {
  background: var(--afv-faint);
  border-color: var(--afv-border-hover);
}

/* ---------- Inline reply form ---------- */
#adminFeedbackView .afv-reply-form {
  margin-top: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  animation: afv-fade-in 0.15s ease;
}

#adminFeedbackView .afv-textarea {
  width: 100%;
  min-height: 70px;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid var(--afv-border);
  background: var(--afv-bg-faint);
  color: var(--afv-text);
  font: inherit;
  font-size: 13.5px;
  line-height: 1.55;
  resize: vertical;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

#adminFeedbackView .afv-textarea:focus {
  outline: none;
  border-color: var(--afv-accent);
  box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.08);
  background: var(--afv-bg);
}

#adminFeedbackView .afv-textarea::placeholder {
  color: var(--afv-muted);
}

#adminFeedbackView .afv-form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

/* ---------- States ---------- */
#adminFeedbackView .afv-state {
  padding: 64px 24px;
  text-align: center;
  color: var(--afv-muted);
  font-size: 14px;
}

#adminFeedbackView .afv-skeleton {
  padding: 20px 22px;
  border-radius: 14px;
  background: var(--afv-bg);
  border: 1px solid var(--afv-border);
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 12px;
}

#adminFeedbackView .afv-skeleton-row {
  height: 10px;
  border-radius: 5px;
  background: linear-gradient(90deg, var(--afv-faint) 0%, rgba(124, 58, 237, 0.08) 50%, var(--afv-faint) 100%);
  background-size: 200% 100%;
  animation: afv-shimmer 1.4s ease-in-out infinite;
}

[data-theme="dark"] #adminFeedbackView .afv-skeleton-row,
html:not([data-theme="light"]) #adminFeedbackView .afv-skeleton-row {
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.04) 0%, rgba(255, 255, 255, 0.08) 50%, rgba(255, 255, 255, 0.04) 100%);
  background-size: 200% 100%;
}

#adminFeedbackView .afv-skeleton-row:nth-child(1) { width: 35%; }
#adminFeedbackView .afv-skeleton-row:nth-child(2) { width: 88%; }
#adminFeedbackView .afv-skeleton-row:nth-child(3) { width: 60%; }

/* ---------- Animations ---------- */
@keyframes afv-spin {
  to { transform: rotate(360deg); }
}

@keyframes afv-fade-in {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes afv-shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ---------- Responsive ---------- */
@media (max-width: 680px) {
  #adminFeedbackView .afv-shell {
    padding: 28px 16px 64px;
    gap: 22px;
  }

  #adminFeedbackView .afv-title {
    font-size: 22px;
  }

  #adminFeedbackView .afv-toolbar {
    gap: 10px;
  }

  #adminFeedbackView .afv-search {
    max-width: none;
    width: 100%;
    margin-left: 0;
  }

  #adminFeedbackView .afv-user-name {
    max-width: 100%;
  }

  #adminFeedbackView .afv-card {
    padding: 16px 16px;
  }

  #adminFeedbackView .afv-card-head {
    flex-wrap: wrap;
  }
}

/* Hide legacy markup */
#adminFeedbackView #adminFeedbackTabs {
  display: none !important;
}

/* Inline "Ответить" link — minimal */
#adminFeedbackView .afv-reply-link {
  appearance: none;
  border: none;
  background: transparent;
  color: var(--afv-accent);
  font: inherit;
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  padding: 4px 0;
  transition: opacity 0.15s ease;
  letter-spacing: -0.005em;
  opacity: 0.65;
}
#adminFeedbackView .afv-card:hover .afv-reply-link {
  opacity: 1;
}
#adminFeedbackView .afv-reply-link:hover {
  text-decoration: underline;
  opacity: 1;
}
