/* Ledger A - forms and pop-ups: text and colour boxes, the shared pop-up shell used by the event
   and task forms, the Starts / Ends rows and the small warning pop-ups. The controls inside the
   forms (drop-downs, day chooser, priority slider, pill) are in controls.css, loaded right after.
   Loaded after layout.css and BEFORE the feature files: their own rows (Repeat, Travel, Time to
   do...) narrow these boxes and must come later to win. */

/* ---------- text boxes and colour boxes ---------- */
/* .picker-button is the box a drop-down or day chooser opens from (more in controls.css). */
.name-input,
.picker-button {
  border: var(--border-thin) solid var(--colour-line-strong);
  border-radius: var(--radius-6);
  background: var(--colour-surface-field);
  color: var(--colour-text);
  font: inherit;
  padding: var(--space-6) var(--space-8);
  min-width: 0;
}
/* keep text boxes readable in narrow windows */
.name-input {
  min-width: var(--size-120);
}
.name-input:disabled {
  background: transparent;
  border-color: transparent;
  color: var(--colour-text);
  font-weight: var(--font-weight-medium);
}
/* a text box of several lines (Notes): it can be made taller, not wider */
.name-input--multiline {
  resize: vertical;
}
.colour-input {
  width: var(--size-30);
  height: var(--size-30);
  flex: none;
  padding: 0;
  border: 0;
  border-radius: var(--radius-round);
  background: none;
  cursor: pointer;
}
.colour-input::-webkit-color-swatch-wrapper {
  padding: 0;
}
.colour-input::-webkit-color-swatch {
  border: var(--border-medium) solid var(--colour-line-strong);
  border-radius: var(--radius-round);
}
.colour-input::-moz-color-swatch {
  border: var(--border-medium) solid var(--colour-line-strong);
  border-radius: var(--radius-round);
}
.field-label {
  width: var(--size-70);
  color: var(--colour-text-muted);
}

/* ---------- the pop-up forms (ui/shared/form-dialog.js): box, rows and buttons ---------- */
.form-dialog {
  width: var(--size-440);
  max-width: calc(100vw - var(--size-32));
  padding: 0;
  border: 0;
  border-radius: var(--radius-12);
  background: var(--colour-surface-stage);
  color: var(--colour-text);
  box-shadow: var(--shadow-dialog);
  overflow: visible; /* so an open drop-down list can reach past the edge of the box */
}
.form-dialog::backdrop {
  background: var(--colour-overlay);
}
.form-dialog__form {
  display: flex;
  flex-direction: column;
  gap: var(--space-12);
  padding: var(--space-18) var(--space-20);
}
.form-dialog__heading {
  margin: 0 0 var(--space-2);
  font-size: var(--font-size-2xl);
}
/* One row of a form: a label on the left, its control on the right. */
.dialog-field {
  display: flex;
  align-items: center;
  gap: var(--space-12);
}
.dialog-field__label {
  flex: none;
  width: var(--size-84);
}
/* A row that is a <fieldset>: no border or spacing of its own. Its <legend> is floated so the
   browser treats it as an ordinary item in the row, not as a caption on the border. */
.dialog-field--group {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}
.dialog-field__label--legend {
  float: left;
  padding: 0;
}
/* a text box, drop-down or day chooser that fills the rest of its row */
.dialog-field__input {
  flex: 1;
  width: auto;
}
/* the event form's colour box and its "Use the commitment's colour" tick */
.colour-row {
  display: flex;
  align-items: center;
  gap: var(--space-8);
  flex: 1;
}
.check-label {
  display: flex;
  align-items: center;
  gap: var(--space-6);
  color: var(--colour-text-muted);
}
/* The tick-box look used for "All day" and "Use the commitment's colour": a ring that holds a
   filled dot when ticked (same size as the Done circle in tasks.css), never a square box. */
