/*
 * Growth Partner — Lijsten (UX overhaul 5c)
 *
 * The lists overview (gp-cards with a colour dot), the new/edit form and the
 * table view of a list. Built on the gp- components in ux_components.css and
 * the tokens in application.css; this file only adds what is specific to the
 * Lijsten pages. Class prefix `lists-`; the table keeps its `pipeline-*`
 * hooks (pipeline_row / outcome_guard / pipeline_picker select on them).
 *
 * The colour dot is painted by the swatch Stimulus controller (CSSOM, CSP
 * blocks an inline style=); the grey below is the fallback for a list without
 * a colour. Archived cards use the surface tint, never opacity (opacity would
 * drop their text under the AA contrast floor).
 *
 * Guards: test/integration/lists_gp_style_test.rb, accessible_names_test,
 * test/system/pipeline_drawer_test.rb. Phone rules at the bottom of the file.
 */

/* ── Overview ── */
.lists-header { align-items: center; gap: 0.75rem; margin-bottom: 1.25rem; }
.lists-header .gp-page-title { margin: 0; }
.lists-header .count { color: var(--gp-body); font-weight: 600; }

.lists-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px; margin-bottom: 2rem;
}
.lists-card { gap: 8px; text-decoration: none; transition: border-color 0.15s, box-shadow 0.15s; }
.lists-card:hover { border-color: var(--gp-navy); box-shadow: 0 4px 14px rgba(13, 58, 89, 0.08); color: var(--gp-ink); }
.lists-card:focus-visible { outline: 2px solid var(--gp-navy); outline-offset: 2px; }
.lists-card-archived { background: var(--gp-surface); }
.lists-card-head { display: flex; align-items: center; gap: 10px; min-width: 0; }
.lists-dot {
  flex: none; width: 14px; height: 14px; border-radius: 999px;
  background: var(--gp-line); border: 1px solid rgba(13, 58, 89, 0.15);
}
.lists-card-name {
  min-width: 0; overflow-wrap: anywhere;
  font-family: var(--gp-font-heading); font-weight: 700; font-size: 1rem; line-height: 1.3;
  color: var(--gp-navy);
}
.lists-card-desc { font-size: 0.85rem; color: var(--gp-body); overflow-wrap: anywhere; }
.lists-card-meta {
  display: flex; flex-wrap: wrap; gap: 4px 14px; margin-top: auto;
  font-size: 0.8rem; color: var(--gp-body);
}
.lists-archived-heading { margin: 2rem 0 0.75rem; }
.lists-empty { align-items: center; text-align: center; padding: 40px 20px; color: var(--gp-body); }
.lists-empty p { margin: 0; font-size: 0.95rem; }

/* ── New / edit form ── labels above the fields, one primary submit */
.lists-form { max-width: 36rem; }
.lists-form-title { margin: 0 0 1.25rem; }
.lists-form label {
  display: block; margin-bottom: 1rem;
  font-weight: 700; font-size: 0.85rem; color: var(--gp-navy);
}
.lists-form input:not([type="color"]):not([type="submit"]):not([type="hidden"]),
.lists-form textarea {
  display: block; width: 100%; margin: 6px 0 0;
  border: 1px solid var(--gp-line); border-radius: 10px; background: #fff;
  color: var(--gp-ink); font-weight: 400; font-size: 1rem;
}
.lists-form input:not([type="color"]):not([type="submit"]):not([type="hidden"]) { height: 44px; padding: 0 12px; }
.lists-form textarea { padding: 10px 12px; resize: vertical; }
.lists-form input:not([type="submit"]):focus, .lists-form textarea:focus {
  border-color: var(--gp-navy); box-shadow: 0 0 0 2px var(--gp-green); outline: none;
}
.lists-form .color-input {
  display: block; width: 4.5rem; height: 44px; margin: 6px 0 0; padding: 4px;
  border: 1px solid var(--gp-line); border-radius: 10px; background: #fff; cursor: pointer;
}
.lists-form-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 1.25rem; }

/* ── Table view ── header = the mock-up's table.t: small uppercase label on a
   hairline, no fill. The wrapper (.overflow-auto) is the card and the scroll
   container; the table keeps a floor width so a phone scrolls instead of
   squeezing the name column. */
.lists-table-wrap { background: #fff; border: 1px solid var(--gp-line); border-radius: 14px; }
.lists-table { min-width: 46rem; margin: 0; }
.lists-table thead th {
  /* position: the .visually-hidden "Acties" label is absolutely positioned;
     without a positioned ancestor inside the scroll wrapper it escapes the
     wrapper and widens the PAGE on a phone. */
  position: relative; padding: 10px 14px; white-space: nowrap; text-align: left;
  font-family: var(--gp-font-heading); font-weight: 700; font-size: 0.7rem;
  letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--gp-body); background: transparent; border-bottom: 1px solid var(--gp-line);
}
/* .pipeline-row only: the detail row's <td> stays flush (the drawer carries
   its own spacing). */
.lists-table tbody .pipeline-row > td { padding: 10px 14px; vertical-align: middle; border-bottom: 1px solid var(--gp-line); }
.lists-table tbody .pipeline-row.is-open > td { border-bottom-color: transparent; }
.lists-table .pipeline-cell-name { min-width: 14rem; }
.lists-table .pipeline-summary-row { flex-wrap: wrap; row-gap: 4px; }
.lists-table .pipeline-row-trigger strong { color: var(--gp-navy); }
.lists-cell-select { min-width: 9.5rem; }
.lists-cell-contact { min-width: 11rem; overflow-wrap: anywhere; }
.lists-cell-actions { width: 1%; white-space: nowrap; }
.lists-cell-actions .btn-danger-link {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 32px; min-height: 32px; font-size: 1.15rem; line-height: 1;
}
.lists-table .pipeline-row-detail > td { border-bottom: 1px solid var(--gp-line); }
.lists-table tbody tr:last-child > td { border-bottom: 0; }

/* The add-deal picker: segmented control + a secondary submit. */
.pipeline-add-tabs.gp-seg { margin-bottom: 0.6rem; }
.pipeline-add-tabs.gp-seg > .pipeline-add-tab { border: 0; border-radius: 7px; }
.pipeline-add-tabs.gp-seg > .pipeline-add-tab:hover:not(.active) { background: var(--gp-surface); }
.lists-add-submit { margin-top: 0.5rem; }

/* ── Phone rules ── (last: same specificity as the base rules above) */
@media (max-width: 768px) {
  .lists-grid { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .lists-header .page-header-actions { margin-left: 0; width: 100%; }
  .lists-form { max-width: none; }

  /* Touch targets >= 40px in the table. */
  .lists-table .pipeline-edit-cell { min-height: 40px; }
  .lists-table .pipeline-row-trigger { min-height: 40px; align-items: center; }
  .lists-cell-actions .btn-danger-link { min-width: 40px; min-height: 40px; }
  .pipeline-add-tabs.gp-seg > .pipeline-add-tab { min-height: 40px; }
  .lists-add-submit { min-height: 40px; }
}

@media (max-width: 480px) {
  /* The table scrolls inside its wrapper; an opened drawer sticks to the left
     edge at screen width so it reads without scrolling sideways. */
  .lists-table .pipeline-row-detail turbo-frame {
    display: block; position: sticky; left: 0; width: calc(100vw - 3rem);
  }
}
