/* shared/ui/list-page.css
 *
 * Ener.co canonical "list page" component — the shared chrome behind every
 * collection view (Scout surveys, QC projects, …). One toolbar, one
 * filter/sort bar, one card. The proposer (proposer/index.html) is the visual
 * REFERENCE this is modeled on; per shared/brand/PLAN.md Principle 6 the
 * proposer itself is not retrofitted here (Ruben's domain).
 *
 * Palette: every rule consumes the product-UI tokens via var(--token, fallback)
 * so a page looks identical today (#0D0D6B family) AND automatically picks up
 * the brand-canonical palette (#01148A) when the Phase 1.5 retrofit updates the
 * tokens. Do NOT hardcode hex here — keep the fallbacks in sync with ui-style.
 *
 * Usage:
 *   <link rel="stylesheet" href="/shared/ui/list-page.css">
 *   <script src="/shared/ui/list-page.js"></script>
 * Then build cards/toolbar with the ListPage.* helpers (see list-page.js).
 * Pairs with the .lp-* class names below; see the ui-style skill for tokens.
 */

/* ── Toolbar: title + primary actions ─────────────────────────────── */
.lp-toolbar {
  display: flex; align-items: center; gap: 12px;
  flex-wrap: wrap; margin-bottom: 14px;
}
.lp-title {
  font-size: 22px; font-weight: 800; flex: 1;
  color: var(--text-main, #0D0D6B); letter-spacing: -0.3px; margin: 0;
}
.lp-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ── Filter / sort / search bar ───────────────────────────────────── */
.lp-filterbar {
  display: flex; align-items: center; gap: 12px;
  flex-wrap: wrap; margin-bottom: 16px;
}

/* Segmented status / scope control (Open | In Progress | Complete) */
.lp-seg {
  display: inline-flex; background: #fff;
  border: 1px solid var(--border, #DDDDF0); border-radius: 8px; overflow: hidden;
}
.lp-seg button {
  border: none; background: none; padding: 8px 14px;
  font-family: inherit; font-size: 13px; font-weight: 600;
  color: var(--text-muted, #7070A0); cursor: pointer;
  transition: background 0.12s ease, color 0.12s ease;
  border-left: 1px solid var(--border, #DDDDF0);
}
.lp-seg button:first-child { border-left: none; }
.lp-seg button.on { background: var(--navy, #0D0D6B); color: #fff; }
.lp-seg button:not(.on):hover { background: var(--navy-light, #EBEBFF); }

/* Sort dropdown */
.lp-sortwrap { display: inline-flex; align-items: center; gap: 6px; }
.lp-sort-label {
  font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.5px; color: var(--text-muted, #7070A0);
}
.lp-select {
  padding: 8px 30px 8px 12px; border: 1px solid var(--border, #DDDDF0);
  border-radius: 8px; font-family: inherit; font-size: 13px; font-weight: 600;
  color: var(--text-main, #0D0D6B); background: #fff
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M2 4l4 4 4-4' fill='none' stroke='%237070A0' stroke-width='2'/%3E%3C/svg%3E")
    no-repeat right 10px center;
  -webkit-appearance: none; appearance: none; cursor: pointer;
}
.lp-select:focus { outline: none; border-color: var(--navy-mid, #1A1A9E); }

/* Search box */
.lp-search {
  flex: 1; min-width: 160px;
  padding: 8px 12px; border: 1px solid var(--border, #DDDDF0); border-radius: 8px;
  font-family: inherit; font-size: 14px; color: var(--text-main, #0D0D6B);
  -webkit-appearance: none; background: #fff;
}
.lp-search::placeholder { color: var(--text-muted, #7070A0); }
.lp-search:focus {
  outline: none; border-color: var(--navy-mid, #1A1A9E);
  box-shadow: 0 0 0 3px rgba(13,13,107,0.08);
}

/* ── Summary stat bar ─────────────────────────────────────────────── */
.lp-stats { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.lp-stat {
  background: #fff; border: 1px solid var(--border, #DDDDF0); border-radius: 10px;
  padding: 12px 16px; min-width: 110px; flex: 1;
}
.lp-stat-label {
  font-size: 10px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.5px; color: var(--text-muted, #7070A0);
}
.lp-stat-value {
  font-family: var(--mono, 'DM Mono', monospace); font-size: 24px;
  font-weight: 600; margin-top: 2px; color: var(--text-main, #0D0D6B);
}

/* ── Compact card (one item = title row + a single meta line) ──────── */
.lp-list { display: block; }
.lp-card {
  background: #fff; border: 1px solid var(--border, #DDDDF0); border-radius: 10px;
  padding: 14px 16px; margin-bottom: 10px; cursor: pointer;
  transition: border-color 0.12s ease, box-shadow 0.12s ease;
}
.lp-card:hover, .lp-card:active {
  border-color: var(--navy, #0D0D6B);
  box-shadow: 0 2px 12px rgba(13,13,107,0.08);
}
.lp-card-top { display: flex; align-items: center; gap: 10px; }
.lp-card-title {
  flex: 1; min-width: 0; font-weight: 700; font-size: 15px;
  color: var(--text-main, #0D0D6B);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.lp-card-accessory { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.lp-card-chev { color: var(--text-muted, #7070A0); font-size: 20px; flex-shrink: 0; line-height: 1; transition: transform 0.2s ease; }
/* When a card expands an inline detail panel, the chevron points down. */
.lp-card.open .lp-card-chev { transform: rotate(90deg); }
.lp-card-meta {
  font-size: 13px; color: var(--text-muted, #7070A0); margin-top: 4px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* ── Pill badges ──────────────────────────────────────────────────── */
.lp-badge {
  display: inline-block; font-size: 11px; font-weight: 700;
  padding: 2px 9px; border-radius: 20px; white-space: nowrap;
}
.lp-badge-neutral     { background: var(--off-white, #F4F4F8);     color: var(--text-muted, #7070A0); }
.lp-badge-in_progress { background: var(--amber-light, #FEF3C7);   color: var(--amber, #D97706); }
.lp-badge-complete    { background: var(--green-light, #E6F5ED);   color: var(--green, #0A8754); }
.lp-badge-ok          { background: var(--green-light, #E6F5ED);   color: var(--green, #0A8754); }
.lp-badge-warn        { background: var(--amber-light, #FEF3C7);   color: var(--amber, #D97706); }
.lp-badge-error       { background: var(--red-light, #FEF0ED);     color: var(--red, #E8321A); }
.lp-badge-info        { background: var(--navy-light, #EBEBFF);    color: var(--navy, #0D0D6B); }

/* ── Client groups (the "By client" view) ─────────────────────────── */
.lp-group { margin-bottom: 10px; }
.lp-group-header {
  display: flex; align-items: center; gap: 10px; padding: 12px 16px;
  background: #fff; border: 1px solid var(--border, #DDDDF0); border-radius: 10px;
  cursor: pointer; transition: border-color 0.12s ease;
}
.lp-group-header:hover { border-color: var(--navy, #0D0D6B); }
.lp-group.open > .lp-group-header { border-radius: 10px 10px 0 0; border-color: var(--navy, #0D0D6B); }
.lp-group.open > .lp-group-header .lp-card-chev { transform: rotate(90deg); }
.lp-group-name {
  flex: 1; min-width: 0; font-weight: 700; font-size: 15px;
  color: var(--text-main, #0D0D6B);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.lp-group-count {
  flex-shrink: 0; font-size: 11px; font-weight: 700; padding: 2px 9px;
  border-radius: 20px; background: var(--navy-light, #EBEBFF); color: var(--navy, #0D0D6B);
}
.lp-group-sub { flex-shrink: 0; font-size: 12px; color: var(--text-muted, #7070A0); }
.lp-group-body {
  display: none; padding: 8px; background: var(--off-white, #F4F4F8);
  border: 1px solid var(--navy, #0D0D6B); border-top: none; border-radius: 0 0 10px 10px;
}
.lp-group.open > .lp-group-body { display: block; }
.lp-group-body > .lp-card:last-child,
.lp-group-body > .survey-row:last-child { margin-bottom: 0; }

/* ── Empty state ──────────────────────────────────────────────────── */
.lp-empty { text-align: center; padding: 48px 16px; color: var(--text-muted, #7070A0); }
.lp-empty-icon { font-size: 40px; margin-bottom: 8px; }
.lp-empty-title { font-size: 17px; font-weight: 700; color: var(--text-main, #0D0D6B); margin-bottom: 4px; }
.lp-empty-desc { font-size: 13px; }

/* ── Small responsive niceties ────────────────────────────────────── */
@media (max-width: 560px) {
  .lp-search { order: 3; flex-basis: 100%; }
  .lp-title { font-size: 20px; }
}
