/* ═══════════════════════════════════════════
   Feedback Admin Dashboard
   ═══════════════════════════════════════════ */

:root {
  --purple: #6b2d8b;
  --purple-light: rgba(107, 45, 139, 0.08);
  --purple-hover: #5a2578;
  --green: #16a34a;
  --green-light: #dcfce7;
  --red: #dc2626;
  --red-light: #fee2e2;
  --blue: #2563eb;
  --blue-light: #dbeafe;
  --orange: #ea580c;
  --orange-light: #fff7ed;
  --gray-50: #f9fafb;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-300: #d1d5db;
  --gray-400: #9ca3af;
  --gray-500: #6b7280;
  --gray-600: #4b5563;
  --gray-700: #374151;
  --gray-900: #111827;
  --radius: 10px;
  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: var(--font);
  color: var(--gray-700);
  background: var(--gray-50);
  line-height: 1.5;
  font-size: 14px;
}

/* ── Nav ── */
.nav {
  background: var(--gray-900);
  color: white;
  position: sticky;
  top: 0;
  z-index: 100;
}
.nav-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 24px;
  height: 52px;
  display: flex;
  align-items: center;
  gap: 32px;
}
.nav-brand {
  font-weight: 700;
  font-size: 15px;
  color: white;
  text-decoration: none;
  letter-spacing: -0.01em;
}
.nav-links {
  display: flex;
  gap: 4px;
}
.nav-link {
  color: var(--gray-400);
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  padding: 6px 12px;
  border-radius: 6px;
  transition: all 0.15s;
}
.nav-link:hover { color: white; background: rgba(255,255,255,0.08); }
.nav-link.active { color: white; background: rgba(255,255,255,0.12); }

/* ── Main ── */
.main {
  max-width: 1100px;
  margin: 0 auto;
  padding: 24px;
}

/* ── Loading ── */
.loading {
  text-align: center;
  padding: 80px 24px;
  color: var(--gray-400);
}
.loading-spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--gray-200);
  border-top-color: var(--purple);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  margin: 0 auto 12px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Page Header ── */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 12px;
}
.page-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--gray-900);
}
.page-subtitle {
  font-size: 12px;
  color: var(--gray-400);
  margin-top: 2px;
}
.breadcrumb {
  font-size: 12px;
  color: var(--gray-400);
  margin-bottom: 6px;
}
.breadcrumb a {
  color: var(--purple);
  text-decoration: none;
}
.breadcrumb a:hover { text-decoration: underline; }

/* ── Stat Cards ── */
.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
  margin-bottom: 24px;
}
.stat-card {
  background: white;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 14px 16px;
}
.stat-value {
  font-size: 24px;
  font-weight: 700;
  color: var(--gray-900);
  line-height: 1.2;
}
.stat-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--gray-400);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-top: 2px;
}
.stat-card.stat-warning .stat-value { color: var(--orange); }
.stat-card.stat-success .stat-value { color: var(--green); }

/* ── Site Cards ── */
.site-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}
.site-card {
  background: white;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 16px 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  transition: border-color 0.15s, box-shadow 0.15s;
  cursor: pointer;
  text-decoration: none;
  color: inherit;
}
.site-card:hover {
  border-color: var(--purple);
  box-shadow: 0 2px 8px rgba(107, 45, 139, 0.08);
}
.site-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: var(--purple-light);
  color: var(--purple);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 18px;
  font-weight: 700;
}
.site-info { flex: 1; min-width: 0; }
.site-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--gray-900);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.site-meta {
  font-size: 12px;
  color: var(--gray-400);
  display: flex;
  gap: 12px;
  margin-top: 2px;
}
.site-stats {
  display: flex;
  gap: 10px;
  flex-shrink: 0;
  align-items: center;
}
.site-stat {
  text-align: center;
  padding: 4px 10px;
  border-radius: 6px;
  background: var(--gray-50);
  min-width: 50px;
}
.site-stat-value {
  font-size: 16px;
  font-weight: 700;
  color: var(--gray-900);
  line-height: 1.2;
}
.site-stat-label {
  font-size: 10px;
  color: var(--gray-400);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.site-stat.has-unresolved {
  background: var(--orange-light);
}
.site-stat.has-unresolved .site-stat-value { color: var(--orange); }
.site-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border: 1px solid var(--gray-200);
  border-radius: 8px;
  background: white;
  color: var(--gray-600);
  font-size: 12px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.15s;
  text-decoration: none;
  white-space: nowrap;
}
.btn:hover { border-color: var(--gray-300); background: var(--gray-50); }
.btn-primary { background: var(--purple); color: white; border-color: var(--purple); }
.btn-primary:hover { background: var(--purple-hover); border-color: var(--purple-hover); }
.btn-sm { padding: 4px 10px; font-size: 11px; }
.btn-danger { color: var(--red); }
.btn-danger:hover { background: var(--red-light); border-color: var(--red); }
.btn-success { color: var(--green); }
.btn-success:hover { background: var(--green-light); border-color: var(--green); }

