/* tables-app.css — chrome for the standalone public random-tables SPA.
   Reuses the shared design tokens (tokens.css) + components.css (.button,
   .admin-table) + random-tables.css (.rt-*). Only app-specific layout lives
   here. Dark theme, matches the main app. */

/* Reset the default body margin + paint the page background black. The tables
   app links only a CSS subset (no layout.css), so it doesn't inherit the main
   app's body reset — without this an 8px white frame shows around the app. */
html, body {
  margin: 0;
  padding: 0;
  background: var(--bg-body);
}

.tables-app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg-body);
  color: var(--text-primary);
}

/* ---------- Header ---------- */
.tables-header {
  background: linear-gradient(180deg, var(--bg-secondary), var(--bg-body));
  border-bottom: 1px solid var(--border-primary);
}
.tables-header-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: var(--space-6) var(--space-4) var(--space-5);
  position: relative;
}

/* ---------- Community activity feed (header bell) ---------- */
.feed-bell-wrap {
  position: absolute;
  top: var(--space-5);
  right: var(--space-4);
}
.feed-bell {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-secondary);
  color: var(--text-secondary);
  border: 1px solid var(--border-primary);
  border-radius: 999px;
  padding: var(--space-2);
  cursor: pointer;
}
.feed-bell:hover { color: var(--text-primary); }
.feed-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 1.1rem;
  height: 1.1rem;
  padding: 0 0.25rem;
  border-radius: 999px;
  background: var(--accent-red);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  line-height: 1.1rem;
  text-align: center;
}
.feed-panel {
  position: absolute;
  top: calc(100% + var(--space-2));
  right: 0;
  width: 22rem;
  max-width: 90vw;
  max-height: 70vh;
  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.4);
  z-index: 2000;
}
.feed-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--border-primary);
  font-family: var(--font-display);
  font-weight: 600;
  color: var(--text-primary);
  position: sticky;
  top: 0;
  background: var(--bg-primary);
}
.feed-close {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  display: inline-flex;
}
.feed-close:hover { color: var(--text-primary); }
.feed-empty {
  padding: var(--space-4);
  color: var(--text-secondary);
  font-size: 0.85rem;
}
.feed-list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.feed-item {
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--border-primary);
}
.feed-item:last-child { border-bottom: none; }
.feed-item-title {
  color: var(--text-primary);
  font-weight: 600;
  font-size: 0.9rem;
}
.feed-item-sub {
  color: var(--text-secondary);
  font-size: 0.85rem;
}
.feed-item-body {
  color: var(--text-secondary);
  font-size: 0.85rem;
  margin-top: var(--space-1);
}
.feed-item-time {
  color: var(--text-muted);
  font-size: 0.75rem;
  margin-top: var(--space-1);
}
.feed-tag {
  display: inline-block;
  margin-bottom: var(--space-1);
  padding: 1px 8px;
  border-radius: 10px;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--accent-red);
  background: rgba(230, 57, 70, 0.12);
}
.tables-brand {
  display: flex;
  align-items: baseline;
  gap: var(--space-3);
}
.brand-mark {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.6rem;
  color: var(--accent-red);
  letter-spacing: 0.01em;
}
.brand-sub {
  font-family: var(--font-display);
  font-size: 1.1rem;
  color: var(--text-secondary);
}
.tables-tagline {
  margin: var(--space-3) 0 0;
  color: var(--text-secondary);
  max-width: 60ch;
}

/* ---------- Main ---------- */
.tables-main {
  flex: 1;
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
  padding: var(--space-5) var(--space-4) var(--space-7);
  box-sizing: border-box;
}

/* ---------- Filter bar ---------- */
.filter-bar {
  position: sticky;
  top: 0;
  z-index: 5;
  background: var(--bg-body);
  padding: var(--space-3) 0;
  border-bottom: 1px solid var(--border-primary);
  margin-bottom: var(--space-5);
}
.filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
}
.tables-search {
  flex: 1 1 280px;
  min-width: 200px;
  padding: 0.55rem 0.8rem;
  background: var(--bg-secondary);
  border: 1px solid var(--border-primary);
  border-radius: 8px;
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 0.95rem;
}
.tables-search:focus {
  outline: none;
  border-color: var(--accent-red);
}
.tables-select {
  flex: 0 1 auto;
  padding: 0.55rem 0.7rem;
  background: var(--bg-secondary);
  border: 1px solid var(--border-primary);
  border-radius: 8px;
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 0.95rem;
}
.tables-select:focus { outline: none; border-color: var(--accent-red); }
.filter-meta {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-top: var(--space-3);
}
.result-count {
  color: var(--text-muted);
  font-size: 0.85rem;
}

