/*
 * Draft buttons style (task R09), mobile first.
 * What: layout of the save, load and delete buttons of part 70.
 * Loaded by: C22 (only on the form page). Why: the buttons are easy to
 * press with a finger and do not change other buttons of the site.
 */

/*
 * Minimum height and width of a draft button.
 * Type: CSS length. Source: UI expert value, not verified: confirm before use (request to the PM).
 * Used in: .f2513-draft-btn below (defined on .f2513-draft, so no other
 * element of the site is touched).
 * Business purpose: a button is easy to press on a phone.
 */
.f2513-draft {
  --f2513-draft-tap: 44px;
  position: relative; /* the parent of the hidden file input (position: absolute below) */
  display: flex;
  flex-wrap: wrap;
  direction: rtl;
  gap: 8px;
}

.f2513-draft .f2513-draft-btn {
  min-height: var(--f2513-draft-tap);
  min-width: var(--f2513-draft-tap);
  cursor: pointer;
}

.f2513-draft .f2513-draft-btn:focus {
  outline: 3px solid currentColor;
  outline-offset: 2px;
}

/* The file input is hidden to the eye only, and stays reachable by keyboard; its label is the visible button. */
.f2513-draft .f2513-draft-file {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

.f2513-draft .f2513-draft-file:focus + .f2513-draft-btn {
  outline: 3px solid currentColor;
  outline-offset: 2px;
}

.f2513-draft #f2513-draft-confirm,
.f2513-draft #f2513-draft-msg,
.f2513-draft #f2513-draft-ios {
  flex-basis: 100%;
}

/* An empty message or hint takes no room, so it cannot push the buttons (QA finding 1). */
.f2513-draft #f2513-draft-msg:empty,
.f2513-draft #f2513-draft-ios:empty {
  display: none;
}

/*
 * The confirmation of "clear" as a window (UI1 item 18).
 * What: while the area is not hidden, it is a gray window in the middle of the screen, in the style of a plain
 *   desktop window (square corners, thin dark frame, gray face), with the rest of the screen darkened behind it.
 *   The darkening is the very large outer shadow of the window, so no extra element is needed.
 * Input: the attribute hidden of div#f2513-draft-confirm, which the script of package B (delete.js) removes and
 *   sets. Output: position and look only. The text is right to left and centred.
 *   V10B_06: the text takes the whole first line; the two buttons share the bottom line, one at each side ("cancel" on
 *   the right, "yes, delete" on the left).
 * Business purpose: the question to delete the draft cannot be missed and does not disturb the layout of the form.
 */
#f2513-draft-confirm:not([hidden]) {
  position: fixed;
  top: 50%;
  left: 50%;
  right: auto;
  bottom: auto;
  transform: translate(-50%, -50%);
  z-index: 100000;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  width: min(92vw, 420px);
  padding: 24px;
  background: #e9e9ea;
  border: 1px solid #6e6e6e;
  border-radius: 0;
  box-shadow: 0 0 0 100vmax rgba(0, 0, 0, 0.55), 0 8px 24px rgba(0, 0, 0, 0.4);
  direction: rtl;
  text-align: center;
  color: #1a1a1a;
}

/* V10B_06 (owner request V10B, 23:56:18): the question of the clear dialog takes a whole line, so both buttons go to
   the bottom line together. Input: span.f2513-confirm-text inside the open dialog. Output: layout only. */
#f2513-draft-confirm:not([hidden]) > .f2513-confirm-text {
  flex: 0 0 100%;
  order: 0;
}

/* V10B_06 (owner addition 23:57): "cancel" on the right and "yes, delete" on the left of the bottom line. The dialog is
   right to left (direction: rtl), so the flex line starts on the right: "cancel" gets order 1 (first, right) and
   "yes" order 2 (last, left). The DOM order and the focus order of delete.js are not changed. */
#f2513-draft-confirm:not([hidden]) > #f2513-draft-confirm-no {
  order: 1;
}

#f2513-draft-confirm:not([hidden]) > #f2513-draft-confirm-yes {
  order: 2;
}

/*
 * Warning of the draft message (item for package D, save_partial).
 * What: the class f2513-draft-warn marks the message "the file was saved, but only with the open step"; it is used with
 *   role="status" (not alert). The look is a soft orange (dark amber text on a pale amber background, thin amber frame),
 *   not the red of an error. The existing rules of the error and success classes are not touched.
 * Input: the class f2513-draft-warn on the message element (#f2513-draft-msg or a child), set by js/f2513/draft/messages.js.
 * Output: colour, frame and spacing only. Business purpose: the user sees a caution and not a failure, because the file
 *   was saved. Contrast of #7a4a00 on #fff4e0 is above 7 to 1 (WCAG luminance, computed by hand).
 */
.f2513-draft .f2513-draft-warn,
.f2513-draft-warn {
  color: #7a4a00;
  background-color: #fff4e0;
  border: 1px solid #e0a040;
  padding: 8px 12px;
  text-align: center;
  direction: rtl;
}

/*
 * The sentence about the password of the file, and the password form of the load (V7 topic 9, owner decision
 * 2026-11-30 18:01, KB PM-0326).
 * What: p.f2513-draft-pass is the sentence "the password of the file is your ID number as it was at the save",
 *   1.25 times the font of the message and bold; div.f2513-draft-pwd is the form that bind.js builds in the message
 *   area when an encrypted file is chosen: the label on its own line, then the box of digits (left to right) and the
 *   button "פתיחה" in one row, and the line of a wrong password under them in the dark red of the errors.
 * Input: the classes set by js/f2513/draft/bind.js. Output: look only.
 * Business purpose: the visitor does not miss the password, and opens the file with it.
 */
#f2513-draft-msg .f2513-draft-pass {
  margin: 6px 0 0;
  font-size: 1.25em;
  font-weight: 700;
}

/* V20 (owner order 2026-12-03): the password box is as wide as one form column (col-2: half of the row, minus the gap), and the
   button "פתיחה" is in a column of its own (the other half), aligned to the LEFT edge of that column. Up to 590px (the break point of the
   form) both are one under the other, the box at the full width and the button at the left. Input: div.f2513-draft-pwd of bind.js
   (label, input, button, status). Output: look only. */
#f2513-draft-msg .f2513-draft-pwd {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  align-items: center;
  column-gap: var(--f2513-col-gap, 20px);
  row-gap: 8px;
  direction: rtl;
  text-align: right;
}

#f2513-draft-msg .f2513-draft-pwd label {
  grid-column: 1 / -1;
  font-weight: 700;
}

#f2513-draft-msg .f2513-draft-pwd input {
  min-width: 0;
  width: 100%;
  direction: ltr;
  text-align: left;
}

#f2513-draft-msg .f2513-draft-pwd button {
  justify-self: left;
}

@media (max-width: 590px) {
  #f2513-draft-msg .f2513-draft-pwd {
    grid-template-columns: minmax(0, 1fr);
  }
}

#f2513-draft-msg .f2513-draft-pwd-status {
  grid-column: 1 / -1;
  margin: 0;
  color: #b3261e;
}
