/* ─────────────────────────────────────────────────────────────────────────────
   22 — Admin guild insights (`gi-*`)

   The per-guild feature-analytics section on /admin/guilds/:id, rendered by
   `client/js/admin/guild-insights.js`. Everything here is namespaced `gi-` and
   scoped under `.gi`, so it cannot reach the rest of the admin console.

   It deliberately reuses the existing primitives rather than restyling them —
   `.kpi-card`, `.content-section`, `.filter-pills`, `.btn-filter`, `.table-wrap`
   and `.grid-2/3/6` all come from earlier parts. What is defined here is only the
   vocabulary those do not have: the adoption strip, the module cards and the
   inline status/detail atoms.

   Sits last because it is additive: it must win over the generic table and
   section rules it sits inside, and nothing else depends on it.
   ───────────────────────────────────────────────────────────────────────────── */

/* ── Adoption strip ─────────────────────────────────────────────────────────
   One button per feature status. These are FILTERS, not decoration — clicking
   one narrows the module grid below, so they carry a real pressed state. */
.gi .gi-adopt-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  flex: 1;
}

.gi .gi-adopt {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.4rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-input, rgba(255, 255, 255, 0.02));
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.72rem;
  line-height: 1;
  transition: border-color 0.15s ease, background 0.15s ease, color 0.15s ease;
}

.gi .gi-adopt:hover { border-color: var(--text-muted); color: var(--text); }

.gi .gi-adopt--on {
  border-color: var(--blurple, #5865f2);
  background: rgba(88, 101, 242, 0.12);
  color: var(--text);
}

.gi .gi-adopt-n { font-weight: 800; font-size: 0.85rem; color: var(--text); }
.gi .gi-adopt-l { white-space: nowrap; }

.gi .gi-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* ── Chips ──────────────────────────────────────────────────────────────────
   A count with a label, used for case sources and per-card metadata. */
.gi .gi-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 0.6rem;
}

.gi .gi-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.25rem 0.5rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 0.7rem;
  color: var(--text-muted);
  white-space: nowrap;
}

.gi .gi-chip b { color: var(--text); font-weight: 700; }
.gi .gi-chip--sm { font-size: 0.65rem; padding: 0.18rem 0.4rem; }

/* ── Module cards ───────────────────────────────────────────────────────────
   `auto-fill` rather than a fixed column count: the section sits inside the
   admin content pane, which is itself responsive, so a fixed grid would either
   overflow at the narrow end or leave a dead column at the wide one. */
.gi .gi-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 0.6rem;
}

.gi .gi-card {
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg-input, rgba(255, 255, 255, 0.015));
  padding: 0.7rem 0.75rem;
  cursor: pointer;
  transition: border-color 0.15s ease, transform 0.15s ease;
}

.gi .gi-card:hover { border-color: var(--text-muted); transform: translateY(-1px); }

.gi .gi-card-head {
  display: flex;
  align-items: flex-start;
  gap: 0.55rem;
}

.gi .gi-card-icon { font-size: 1.05rem; line-height: 1; margin-top: 0.1rem; flex-shrink: 0; }

.gi .gi-card-title {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.gi .gi-card-sub { margin-top: 0.15rem; line-height: 1.2; }

.gi .gi-status {
  font-size: 0.6rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.18rem 0.4rem;
  border-radius: 5px;
  border: 1px solid;
  white-space: nowrap;
  flex-shrink: 0;
}

.gi .gi-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  margin-top: 0.55rem;
}

/* Collapsed by default: the grid's job is the overview, and twenty expanded
   cards is a wall. `.gi-open` is toggled on click by the page. */
.gi .gi-card-body { display: none; margin-top: 0.6rem; border-top: 1px solid var(--border); padding-top: 0.5rem; }
.gi .gi-card.gi-open .gi-card-body { display: block; }

.gi .gi-detail-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem;
  font-size: 0.72rem;
  color: var(--text-muted);
  padding: 0.16rem 0;
}

.gi .gi-detail-row b { color: var(--text); font-weight: 700; }

.gi .gi-note {
  font-size: 0.68rem;
  color: var(--text-muted);
  line-height: 1.5;
  margin-top: 0.4rem;
  font-style: italic;
}

/* ── Tables inside this section ─────────────────────────────────────────────
   The ranking/channel/moderation tables are dense, headerless lists rather than
   the admin console's usual record tables, so they shed the default padding. */
.gi .table-wrap table td {
  padding: 0.34rem 0.45rem;
  font-size: 0.78rem;
  border-bottom: none;
}

.gi .table-wrap table td:first-child { padding-left: 0; }
.gi .table-wrap table td:last-child { padding-right: 0; }

@media (max-width: 900px) {
  .gi .gi-cards { grid-template-columns: 1fr; }
}