/* ---------- System groups ---------- */
.system-group { margin-bottom: var(--space-6); }
.system-heading {
  font-family: var(--font-display);
  font-size: 1.25rem;
  color: var(--text-primary);
  border-bottom: 1px solid var(--border-primary);
  padding-bottom: var(--space-2);
  margin: 0 0 var(--space-4);
}
.pinned-section { margin-bottom: var(--space-6); }
.pinned-heading { color: var(--accent-red); border-color: var(--accent-red-bg); }

.table-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: var(--space-4);
}

/* Rich table-card styles (.table-card, .roll-banner, .table-source, .chain-*)
   now live in the shared random-tables.css (linked by both apps). */

/* ---------- Status + footer ---------- */
.tables-status { padding: var(--space-6) 0; }
.tables-footer {
  border-top: 1px solid var(--border-primary);
  padding: var(--space-5) var(--space-4);
  max-width: 1100px;
  margin: 0 auto;
  color: var(--text-muted);
  font-size: 0.8rem;
}
.tables-footer p { margin: 0 0 var(--space-2); max-width: 70ch; }
.tables-footer a { color: var(--text-secondary); }

@media (max-width: 600px) {
  .table-list { grid-template-columns: 1fr; }
  .tables-header-inner { padding: var(--space-5) var(--space-3) var(--space-4); }
}

/* ---------- Generators (tables-web section + per-system grouping only;
   the generator CARD styles live in the shared random-tables.css) ---------- */
.generators-section { margin-bottom: var(--space-6); }
.generators-heading { color: var(--accent-red); }
/* Collapsible section heading (starts collapsed) — chevron + label, clickable. */
.generators-section-toggle {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  cursor: pointer;
  user-select: none;
}
.generators-section-toggle .toggle-chevron { font-size: 0.7em; }
.generator-group { margin-bottom: var(--space-4); }
.generator-group-heading {
  font-family: var(--font-display); font-size: 1rem; color: var(--text-secondary);
  margin: 0 0 var(--space-3);
}

/* ---------- Anonymous feedback widget (floating lower-right) ---------- */
.tables-feedback-trigger {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 2500;
  width: 48px;
  height: 48px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--accent-red);
  color: #fff;
  border: none;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.4);
}
.tables-feedback-trigger:hover { background: var(--accent-red-hover); }
.tables-feedback-panel {
  position: fixed;
  bottom: 5rem;
  right: 1.5rem;
  z-index: 2500;
  width: 20rem;
  max-width: 90vw;
  background: var(--bg-primary);
  border: 1px solid var(--border-primary);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
  padding: var(--space-4);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}
.tables-feedback-head {
  font-family: var(--font-display);
  font-weight: 600;
  color: var(--text-primary);
}
.tables-feedback-hint {
  color: var(--text-secondary);
  font-size: 0.8rem;
  margin: 0;
}
.feedback-type-row { display: flex; gap: var(--space-2); flex-wrap: wrap; }
.tables-feedback-text,
.tables-feedback-contact {
  width: 100%;
  background: var(--bg-secondary);
  color: var(--text-primary);
  border: 1px solid var(--border-primary);
  border-radius: 6px;
  padding: var(--space-2);
  font: inherit;
}
.tables-feedback-send { align-self: flex-end; }
.tables-feedback-done { text-align: center; color: var(--text-secondary); }

/* Signed-out feedback panel (ADR-0051 — no anonymous feedback) */
.tables-feedback-signedout { display: flex; flex-direction: column; gap: var(--space-3); }
.tables-feedback-mailto { color: var(--accent-red); font-size: 0.85rem; text-decoration: none; }
.tables-feedback-mailto:hover { text-decoration: underline; }