/* ── Comment Cards ── */
.comment-card {
  background: white;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 12px 16px;
  margin-bottom: 8px;
  transition: border-color 0.15s;
}
.comment-card:hover { border-color: var(--gray-300); }
.comment-card.resolved { opacity: 0.55; }
.comment-card.resolved:hover { opacity: 0.8; }
.comment-header {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 6px;
  flex-wrap: wrap;
}
.comment-type {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding: 2px 7px;
  border-radius: 4px;
}
.type-general { background: #ede9fe; color: #6d28d9; }
.type-pin { background: var(--red-light); color: var(--red); }
.type-selection { background: var(--blue-light); color: var(--blue); }
.comment-author { font-size: 13px; font-weight: 600; color: var(--gray-900); }
.comment-time { font-size: 11px; color: var(--gray-400); margin-left: auto; }
.comment-resolved-badge {
  font-size: 10px;
  font-weight: 600;
  color: var(--green);
  background: var(--green-light);
  padding: 2px 6px;
  border-radius: 4px;
  text-transform: uppercase;
}
.comment-selection {
  font-size: 12px;
  color: var(--blue);
  background: #eff6ff;
  border-radius: 6px;
  padding: 6px 10px;
  margin-bottom: 6px;
  font-style: italic;
  border-left: 2px solid #3b82f6;
}
.comment-body {
  font-size: 13px;
  color: var(--gray-700);
  line-height: 1.55;
  white-space: pre-wrap;
}
.comment-attachments {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 6px;
}
.comment-attachment {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  color: var(--purple);
  background: var(--purple-light);
  padding: 3px 8px;
  border-radius: 4px;
  text-decoration: none;
  cursor: pointer;
}
.comment-attachment:hover { background: rgba(107,45,139,0.15); }
.comment-actions {
  display: flex;
  gap: 8px;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--gray-100);
}

/* ── Page Groups ── */
.page-group { margin-bottom: 20px; }
.page-group-header {
  font-size: 12px;
  font-weight: 700;
  color: var(--gray-400);
  padding: 8px 0;
  margin-bottom: 8px;
  border-bottom: 1px solid var(--gray-200);
  display: flex;
  align-items: center;
  gap: 8px;
}
.page-group-path {
  font-family: monospace;
  color: var(--purple);
  font-weight: 600;
  text-transform: none;
  letter-spacing: 0;
}
.page-group-count {
  margin-left: auto;
  font-size: 11px;
  color: var(--gray-400);
  font-weight: 500;
}

/* ── Filter bar ── */
.filter-bar {
  display: flex;
  gap: 4px;
  margin-bottom: 16px;
}
.filter-btn {
  padding: 6px 14px;
  border: 1px solid var(--gray-200);
  border-radius: 6px;
  background: white;
  color: var(--gray-500);
  font-size: 12px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.15s;
}
.filter-btn:hover { border-color: var(--gray-300); }
.filter-btn.active {
  background: var(--purple);
  color: white;
  border-color: var(--purple);
}

/* ── Attachments Table ── */
.att-table {
  width: 100%;
  border-collapse: collapse;
  background: white;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  overflow: hidden;
}
.att-table th {
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  color: var(--gray-400);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 10px 14px;
  background: var(--gray-50);
  border-bottom: 1px solid var(--gray-200);
}
.att-table td {
  padding: 10px 14px;
  font-size: 13px;
  border-bottom: 1px solid var(--gray-100);
  vertical-align: middle;
}
.att-table tr:last-child td { border-bottom: none; }
.att-table tr:hover td { background: var(--gray-50); }
.att-filename {
  font-weight: 600;
  color: var(--gray-900);
}
.att-type-badge {
  font-size: 10px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 4px;
  background: var(--gray-100);
  color: var(--gray-500);
  text-transform: uppercase;
}
.att-size {
  color: var(--gray-400);
  font-size: 12px;
}
.att-site {
  font-family: monospace;
  font-size: 11px;
  color: var(--purple);
}

/* ── Empty state ── */
.empty {
  text-align: center;
  padding: 60px 24px;
  color: var(--gray-400);
}
.empty svg { margin-bottom: 12px; opacity: 0.3; }

/* ── Toast ── */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 10001;
  background: var(--gray-900);
  color: white;
  font-size: 13px;
  font-weight: 500;
  padding: 10px 18px;
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.2);
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.25s, transform 0.25s;
}
.toast.visible { opacity: 1; transform: translateY(0); }

/* ── Responsive ── */
@media (max-width: 640px) {
  .site-card { flex-wrap: wrap; }
  .site-stats { width: 100%; justify-content: flex-start; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .att-table { font-size: 12px; }
  .att-table th, .att-table td { padding: 8px 10px; }
}