.ring-check {
  flex: none;
  width: var(--size-16);
  height: var(--size-16);
  margin: 0;
  padding: var(--border-ring); /* the gap between ring and dot: as thick as the ring itself */
  border: var(--border-ring) solid var(--colour-text-muted);
  border-radius: var(--radius-round);
  background: transparent;
  background-clip: content-box; /* the dot is the fill inside the padding */
  appearance: none;
  cursor: pointer;
}
.ring-check:hover {
  border-color: var(--colour-text);
}
.ring-check:checked {
  border-color: var(--colour-accent);
  background-color: var(--colour-accent);
}
.ring-check:focus-visible {
  outline: var(--border-medium) solid var(--colour-accent);
  outline-offset: var(--space-2);
}
.dialog-buttons {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--space-8);
  margin-top: var(--space-4);
}
.dialog-buttons__delete {
  margin-right: auto;
}
/* the "Save this event?" question shown when clicking out of a changed form */
.dialog-buttons[hidden] {
  display: none;
}
.dialog-buttons__question {
  margin-right: auto;
  font-weight: var(--font-weight-medium);
}

/* ---------- hidden rows and the Starts / Ends rows (the day chooser is in controls.css) ---------- */
.dialog-field[hidden] {
  display: none;
}
/* "Starts" and "Ends" rows in the form: a day chooser with a typed time beside it. */
.when-row {
  display: flex;
  flex: 1;
  align-items: center;
  gap: var(--space-8);
  min-width: 0;
}
.when-row__date {
  flex: 1;
}
.when-row__time {
  flex: none;
  width: var(--size-112);
  min-width: 0;
}
.when-row__time[hidden] {
  display: none;
}

/* ---------- the small warning pop-ups (ui/shared/confirm-dialog.js, ui/events/repeat-scope-dialog.js) ---------- */
.confirm-dialog {
  width: var(--size-380);
  max-width: calc(100vw - var(--size-32));
  padding: 0;
  border: 0;
  border-radius: var(--radius-12);
  background: var(--colour-surface-stage);
  color: var(--colour-text);
  box-shadow: var(--shadow-dialog);
}
.confirm-dialog::backdrop {
  background: var(--colour-overlay);
}
.confirm-dialog__box {
  display: flex;
  flex-direction: column;
  gap: var(--space-12);
  padding: var(--space-18) var(--space-20);
}
.confirm-dialog__title {
  margin: 0;
  font-size: var(--font-size-2xl);
}
.confirm-dialog__message {
  margin: 0;
  color: var(--colour-text-muted);
  line-height: var(--line-height-body);
}

/* ---------- repeating events and tasks: the Repeat rows in their forms and the which ones? pop-up (ui/events/event-form-repeat.js, ui/events/repeat-scope-dialog.js) ---------- */
.every-row,
.until-row {
  display: flex;
  flex: 1;
  align-items: center;
  gap: var(--space-6);
  min-width: 0;
}
/* The row that spreads the seven day bubbles out. */
.weekday-row {
  display: flex;
  flex: 1;
  align-items: center;
  justify-content: space-between;
  min-width: 0;
}
/* The seven day bubbles are true circles: fixed width = height, spread across the row. */
.weekday-row__day {
  flex: none;
  width: var(--size-32);
  height: var(--size-32);
  padding: 0;
  border: var(--border-thin) solid var(--colour-line-strong);
  border-radius: var(--radius-round);
  background: var(--colour-surface-field);
  color: var(--colour-text-muted);
  font-weight: var(--font-weight-bold);
}
.weekday-row__day:hover {
  background: var(--colour-surface-control);
}
/* a chosen day keeps its colour when hovered */
.weekday-row__day--on,
.weekday-row__day--on:hover {
  border-color: var(--colour-accent);
  background: var(--colour-accent);
  color: var(--colour-text-on-accent);
}
.every-row__count {
  flex: none;
  width: var(--size-64);
}
.until-row__mode {
  flex: none;
  width: var(--size-120);
}
.until-row__date {
  flex: 1;
}
.until-row__date[hidden] {
  display: none;
}
/* "After [10] times" in the Ends row */
.times-box {
  display: flex;
  flex: 1;
  align-items: center;
  gap: var(--space-6);
}
.times-box__count {
  flex: none;
  width: var(--size-64);
}
.times-box[hidden] {
  display: none;
}
/* The which-ones pop-up reuses the delete warning's box (.confirm-dialog); only the stacked
   choices are new. */
.scope-choices {
  display: flex;
  flex-direction: column;
  gap: var(--space-8);
}
.scope-choices__button {
  padding: var(--space-9) var(--space-12);
}
