/*
 * Job lists — My Account screens and the checkout job tag.
 *
 * Design tokens come from the child theme (assets/css/site.css), which is
 * enqueued on every page, so this file only describes structure and borrows
 * the palette. Values are given fallbacks so an admin previewing with the
 * theme's stylesheet off still gets something legible.
 */

.ecf-jl__intro {
  color: var(--muted, #606a63);
  margin: 0 0 24px;
  max-width: 62ch;
}

/* --- Tables ------------------------------------------------------------- */

.ecf-jl-table {
  width: 100%;
  border-collapse: collapse;
  margin: 0 0 32px;
}

.ecf-jl-table th {
  text-align: left;
  font-family: var(--font-head, sans-serif);
  font-size: var(--fs-label, .72rem);
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted, #606a63);
  padding: 0 12px 10px 0;
  border-bottom: 1px solid var(--line, #dde3de);
}

.ecf-jl-table td {
  padding: 16px 12px 16px 0;
  border-bottom: 1px solid var(--line, #dde3de);
  vertical-align: middle;
}

.ecf-jl-table td:last-child,
.ecf-jl-table th:last-child { padding-right: 0; }

.ecf-jl-name {
  font-family: var(--font-head, sans-serif);
  font-weight: 700;
  color: var(--green-900, #13241b);
  text-decoration: none;
}

.ecf-jl-name:hover { text-decoration: underline; }

.ecf-jl-badge {
  display: inline-block;
  margin-left: 8px;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--green-100, #e8f0ea);
  color: var(--green-800, #1b3d2c);
  font-size: var(--fs-xs, .8125rem);
  font-weight: 600;
  vertical-align: 2px;
}

.ecf-jl-byline,
.ecf-jl-sku {
  display: block;
  font-size: var(--fs-xs, .8125rem);
  color: var(--muted, #606a63);
}

.ecf-jl-sku { font-family: var(--font-mono, monospace); }

/* Actions column: buttons sit on one line and never wrap mid-label. */
.ecf-jl-table__actions {
  text-align: right;
  white-space: nowrap;
}

.ecf-jl-table__actions .btn,
.ecf-jl-table__actions .ecf-jl-inline-form {
  display: inline-block;
  vertical-align: middle;
  margin-left: 8px;
}

.ecf-jl .btn--sm {
  padding: 9px 16px;
  min-height: 0;
  font-size: var(--fs-sm, .9375rem);
}

.ecf-jl-items input[type="number"] {
  width: 88px;
  min-height: 44px;
  text-align: center;
}

.ecf-jl-remove,
.ecf-jl-delete {
  background: none;
  border: 0;
  padding: 0;
  color: var(--ecf-danger, #b32d2e);
  font: inherit;
  font-size: var(--fs-sm, .9375rem);
  cursor: pointer;
  text-decoration: underline;
}

.ecf-jl-remove:hover,
.ecf-jl-delete:hover { color: var(--ecf-danger-ink, #7d1f20); }

.ecf-jl-hidden-form { display: none; }

/* --- Forms -------------------------------------------------------------- */

.ecf-jl-empty {
  padding: 24px;
  background: var(--surface, #f5f3ee);
  border-radius: var(--radius, 6px);
  color: var(--muted, #606a63);
  margin: 0 0 28px;
}

.ecf-jl-edit-form { margin: 0 0 24px; }

.ecf-jl-newbar { margin: 0 0 24px; }

/* --- New list dialog ----------------------------------------------------- */

.ecf-jl-modal {
  width: min(440px, calc(100vw - 32px));
  padding: 0;
  border: 1px solid var(--line, #dde3de);
  border-radius: var(--radius-lg, 12px);
  background: var(--card, #fff);
  color: var(--ink, #17201b);
  box-shadow: var(--shadow-lg, 0 18px 48px rgba(15, 30, 22, .16));
}

.ecf-jl-modal::backdrop {
  background: rgba(19, 36, 27, .55);
}

/*
 * Without script the dialog renders with the open attribute, which puts it in
 * the normal flow rather than on the top layer — an ordinary panel, centred
 * the way the rest of the page content is.
 */
.ecf-jl-modal[open]:not(:modal) {
  margin: 0 0 24px;
}

.ecf-jl-modal .ecf-jl-new {
  margin: 0;
  padding: 24px;
}

.ecf-jl-modal__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin: 0 0 20px;
}

.ecf-jl-modal__head h3 {
  margin: 0;
  font-size: var(--fs-lg, 1.16rem);
}

.ecf-jl-modal__close {
  background: none;
  border: 0;
  padding: 0 4px;
  margin: -4px -4px 0 0;
  font-size: 26px;
  line-height: 1;
  color: var(--muted, #606a63);
  cursor: pointer;
}

.ecf-jl-modal__close:hover { color: var(--ink, #17201b); }

.ecf-jl-modal__actions {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-top: 4px;
}

.ecf-jl-modal__cancel {
  color: var(--muted, #606a63);
  font-size: var(--fs-sm, .9375rem);
}

.ecf-jl .form-row { margin: 0 0 18px; }

.ecf-jl label {
  display: block;
  margin-bottom: 6px;
  font-weight: 600;
  font-size: var(--fs-sm, .9375rem);
}

.ecf-jl input[type="text"],
.ecf-jl textarea { width: 100%; }

.ecf-jl textarea { padding: 12px; }

.ecf-jl-visibility {
  border: 0;
  padding: 0;
  margin: 0 0 20px;
  background: none;
}

/* A group of choices, not a section heading — so the legend does not float. */
.ecf-jl-visibility legend {
  float: none;
  width: auto;
  text-transform: none;
  letter-spacing: normal;
  font-family: inherit;
  color: inherit;
}

.ecf-jl-visibility legend {
  padding: 0;
  margin-bottom: 8px;
  font-weight: 600;
  font-size: var(--fs-sm, .9375rem);
}

/* Radios read as a row of choices, not as stacked form fields. */
.ecf-jl-visibility label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 400;
  margin-bottom: 6px;
}

.ecf-jl-visibility input[type="radio"] {
  min-height: 0;
  margin: 0;
}

.ecf-jl-back { margin: 0 0 20px; }

.ecf-jl-actions { margin: 0 0 28px; }

.ecf-jl-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-top: 20px;
  border-top: 1px solid var(--line, #dde3de);
}

.ecf-jl-inline-form { margin: 0; }

/* --- Narrow screens ----------------------------------------------------- */

@media (max-width: 700px) {
  /*
   * The table becomes stacked cards: each cell keeps its heading through the
   * data-title attribute, so the markup stays a real table for assistive
   * technology while reading as a card on a phone.
   */
  .ecf-jl-table thead { display: none; }

  .ecf-jl-table,
  .ecf-jl-table tbody,
  .ecf-jl-table tr,
  .ecf-jl-table td { display: block; width: 100%; }

  .ecf-jl-table tr {
    border: 1px solid var(--line, #dde3de);
    border-radius: var(--radius, 6px);
    padding: 14px 16px;
    margin-bottom: 14px;
  }

  .ecf-jl-table td {
    border: 0;
    padding: 6px 0;
  }

  /* The first cell is the card's heading — it needs no "Job list" label. */
  .ecf-jl-table td:first-child { font-size: var(--fs-lg, 1.16rem); }

  .ecf-jl-table td[data-title]::before {
    content: attr(data-title);
    display: block;
    font-size: var(--fs-label, .72rem);
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--muted, #606a63);
    margin-bottom: 2px;
  }

  .ecf-jl-table__actions {
    text-align: left;
    white-space: normal;
    padding-top: 12px;
  }

  .ecf-jl-table__actions .btn,
  .ecf-jl-table__actions .ecf-jl-inline-form {
    margin: 0 8px 0 0;
  }

  .ecf-jl-footer {
    flex-direction: column;
    align-items: stretch;
  }
}

/* --- Job list control in the finder's summary bar ----------------------- */

.ecf-jl-bar {
  display: flex;
  align-items: center;
  gap: 8px;
}

.ecf-jl-bar__select,
.ecf-jl-bar__name {
  min-height: 44px;
  max-width: 190px;
  font-size: var(--fs-sm, .9375rem);
}

/* The bar sits on the dark brand band, so its controls need their own ground.
   background-color, not the background shorthand: the shorthand would reset
   background-image and take the select's arrow with it. */
.ecf-jl-bar__select,
.ecf-jl-bar__name,
.ecf-jl-bar__go {
  background-color: var(--white, #fff);
  border: 1px solid var(--line, #dde3de);
  border-radius: var(--radius-sm, 4px);
  color: var(--ink, #17201b);
}

/*
 * The same arrow, padding and left alignment as the site's other selects (the
 * sort control, .select in order-form.css, the Kohper B2B fields). Form
 * controls are appearance:none site-wide, so without this the picker is a
 * plain white box that reads as a button rather than a menu — and the bar
 * centres its text on mobile, which made that worse.
 */
.ecf-jl-bar__select {
  cursor: pointer;
  text-align: left;
  padding: 0 38px 0 12px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23606a63' stroke-width='2.5'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
}

.ecf-jl-bar__name { text-align: left; }

.ecf-jl-bar__go {
  padding: 0 16px;
  min-height: 44px;
  font-family: var(--font-head, sans-serif);
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
}

.ecf-jl-bar__go:hover { background: var(--surface, #f5f3ee); }
.ecf-jl-bar__go[disabled] { opacity: .6; cursor: default; }

/* Matches the finder's own bar breakpoint, where it stacks. */
@media (max-width: 600px) {
  /*
   * The picker takes the full width of its own row rather than squeezing in
   * beside the add button, where neither would be tappable.
   *
   * It wraps, because choosing "New job list" adds two more controls. Left on
   * one row all three share the width of a phone — on a 390px screen that was
   * a 161px select with its label clipped, a 161px text field and a 75px
   * button. The select always takes a row of its own; the name field and Save
   * share the next one, which is the one case where two controls side by side
   * still leaves both comfortably tappable.
   */
  .ecf-jl-bar {
    width: 100%;
    flex-wrap: wrap;
  }

  .ecf-jl-bar__select { flex: 1 1 100%; max-width: none; }

  .ecf-jl-bar__name { flex: 1 1 60%; max-width: none; }

  /* Fills its row when the name field is hidden, shares it when it is not. */
  .ecf-jl-bar__go {
    flex: 1 1 auto;
    min-width: 96px;
  }

  /*
   * No padding reserve here any more.
   *
   * This file used to state its own — 265px, because adding the picker makes
   * the bar taller than the finder's own 150px guess. Two files guessing at the
   * height of one element is how both end up wrong: the finder's was 50px short
   * and this one won only because it loads later.
   *
   * The finder measures the bar instead, with a ResizeObserver, so it already
   * accounts for whatever this control adds — including the extra row when
   * "New job list" reveals the name field.
   */
}

/* --- Job lists in the archive rail -------------------------------------- */

.ecf-jl-rail__list {
  list-style: none;
  margin: 0 0 12px;
  padding: 0;
}

.ecf-jl-rail__item a {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  padding: 7px 0;
  color: var(--ink, #17201b);
  text-decoration: none;
  font-size: var(--fs-sm, .9375rem);
}

.ecf-jl-rail__item a:hover .ecf-jl-rail__name { text-decoration: underline; }

.ecf-jl-rail__item.is-active a {
  font-weight: 700;
  color: var(--green-700, #22503a);
}

/* The active list gets a marker in the rail that matches the card badge. */
.ecf-jl-rail__item.is-active .ecf-jl-rail__name::before {
  content: "✓";
  margin-right: 6px;
}

.ecf-jl-rail__count {
  color: var(--muted, #606a63);
  font-size: var(--fs-xs, .8125rem);
  flex-shrink: 0;
}

/* Its own line: run on from the sentence, it reads as part of it. */
.ecf-jl-rail__clear {
  display: block;
  margin-top: 6px;
  font-weight: 600;
}

.ecf-jl-rail__hint,
.ecf-jl-rail__manage {
  margin: 0 0 6px;
  font-size: var(--fs-xs, .8125rem);
  color: var(--muted, #606a63);
  line-height: 1.5;
}

/* --- The badge on a product card ---------------------------------------- */

/*
 * Positioned over the card rather than sitting in its text flow. In flow the
 * badge adds a line to on-list cards only, so titles no longer line up across
 * a row that mixes marked and unmarked products. Top RIGHT: the sale flash
 * already owns the top left corner.
 *
 * The absolute positioning also settles an inheritance problem — WooCommerce's
 * loop link is a flex column, which blockifies an inline-block child and
 * stretched the badge across the whole card.
 */
.products .product.ecf-jl-on-list { position: relative; }

.ecf-jl-flag {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 2;
  max-width: calc(100% - 20px);
  margin: 0;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--green-100, #e8f0ea);
  color: var(--green-800, #1b3d2c);
  font-family: var(--font-head, sans-serif);
  font-size: var(--fs-xs, .8125rem);
  font-weight: 700;
  line-height: 1.6;
}

/*
 * A card on the list is worth spotting from across the grid, but it is still a
 * product card — a tinted edge, not a different component.
 */
.products .product.ecf-jl-on-list {
  outline: 2px solid var(--green-400, #5dba8a);
  outline-offset: 3px;
  border-radius: var(--radius, 6px);
}

/*
 * The list view is a different shape and needs a different mark. An outline
 * around a stacked row sits 3px from the row above it, so consecutive matches
 * read as one chain of lozenges rather than as separate rows. A tinted row with
 * an accent down the leading edge marks each one without touching its
 * neighbour — the same convention as a selected row in a table.
 *
 * It also has to carry the whole message here: Kohper Products' list row
 * deliberately does not fire core's loop item hooks (a quantity input cannot
 * live inside the anchor core wraps a card in), so the badge that names the
 * list on a grid card has nowhere to render. The rail names the active list on
 * the same screen, so the row only has to say "this one".
 */
.products .kohper-products-list__row.ecf-jl-on-list {
  outline: 0;
  border-radius: 0;
  background: var(--green-100, #e8f0ea);
  box-shadow: inset 3px 0 0 var(--green-400, #5dba8a);
}

/* --- Job list control on the product page -------------------------------- */

.ecf-jl-product{
  margin: 20px 0 0;
  padding: 16px 0 0;
  border-top: 1px solid var(--line, #dde3de);
}

.ecf-jl-product__label{
  display: block;
  margin: 0 0 8px;
  font-family: var(--font-head, sans-serif);
  font-size: var(--fs-xs, .8125rem);
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted, #606a63);
}

.ecf-jl-product__row{
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

/* The same arrow and metrics as every other select on the site. */
.ecf-jl-product__select{
  flex: 1 1 200px;
  min-height: 48px;
  cursor: pointer;
  text-align: left;
  padding: 0 38px 0 12px;
  background-color: var(--white, #fff);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23606a63' stroke-width='2.5'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
}

.ecf-jl-product__name{
  flex: 1 1 180px;
  min-height: 48px;
}

.ecf-jl-product__go{
  flex: 0 0 auto;
  min-height: 48px;
}

.ecf-jl-product__status:empty{ display: none; }

.ecf-jl-product__status{
  margin: 10px 0 0;
  font-size: var(--fs-sm, .9375rem);
  color: var(--green-700, #22503a);
}

@media (max-width: 480px){
  .ecf-jl-product__select,
  .ecf-jl-product__name,
  .ecf-jl-product__go{ flex: 1 1 100%; }
}

/* --- Save to List on the bulk order form ---------------------------------
   The same control as the products page's summary bar, rendered under the
   grid and right aligned so it sits beneath the grid's own Add to Order. */
/* It renders as the grid's sibling, so it takes the grid wrapper's measure
   (the theme's .kohper-bulk-order rule) and the wrapper's bottom padding moves
   below it, keeping the two together. */
.kohper-bulk-order:has(+ .ecf-bo-lists){padding-bottom:0}
.ecf-bo-lists{
  display:flex;flex-wrap:wrap;align-items:center;justify-content:flex-end;gap:12px;
  max-width:var(--container,1200px);margin:14px auto 0;
  padding:0 var(--gutter,20px) var(--sp-7,48px);
}
.ecf-bo-lists__status{margin:0;font-size:var(--fs-sm,15px);color:var(--green-700,#22503a)}
.ecf-bo-lists__status:empty{display:none}
.ecf-bo-lists .ecf-jl-bar__select,
.ecf-bo-lists .ecf-jl-bar__name{max-width:240px}

/* Moved into the grid's footer by bulk-order.js, beside Add to Order. It
   drops the measure and padding it needed as the grid's sibling, and the
   status line takes a row of its own above the controls. */
.ecf-bo-lists.is-in-footer{
  max-width:none;margin:0;padding:0;justify-content:flex-end;flex:0 1 auto;
}
.ecf-bo-lists.is-in-footer .ecf-bo-lists__status{flex:1 1 100%;text-align:right}
.kohper-bo__checkout:has(> .ecf-bo-lists){flex-wrap:wrap;justify-content:flex-end}

@media (max-width:600px){
  .ecf-bo-lists{justify-content:stretch}
  .ecf-bo-lists .ecf-jl-bar__signin{flex:1 1 100%}
  .ecf-bo-lists .ecf-jl-bar__select,
  .ecf-bo-lists .ecf-jl-bar__name{max-width:none}
}

/* The way back to the catalogue from a list being edited. Sits between the
   items table and the destructive row below it, so "add more" is nearer the
   list than "delete list" is. */
.ecf-jl-addmore{margin:var(--sp-5,24px) 0 0}

/* ==========================================================================
   Signed out
   ==========================================================================

   Job lists need an account, but the catalogue around them does not. These
   controls used to render nothing at all when signed out, which hid the
   feature from exactly the people who had not signed up for it yet. They now
   carry a prompt that returns the visitor to the page they were reading.
   ========================================================================== */
.ecf-jl-bar__signin{
  display:inline-flex;align-items:center;justify-content:center;
  min-height:44px;padding:10px 18px;white-space:nowrap;
  font-family:var(--font-head,inherit);font-weight:700;font-size:var(--fs-sm,15px);
  color:var(--green-700,#22503a);text-decoration:none;
  background:var(--white,#fff);
  border:1.5px solid var(--line,#dde3de);border-radius:var(--radius-sm,4px);
}
.ecf-jl-bar__signin:hover{background:var(--green-100,#e4f0e9);border-color:var(--green-700,#22503a)}

.ecf-jl-rail__hint{
  margin:0 0 12px;font-size:var(--fs-sm,15px);line-height:1.5;
  color:var(--muted,#606a63);
}

.ecf-jl-signin{
  display:inline-flex;align-items:center;justify-content:center;
  min-height:44px;padding:10px 18px;
  font-family:var(--font-head,inherit);font-weight:700;font-size:var(--fs-sm,15px);
  color:var(--white,#fff);text-decoration:none;
  background:var(--green-700,#22503a);
  border:1.5px solid var(--green-700,#22503a);border-radius:var(--radius-sm,4px);
}
.ecf-jl-signin:hover{background:var(--green-600,#2c6349);color:var(--white,#fff)}

/* --- Typed lists on the edit screen ---------------------------------------
   The customer's own words under "Your list", in the same face as the box
   they typed them into, then the files as links. */
.ecf-jl-typed__label{display:block}
.ecf-jl-typed__text{display:block;margin-top:4px;font-family:var(--font-mono,ui-monospace,monospace);font-size:var(--fs-sm,15px);line-height:1.5;overflow-wrap:anywhere}
.ecf-jl-typed__files{display:block;margin-top:6px;font-size:var(--fs-sm,15px);overflow-wrap:anywhere}
.ecf-jl-table td:first-child .ecf-jl-typed__text,
.ecf-jl-table td:first-child .ecf-jl-typed__files{font-size:var(--fs-sm,15px)}
