/* ============================================================================
 * Design 2 (iWorkForSA) — Application Step 2 (Application Questions, pageID 232).
 * Question-specific styling only; the shared shell (.apply-header, .stepper,
 * .apply-layout, .apply-aside, .form-section, .form-actions, buttons) is defined
 * in pageID-268-iworkforsa.css, which also loads on every page. All rules are
 * scoped under .iwfsa-apply. The question table is left intact (see
 * questions-iworkforsa.js) — these rules only restyle it.
 * ==========================================================================*/

/* Hide the engine's own chrome once the JS re-layout has succeeded. */
.iwfsa-apply.iwfsa-ready .pageheading,
.iwfsa-apply.iwfsa-ready #brsStepCount,
.iwfsa-apply.iwfsa-ready #steps { display: none !important; }
.iwfsa-apply.iwfsa-ready #steps + br,
.iwfsa-apply.iwfsa-ready #brsStepCount + br { display: none !important; }

/* ── Question table → clean, modern rows ── */
.iwfsa-apply table.Report {
    width: 100%; border-collapse: collapse; background: transparent; margin: 0;
}
.iwfsa-apply table.Report > tbody > tr {
    background: transparent !important;
}
.iwfsa-apply table.Report > tbody > tr > td {
    padding: 16px 4px; vertical-align: top; border-bottom: 1px solid #f0f0f0;
    font-size: 13px; color: #333; line-height: 1.5;
}
.iwfsa-apply table.Report > tbody > tr:last-child > td { border-bottom: 0; }

/* Section heading rows (e.g. "1. Attachments") */
.iwfsa-apply td.reportheading {
    font-size: 12px; font-weight: 700; color: #000; text-transform: uppercase; letter-spacing: 0.5px;
    padding: 18px 4px 10px !important; border-bottom: 2px solid #e05a2b !important; background: transparent;
}
.iwfsa-apply table.Report > tbody > tr:first-child td.reportheading { padding-top: 4px !important; }

