/* ==========================================================================
   D2R Mobile Guide — Feedback Guestbook & Moderation Stylesheet
   Follows DESIGN.md: warm paper #fafaf8, ink #202327, antique gold #946a27
   ========================================================================== */

/* --- Layout & Headers --- */
.feedback-shell,
.feedback-admin-shell {
  max-width: var(--content-max-ch);
  margin: 0 auto;
}

.feedback-meta-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.feedback-notice-callout {
  margin: 20px 0 24px;
}

.feedback-controls {
  display: flex;
  justify-content: flex-start;
  margin-bottom: 24px;
}

.btn-write-message {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  font-size: 0.95rem;
  font-weight: 600;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  transition: transform 0.15s ease, background 0.15s ease;
}

.btn-write-message:hover {
  transform: translateY(-1px);
}

/* --- Feedback Form Card --- */
.feedback-form-card {
  background: var(--surface-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  margin-bottom: 32px;
  box-shadow: var(--shadow-card);
}

.feedback-form-card .form-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-subtle);
}

.feedback-form-card .form-header h2 {
  font-size: 1.2rem;
  font-weight: 700;
  margin: 0;
  color: var(--ink);
}

.form-close-btn {
  color: var(--muted);
  cursor: pointer;
  padding: 4px;
  border-radius: var(--radius-sm);
}

.form-close-btn:hover {
  color: var(--ink);
  background: var(--bg-subtle);
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 16px;
}

@media (max-width: 600px) {
  .form-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }
}

.form-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 16px;
}

.form-field label {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--ink);
}

.form-field .field-hint {
  font-weight: 400;
  color: var(--muted);
  font-size: 0.82rem;
}

.form-field .required {
  color: var(--status-red-ink);
}

.form-field input[type="text"],
.form-field input[type="password"],
.form-field select,
.form-field textarea {
  width: 100%;
  padding: 10px 14px;
  font-family: var(--font-sans);
  font-size: 0.94rem;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-sizing: border-box;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.form-field input:focus,
.form-field select:focus,
.form-field textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.form-field textarea {
  resize: vertical;
  min-height: 120px;
  line-height: 1.5;
}

.char-count-wrap {
  display: flex;
  justify-content: flex-end;
  font-size: 0.8rem;
  color: var(--muted);
  margin-top: 4px;
}

/* --- Turnstile Section (Overflow safe for 320px screens) --- */
.turnstile-section {
  margin: 14px 0 18px;
}

.turnstile-wrapper {
  min-height: 65px;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.turnstile-placeholder {
  font-size: 0.85rem;
  color: var(--muted);
  padding: 8px 12px;
  background: var(--bg-subtle);
  border-radius: var(--radius-sm);
  border: 1px dashed var(--border);
}

.form-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

@media (min-width: 600px) {
  .form-actions {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }
}

.submit-privacy-note {
  font-size: 0.8rem;
  color: var(--muted);
}

/* --- Feedback Feed Section --- */
.feedback-feed-section {
  margin-top: 36px;
  padding-top: 24px;
  border-top: 1px solid var(--border-subtle);
}

.feed-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.feed-title-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
}

.feed-header h2 {
  font-size: 1.35rem;
  font-weight: 700;
  margin: 0;
  color: var(--ink);
}

.feed-count-badge {
  font-size: 0.78rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  background: var(--bg-subtle);
  color: var(--muted);
}

.feedback-messages-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* --- Individual Message Card --- */
.feedback-card {
  background: var(--surface-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 18px 20px;
  box-shadow: var(--shadow-sm);
  transition: border-color 0.15s ease;
}

.feedback-card:hover {
  border-color: var(--accent-border);
}

.feedback-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.feedback-card-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.feedback-author {
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--ink);
}

.feedback-time {
  font-size: 0.82rem;
  color: var(--muted);
}

.feedback-category-badge {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  text-transform: capitalize;
  letter-spacing: 0.02em;
}

.feedback-category-badge.category-suggestion {
  background: var(--status-green-bg);
  color: var(--status-green-ink);
  border: 1px solid var(--status-green-border);
}

.feedback-category-badge.category-bug {
  background: var(--status-red-bg);
  color: var(--status-red-ink);
  border: 1px solid var(--status-red-border);
}

.feedback-category-badge.category-installation {
  background: var(--status-blue-bg);
  color: var(--status-blue-ink);
  border: 1px solid var(--status-blue-border);
}

.feedback-category-badge.category-other {
  background: var(--status-neutral-bg);
  color: var(--status-neutral-ink);
  border: 1px solid var(--status-neutral-border);
}

.feedback-body {
  font-size: 0.94rem;
  line-height: 1.65;
  color: var(--ink);
  white-space: pre-wrap;
  word-break: break-word;
  margin: 0;
}

/* Maintainer Reply Box */
.feedback-reply-box {
  margin-top: 14px;
  padding: 12px 16px;
  background: var(--bg-subtle);
  border-left: 3px solid var(--accent);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

.feedback-reply-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--accent);
}

