/* Cron Parser — an expression card (the field with its five-column legend,
   the error caption, the description row with Copy), a presets card, the
   next-runs card whose rows are the list items, and the syntax reference
   as a disclosure card (layout from styles/components/form.css). Only the
   expression field, the legend, the run columns and the reference grid are
   the page's own. */

/* input.<class>: the shared form rule input[type="…"] in common.css is
   (0,1,1) and would beat a bare class. */
input.cp-expr {
  display: block;
  width: 100%;
  border: 1px solid var(--border);
  background: var(--bg-elev-2);
  color: var(--text);
  font-family: var(--mono);
  font-size: 18px;
  font-weight: 600;
  letter-spacing: 0.02em;
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-md);
  outline: none;
  text-align: left;
  transition: border-color var(--duration-snap) var(--ease-standard);
}
input.cp-expr:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

/* The legend under the field: one label per cron field, inset like the
   field's text so the first label sits under the first token. */
.cp-fields {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: var(--space-1);
  text-align: left;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-muted);
  letter-spacing: 0.02em;
  text-transform: uppercase;
  padding-inline: var(--space-4);
}

.cp-error {
  font-family: var(--mono);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

/* The description is the answer: a larger label, Copy beside it. */
.cp-desc {
  font-size: 16px;
  font-weight: 500;
  letter-spacing: -0.005em;
  line-height: 1.4;
}
/* Copy keeps its size however long the description wraps. */
#cp-copy { flex: none; }

/* Active preset: highlight the chip whose cron matches the current
   expression so the set reads as selectable, not just actions. */
.cp-presets .btn[aria-pressed="true"] {
  background: var(--accent);
  color: #ffffff;
}

/* Next runs — the list is the card, each run a row. An invalid expression
   empties the list; the whole section goes with it. */
ol.cp-next-list { list-style: none; margin: 0; padding: 0; }
.cp-next:has(> .cp-next-list:empty) { display: none; }

.cp-tz {
  align-self: center;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
}

.cp-run {
  display: grid;
  grid-template-columns: 32px 1fr auto;
  align-items: baseline;
  font-family: var(--mono);
  font-size: 13px;
}
.cp-run .cp-i { color: var(--text-muted); font-size: 11px; }
.cp-run .cp-when { color: var(--text); }
.cp-run .cp-rel { color: var(--text-muted); font-size: 12px; text-align: end; }

/* Syntax reference — the heading is the shared disclosure component. */
.cp-help-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: var(--space-2) var(--space-4);
}
.cp-help-grid > div {
  display: flex;
  align-items: baseline;
  gap: var(--space-2);
  font-size: 12px;
  color: var(--text-muted);
}
.cp-help-grid code {
  font-family: var(--mono);
  background: var(--bg-fill-2);
  padding: 1px 6px;
  border-radius: var(--radius-xs);
  color: var(--text);
}

/* Narrow phones: the five-column legend's longer labels run together, so
   tighten it and pull its inset in with the field's. */
@media (max-width: 480px) {
  .cp-fields {
    font-size: 10px;
    letter-spacing: 0;
    gap: var(--space-2);
    padding-inline: var(--space-3);
  }
  input.cp-expr { padding-inline: var(--space-3); }
  .cp-run { grid-template-columns: 28px 1fr; }
  .cp-run .cp-rel { grid-column: 2; text-align: start; }
}