/* Question label / answer columns */
.iwfsa-apply td.questionLabel {
    width: 42%; font-weight: 600; color: #222; padding-right: 24px !important;
}
.iwfsa-apply td.questionLabel b { font-weight: 600; }
.iwfsa-apply td.questionOption { color: #333; }
.iwfsa-apply td.questionOption > table,
.iwfsa-apply td.questionOption table[border] { border: 0; margin: 0; }
.iwfsa-apply td.questionOption table td { padding: 0; border: 0; }

/* Normalise visible answer controls to the Design-2 input look.
   (Hidden helper <select>s keep their inline display:none — not overridden.) */
.iwfsa-apply td.questionOption select,
.iwfsa-apply td.questionOption input[type="text"],
.iwfsa-apply td.questionOption input[type="number"],
.iwfsa-apply td.questionOption textarea {
    border: 1px solid #ddd; padding: 9px 12px; font-size: 13px; font-family: inherit;
    background: #fff; color: #222; outline: none; border-radius: 0; min-width: 260px; max-width: 100%;
    transition: border 0.15s;
}
.iwfsa-apply td.questionOption select { min-width: 260px; height: auto; }
.iwfsa-apply td.questionOption select:hover,
.iwfsa-apply td.questionOption input[type="text"]:hover { border-color: #aaa; }
.iwfsa-apply td.questionOption select:focus,
.iwfsa-apply td.questionOption input[type="text"]:focus { border-color: #e05a2b; }

/* Radio / checkbox answer options */
.iwfsa-apply td.questionOption input[type="radio"],
.iwfsa-apply td.questionOption input[type="checkbox"] {
    width: 15px; height: 15px; margin: 0 6px 0 0; vertical-align: middle; cursor: pointer;
}

/* Attachment (plupload) area */
.iwfsa-apply .my-account-attachment { padding: 0; }
.iwfsa-apply .myattachments-label {
    display: block; font-size: 11px; font-weight: 700; color: #666; text-transform: uppercase;
    letter-spacing: 0.4px; margin: 4px 0 2px;
}
.iwfsa-apply table.Report td[colspan="2"] { padding: 14px 20px !important; }
.iwfsa-apply table.Report td[colspan="2"] br { line-height: 0.6; }

/* ── Compact, on-brand buttons inside the question table ──
   These sit in full-width attachment cells (not td.questionOption), and the
   engine emits them with Bootstrap (.btn.btn-secondary) / inline styles, so we
   override with !important and broad name/value selectors. */
.iwfsa-apply table.Report input[type="button"] {
    -webkit-appearance: none; appearance: none;
    padding: 7px 16px !important; font-size: 11px !important; font-weight: 700 !important;
    line-height: 1.2 !important; font-family: inherit !important; text-transform: uppercase;
    letter-spacing: 0.4px; cursor: pointer; width: auto !important; min-width: 0 !important;
    height: 38px !important; box-sizing: border-box !important; vertical-align: middle !important;
    margin: 0 8px 8px 0 !important; border-radius: 0 !important;
    box-shadow: none !important; background-image: none !important; transition: background 0.15s, color 0.15s;
}
/* Add-file (primary-ish outline) */
.iwfsa-apply .my-attachment-upload-btn,
.iwfsa-apply table.Report input[type="button"][name="AddFile"],
.iwfsa-apply table.Report input[type="button"][value="Add File"],
.iwfsa-apply table.Report input[type="button"][value="Add"] {
    background: #fff !important; color: #e05a2b !important; border: 1px solid #e05a2b !important;
}
.iwfsa-apply .my-attachment-upload-btn:hover,
.iwfsa-apply table.Report input[type="button"][name="AddFile"]:hover,
.iwfsa-apply table.Report input[type="button"][value="Add File"]:hover,
.iwfsa-apply table.Report input[type="button"][value="Add"]:hover { background: #fff5ef !important; }
/* Delete / remove (subtle neutral) */
.iwfsa-apply table.Report input[type="button"][name="RemoveFile"],
.iwfsa-apply table.Report input[type="button"][value="Delete"] {
    background: #fff !important; color: #999 !important; border: 1px solid #d5d5d5 !important;
}
.iwfsa-apply table.Report input[type="button"][name="RemoveFile"]:hover,
.iwfsa-apply table.Report input[type="button"][value="Delete"]:hover {
    background: #f7f7f7 !important; color: #333 !important; border-color: #bbb !important;
}
/* View / transfer helpers (quiet) */
.iwfsa-apply table.Report input[type="button"][name="ViewFile"],
.iwfsa-apply table.Report input[type="button"][name=">>"] {
    background: #fff !important; color: #666 !important; border: 1px solid #ddd !important;
    text-transform: none !important; letter-spacing: 0 !important;
}

/* ── Saved-attachment row: filename <select> + Delete, neatly aligned ──
   These live in full-width attachment cells (td[colspan="2"]), separate from the
   answer dropdowns in td.questionOption. The engine caps this select at ~150px
   (Bootstrap .custom-select / inline width) so long filenames clip — widen it,
   fix the arrow overlap, and vertically align it with the Delete button.
   NB: target only the visible copy…[] select; a sibling display:none "multiple"
   helper select must stay hidden, so we do NOT override its display. */
.iwfsa-apply table.Report td[colspan="2"] select[name^="copy"] {
    vertical-align: middle !important;
    width: 340px !important; min-width: 340px !important; max-width: 340px !important;
    box-sizing: border-box !important;
    margin: 0 8px 8px 0 !important;
    font-size: 13px !important; font-family: inherit !important; line-height: 1.4 !important;
    color: #222 !important; background-color: #fff !important;
    border: 1px solid #ddd !important; border-radius: 0 !important;
}
/* Single file → compact dropdown (one row) */
.iwfsa-apply table.Report td[colspan="2"] select[name^="copy"][size="1"] {
    height: 38px !important; padding: 8px 34px 8px 12px !important;
    text-overflow: ellipsis !important;
}
/* Two or more files → the engine renders a listbox (size>1). Cap it to ~3 visible
   rows at a fixed width and scroll for the rest, instead of growing unbounded. */
.iwfsa-apply table.Report td[colspan="2"] select[name^="copy"]:not([size="1"]) {
    height: auto !important; max-height: 84px !important; overflow-y: auto !important;
    padding: 4px !important; vertical-align: top !important;
}
.iwfsa-apply table.Report td[colspan="2"] select[name^="copy"]:not([size="1"]) option {
    padding: 3px 8px !important; line-height: 1.4 !important;
}
.iwfsa-apply table.Report td[colspan="2"] select[name^="copy"]:hover { border-color: #aaa !important; }
.iwfsa-apply table.Report td[colspan="2"] select[name^="copy"]:focus { border-color: #e05a2b !important; outline: none !important; }
/* Keep the Delete button aligned with the top of the select (single or listbox) */
.iwfsa-apply table.Report td[colspan="2"] input[type="button"] {
    vertical-align: top !important; height: 38px !important; box-sizing: border-box !important;
}

/* Full-width attachment rows: let the nested layout breathe */
.iwfsa-apply table.Report > tbody > tr > td[colspan="2"] table { width: auto; }

/* Left-aligned Back button on this step (real engine button, not disabled) */
.iwfsa-apply .form-actions .actions-left .btn-back-step { background: #fff; color: #888; border-color: #ddd; }
.iwfsa-apply .form-actions .actions-left .btn-back-step:hover { border-color: #999; color: #000; }

/* ── Bottom action bar buttons ──
   The engine emits Back/Save/Next with Bootstrap / inline styling that makes
   them oversized and solid-orange. Override (scoped to 232) so they match the
   trim Design-2 buttons. Classes are added by questions-iworkforsa.js. */
.iwfsa-apply .form-actions input[type="button"],
.iwfsa-apply .form-actions .btn-back-step {
    -webkit-appearance: none; appearance: none;
    padding: 9px 18px !important; font-size: 11px !important; font-weight: 700 !important;
    line-height: 1.2 !important; letter-spacing: 0.5px !important; text-transform: uppercase !important;
    font-family: inherit !important; width: auto !important; min-width: 0 !important; height: auto !important;
    margin: 0 !important; border-radius: 0 !important; border: 1px solid !important;
    box-shadow: none !important; background-image: none !important;
}
.iwfsa-apply .form-actions input.btn-back-step,
.iwfsa-apply .form-actions .btn-back-step {
    background: #fff !important; color: #666 !important; border-color: #ddd !important;
}
.iwfsa-apply .form-actions input.btn-back-step:hover,
.iwfsa-apply .form-actions .btn-back-step:hover { color: #000 !important; border-color: #999 !important; }
.iwfsa-apply .form-actions input.btn-save {
    background: #fff !important; color: #e05a2b !important; border-color: #e05a2b !important;
}
.iwfsa-apply .form-actions input.btn-save:hover { background: #fff5ef !important; }
.iwfsa-apply .form-actions input.btn-next {
    background: #e05a2b !important; color: #fff !important; border-color: #e05a2b !important;
}
.iwfsa-apply .form-actions input.btn-next:hover { background: #c94d22 !important; border-color: #c94d22 !important; }

@media (max-width: 900px) {
    .iwfsa-apply td.questionLabel,
    .iwfsa-apply td.questionOption { display: block; width: 100%; padding-right: 4px !important; }
    .iwfsa-apply td.questionLabel { border-bottom: 0; padding-bottom: 4px !important; }
    .iwfsa-apply td.questionOption select { min-width: 0; width: 100%; }
}

/* ── Auto-save status (injected into the sidebar progress note) ── */
.iwfsa-apply .iwfsa-autosave-status {
    display: block; margin-top: 8px; padding-top: 8px; border-top: 1px solid #f4d9c6;
    font-size: 11px; font-weight: 700; letter-spacing: 0.2px;
}
.iwfsa-apply .iwfsa-autosave-status.is-idle { color: #8a6f5f; font-weight: 600; }
.iwfsa-apply .iwfsa-autosave-status.is-saving { color: #c94d22; }
.iwfsa-apply .iwfsa-autosave-status.is-saved { color: #2e7d32; }
.iwfsa-apply .iwfsa-autosave-status.is-error { color: #b3261e; }