.feedback-reply-body {
  font-size: 0.9rem;
  line-height: 1.55;
  color: var(--ink);
  white-space: pre-wrap;
  word-break: break-word;
  margin: 0;
}

/* --- Empty & Loading States --- */
.feed-loading,
.admin-state-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 36px 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.loading-spinner {
  width: 18px;
  height: 18px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: fb-spin 0.8s linear infinite;
}

@keyframes fb-spin {
  to { transform: rotate(360deg); }
}

.feedback-empty-state {
  text-align: center;
  padding: 48px 24px;
  background: var(--bg-subtle);
  border: 1px dashed var(--border);
  border-radius: var(--radius-lg);
  margin: 16px 0;
}

.feedback-empty-state svg {
  color: var(--muted);
  margin-bottom: 12px;
  opacity: 0.6;
}

.feedback-empty-state .empty-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--ink);
  margin: 0 0 6px;
}

.feedback-empty-state .empty-desc {
  font-size: 0.88rem;
  color: var(--muted);
  margin: 0 0 16px;
}

/* --- Feedback Alerts --- */
.feedback-alert {
  padding: 12px 16px;
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  line-height: 1.5;
  margin-top: 14px;
}

.feedback-alert.success {
  background: var(--status-green-bg);
  color: var(--status-green-ink);
  border: 1px solid var(--status-green-border);
}

.feedback-alert.error {
  background: var(--status-red-bg);
  color: var(--status-red-ink);
  border: 1px solid var(--status-red-border);
}

.feedback-alert.info {
  background: var(--status-blue-bg);
  color: var(--status-blue-ink);
  border: 1px solid var(--status-blue-border);
}

/* --- Pagination --- */
.feed-pagination,
.admin-pagination {
  display: flex;
  justify-content: center;
  margin-top: 24px;
}

/* ==========================================================================
   Admin Console Styles
   ========================================================================== */
.admin-app-root {
  margin-top: 24px;
}

.admin-card {
  background: var(--surface-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px;
  box-shadow: var(--shadow-card);
}

.admin-login-card {
  max-width: 460px;
  margin: 20px auto;
}

.admin-card-header h2 {
  font-size: 1.25rem;
  font-weight: 700;
  margin: 0 0 6px;
  color: var(--ink);
}

.admin-card-header p {
  font-size: 0.88rem;
  color: var(--muted);
  margin: 0;
}

.admin-warning-callout {
  margin: 16px 0 20px;
}

.admin-dashboard-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 18px;
  background: var(--surface-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  margin-bottom: 20px;
}

.admin-session-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--status-green-ink);
}

.status-indicator-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--status-green-ink);
}

.admin-queue-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.admin-status-tabs {
  display: flex;
  gap: 6px;
  background: var(--bg-subtle);
  padding: 4px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
}

.admin-tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  font-family: var(--font-sans);
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--muted);
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s ease;
}

.admin-tab:hover {
  color: var(--ink);
}

.admin-tab.active {
  color: var(--ink);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.admin-tab-count {
  font-size: 0.75rem;
  padding: 1px 6px;
  border-radius: var(--radius-full);
  background: var(--border);
  color: var(--ink-secondary);
}

.admin-messages-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.admin-message-card {
  background: var(--surface-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 20px;
  box-shadow: var(--shadow-sm);
}

.admin-message-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.admin-message-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 0.82rem;
  color: var(--muted);
}

.admin-id-badge {
  font-family: var(--font-mono);
  font-size: 0.76rem;
  background: var(--bg-subtle);
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  color: var(--muted);
}

.admin-actions-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--border-subtle);
  flex-wrap: wrap;
}

.btn-approve {
  color: #ffffff;
  background: #1f883d;
  border: 1px solid #1a7f37;
}

.btn-approve:hover {
  background: #1a7f37;
}

.btn-reject {
  color: var(--status-red-ink);
  background: var(--status-red-bg);
  border: 1px solid var(--status-red-border);
}

.btn-reject:hover {
  background: #f8b4bb;
}

.btn-delete {
  color: var(--status-red-ink);
  background: transparent;
  border: 1px solid transparent;
}

.btn-delete:hover {
  background: var(--status-red-bg);
  border-color: var(--status-red-border);
}

.admin-reply-composer {
  margin-top: 14px;
  padding: 12px 14px;
  background: var(--bg-subtle);
  border-radius: var(--radius-md);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.admin-reply-composer textarea {
  width: 100%;
  padding: 8px 12px;
  font-family: var(--font-sans);
  font-size: 0.88rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--ink);
  min-height: 70px;
  box-sizing: border-box;
}

.admin-reply-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}
