/* ============================================================
   CANWIDE STEEL · SAFETY FORM DESIGN SYSTEM
   assets/css/form.css — Shared across all document forms
   Professional · Authentic · Reliable
   ============================================================ */

/* ─── PRINT ────────────────────────────────────────────────── */
@media print {
    @page { size: 305mm 457mm; margin: 1.2cm; }
    
    ::placeholder {
        color: transparent !important;
    }

    body {
        background: white !important;
        padding: 0 !important;
        margin: 0 !important;
        font-size: 9pt !important;
        line-height: 1.3 !important;
        display: block !important;
        align-items: unset !important;
    }

    .app-container {
        max-width: 100% !important;
        width: 100% !important;
        box-shadow: none !important;
        border-radius: 0 !important;
        background: white !important;
        overflow: visible !important;
    }

    .page-content {
        padding: 0 !important;
        margin: 0 !important;
    }

    /* ── Hide all interactive / UI-only elements ── */
    .print-hide,
    .action-bar,
    .share-buttons,
    .remove-employee,
    .select2-container,
    .back-link { display: none !important; }

    /* ── Kill extra spacing on section headers ── */
    .section-header {
        margin: 8px 0 6px !important;
        padding: 5px 10px !important;
    }

    /* ── Tighten outcome box ── */
    .outcome-box {
        margin: 10px 0 !important;
        padding: 10px !important;
    }

    /* ── Collapse flex/grid gaps so no huge whitespace ── */
    .two-col-grid {
        gap: 10px !important;
    }

    /* ── Footer: no heavy background bar ── */
    .app-footer {
        background: none !important;
        color: #999 !important;
        padding: 4px 0 0 !important;
        font-size: 7pt !important;
        border-top: 1px solid #ddd;
    }

    /* ── Comments boxes ── */
    .comments-box {
        margin-bottom: 6px !important;
    }

    /* ── Letterhead ── */
    .letterhead {
        margin-bottom: 10px !important;
        padding-bottom: 8px !important;
    }

    /* ── Page break helpers ── */
    .selected-employee-card {
        break-inside: avoid;
        page-break-inside: avoid;
        border: 1px solid #ccc !important;
        background: white !important;
    }

    .section-header,
    .table-container,
    .inspection-table,
    .outcome-box { break-inside: avoid; page-break-inside: avoid; }
}

/* ─── GLOBAL FORM PAGE BODY ──────────────────────────────── */
body {
    background: #e8ecf0;
    font-family: 'Inter', 'Helvetica Neue', sans-serif;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 24px 16px 100px;
    color: #111;
    font-size: 9.5pt;
    line-height: 1.4;
}

/* ─── BACK LINK ──────────────────────────────────────────── */
.back-link {
    width: 100%;
    max-width: 960px;
    margin-bottom: 12px;
    display: flex;
}

.back-link a {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.78rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: #475569;
    text-decoration: none;
    padding: 6px 12px;
    border-radius: 6px;
    background: rgba(255,255,255,.7);
    border: 1px solid #cbd5e1;
    transition: all 150ms;
}

.back-link a:hover {
    background: white;
    color: #111;
    border-color: #94a3b8;
}

/* ─── APP CONTAINER (PAPER CARD) ─────────────────────────── */
.app-container {
    max-width: 960px;
    width: 100%;
    background: white;
    box-shadow:
        0 0 0 1px rgba(0,0,0,.04),
        0 2px 4px rgba(0,0,0,.04),
        0 8px 24px rgba(0,0,0,.08),
        0 24px 64px rgba(0,0,0,.06);
    border-radius: 4px;
    overflow: hidden;
}

/* ─── PAGE CONTENT ───────────────────────────────────────── */
.page-content {
    padding: 36px 40px 32px;
}

@media (max-width: 680px) {
    .page-content { padding: 20px 16px; }
}

/* ─── LETTERHEAD ─────────────────────────────────────────── */
.letterhead {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
    border-bottom: 3px solid #111;
    padding-bottom: 16px;
    margin-bottom: 18px;
}

.logo-section { width: 220px; flex-shrink: 0; }
.logo-section img { max-width: 100%; height: auto; }

.title-section { text-align: right; }

.title-main {
    font-family: 'Roboto Condensed', 'Arial Narrow', sans-serif;
    font-size: 22pt;
    font-weight: 700;
    color: #111;
    text-transform: uppercase;
    letter-spacing: -0.3px;
    line-height: 1.1;
}

.title-sub {
    font-size: 8.5pt;
    font-weight: 600;
    color: #b02a37;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    margin-top: 4px;
}

.form-info {
    font-size: 7.5pt;
    color: #94a3b8;
    margin-top: 5px;
    letter-spacing: 0.3px;
}

/* ─── WARNING BOX ─────────────────────────────────────────── */
.warning-box {
    background: linear-gradient(135deg, #fffbeb, #fef3c7);
    border: 2px solid #d97706;
    border-left: 6px solid #d97706;
    padding: 10px 16px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    font-family: 'Roboto Condensed', sans-serif;
    font-weight: 700;
    font-size: 15pt;
    color: #92400e;
    text-transform: uppercase;
    letter-spacing: .5px;
}

.warning-box i { color: #dc2626; font-size: 18pt; }

/* ─── SECTION HEADERS ─────────────────────────────────────── */
.section-header {
    display: flex;
    align-items: center;
    gap: 0;
    background: #f8fafc;
    border-left: 5px solid #b02a37;
    padding: 7px 12px;
    margin: 22px 0 12px;
    font-family: 'Roboto Condensed', sans-serif;
    font-weight: 700;
    font-size: 11pt;
    text-transform: uppercase;
    letter-spacing: .5px;
    color: #111;
    border-bottom: 1px solid #e2e8f0;
}

.subsection-header {
    font-family: 'Roboto Condensed', sans-serif;
    font-weight: 700;
    font-size: 10pt;
    text-transform: uppercase;
    color: #334155;
    margin: 14px 0 8px;
    padding-bottom: 3px;
    border-bottom: 1px solid #cbd5e1;
    letter-spacing: .3px;
}

/* ─── FORM ROWS / GRID ────────────────────────────────────── */
.form-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0 12px;
    margin-bottom: 8px;
}

.form-col { flex: 1; min-width: 140px; }
.form-col-2 { flex: 2; }
.form-col-3 { flex: 3; }

.form-field {
    margin-bottom: 10px;
    border-bottom: 1px solid #cbd5e1;
    padding-bottom: 2px;
    transition: border-color 150ms;
}

.form-field:focus-within { border-bottom-color: #111; }

.form-field label {
    display: block;
    font-size: 6.8pt;
    font-weight: 700;
    text-transform: uppercase;
    color: #94a3b8;
    letter-spacing: .4px;
    margin-bottom: 2px;
}

.form-field input,
.form-field select,
.form-field textarea {
    width: 100%;
    border: none;
    padding: 6px 8px;
    font-size: 9.5pt;
    font-family: inherit;
    background: transparent;
    color: #111;
    outline: none;
}
textarea {
    padding: 10px 12px !important;
    line-height: 1.5;
    min-height: 80px;
}

/* ─── DEFINITION TEXT ─────────────────────────────────────── */
.definition-text {
    background: #f8fafc;
    padding: 12px 14px;
    border: 1px solid #e2e8f0;
    border-left: 3px solid #cbd5e1;
    font-size: 8.5pt;
    line-height: 1.55;
    margin-bottom: 16px;
    color: #334155;
}

.definition-text p + p { margin-top: 5px; }

/* ─── ROLES GRID ──────────────────────────────────────────── */
.roles-container {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin: 12px 0 18px;
}

.role-item {
    border: 1px solid #e2e8f0;
    border-top: 3px solid #b02a37;
    padding: 12px;
    background: #f8fafc;
    border-radius: 2px;
}

.role-title {
    font-family: 'Roboto Condensed', sans-serif;
    font-weight: 700;
    font-size: 9.5pt;
    color: #b02a37;
    margin-bottom: 6px;
    text-transform: uppercase;
}

.role-desc { font-size: 7.5pt; color: #475569; line-height: 1.5; }

/* ─── CHECKLISTS ──────────────────────────────────────────── */
.checklist-container {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin: 12px 0;
}

.checklist-column {
    border: 1px solid #e2e8f0;
    background: white;
    border-radius: 2px;
    overflow: hidden;
}

.checklist-header {
    background: #f1f5f9;
    padding: 7px 10px;
    font-family: 'Roboto Condensed', sans-serif;
    font-weight: 700;
    font-size: 9pt;
    text-transform: uppercase;
    letter-spacing: .3px;
    border-bottom: 1px solid #e2e8f0;
    color: #334155;
}

.checklist-items { padding: 8px 10px; }

.checklist-item {
    display: flex;
    gap: 7px;
    margin-bottom: 6px;
    font-size: 8pt;
    line-height: 1.35;
    color: #334155;
    align-items: flex-start;
}

.checklist-item input[type="checkbox"] {
    width: 13px;
    height: 13px;
    margin-top: 1px;
    flex-shrink: 0;
    accent-color: #000;
}

/* ─── GLOBAL CUSTOM RADIO BUTTONS ────────────────────────────
   Screen:      black border, white fill → checked: solid black circle
   Print/PDF:   solid black circle enforced via print-color-adjust
   html2canvas: JS swaps inputs for <span> markers before capture
─────────────────────────────────────────────────────────── */
input[type="radio"] {
    -webkit-appearance: none;
    appearance: none;
    width: 14px;
    height: 14px;
    border: 2px solid #000;
    border-radius: 50%;
    background: #fff;
    cursor: pointer;
    vertical-align: middle;
    margin: 0;
    flex-shrink: 0;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
}

input[type="radio"]:checked {
    background: #000;
    border-color: #000;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
}

@media print {
    input[type="radio"] {
        -webkit-appearance: none !important;
        appearance: none !important;
        width: 14px !important;
        height: 14px !important;
        border: 2px solid #000 !important;
        border-radius: 50% !important;
        background: #fff !important;
        display: inline-block !important;
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
        color-adjust: exact !important;
    }
    input[type="radio"]:checked {
        background: #000 !important;
        border-color: #000 !important;
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
        color-adjust: exact !important;
    }
}

.checklist-item label { flex: 1; cursor: pointer; }
.checklist-item.indent { margin-left: 18px; }

/* ─── INSPECTION TABLES (Lanyard form) ───────────────────── */
.inspection-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 0;
    font-size: 8.5pt;
}

.inspection-table th {
    background: #f1f5f9;
    border: 1px solid #cbd5e1;
    padding: 6px 8px;
    font-family: 'Roboto Condensed', sans-serif;
    font-weight: 700;
    font-size: 8pt;
    text-align: left;
    text-transform: uppercase;
    letter-spacing: .3px;
    color: #334155;
}

.inspection-table th.center { text-align: center; min-width: 44px; }

.inspection-table td {
    border: 1px solid #e2e8f0;
    padding: 4px 7px;
    vertical-align: middle;
}

.inspection-table td.center { text-align: center; }
.inspection-table tr:nth-child(even) td { background: #fafbfc; }

/* .radio-cell radios inherit global style above; just enforce size */
.radio-cell input[type="radio"] {
    width: 14px;
    height: 14px;
}

/* ─── COMMENTS BOX ────────────────────────────────────────── */
.comments-box {
    border: 1px solid #e2e8f0;
    border-top: none;
    padding: 8px 10px;
    background: #fafbfc;
    margin-bottom: 14px;
}

.comments-box label {
    font-size: 7pt;
    font-weight: 700;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: .4px;
    display: block;
    margin-bottom: 4px;
}

.comments-box textarea {
    width: 100%;
    border: 1px solid #e2e8f0;
    background: white;
    padding: 6px 8px;
    font-size: 8.5pt;
    font-family: inherit;
    resize: vertical;
    border-radius: 2px;
    outline: none;
    transition: border-color 150ms;
}

.comments-box textarea:focus { border-color: #94a3b8; }

/* ─── PERSONNEL CARDS ─────────────────────────────────────── */
.personnel-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 14px;
    margin: 14px 0;
}

.personnel-card {
    border: 1px solid #e2e8f0;
    padding: 12px 14px;
    border-radius: 2px;
    background: #f8fafc;
}

.personnel-card h4 {
    font-family: 'Roboto Condensed', sans-serif;
    font-size: 9.5pt;
    font-weight: 700;
    text-transform: uppercase;
    color: #334155;
    margin-bottom: 10px;
    padding-bottom: 5px;
    border-bottom: 1px solid #e2e8f0;
}

.personnel-field { margin-bottom: 10px; }

.personnel-field label {
    display: block;
    font-size: 6.8pt;
    font-weight: 700;
    text-transform: uppercase;
    color: #94a3b8;
    letter-spacing: .4px;
    margin-bottom: 3px;
}

.personnel-field input,
.personnel-field select {
    width: 100%;
    border: 1px solid #e2e8f0;
    padding: 5px 7px;
    font-size: 8.5pt;
    border-radius: 2px;
    font-family: inherit;
    background: white;
    color: #111;
    outline: none;
    transition: border-color 150ms;
}

.personnel-field input:focus,
.personnel-field select:focus { border-color: #94a3b8; }

/* ─── SIGNATURE BOX ───────────────────────────────────────── */
.signature-box {
    border: 1px solid #e2e8f0;
    min-height: 40px;
    padding: 5px;
    background: white;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 2px;
}

.signature-img { max-height: 32px; max-width: 100%; object-fit: contain; }

.no-signature {
    font-size: 7pt;
    color: #94a3b8;
    font-style: italic;
}

/* ─── AUTHORIZATION BOX ───────────────────────────────────── */
.authorization-box {
    border: 2px solid #334155;
    padding: 14px 16px;
    margin: 18px 0;
    background: #f8fafc;
    border-radius: 2px;
}

.authorization-text {
    font-size: 8.5pt;
    color: #334155;
    font-style: italic;
    margin-bottom: 14px;
    line-height: 1.55;
}

/* ─── TIME TABLE ──────────────────────────────────────────── */
.time-table {
    width: 100%;
    border-collapse: collapse;
    margin: 12px 0;
    font-size: 8.5pt;
}

.time-table th {
    background: #f1f5f9;
    border: 1px solid #cbd5e1;
    padding: 7px 8px;
    font-family: 'Roboto Condensed', sans-serif;
    font-weight: 700;
    font-size: 8pt;
    text-align: center;
    text-transform: uppercase;
    color: #334155;
}

.time-table td {
    border: 1px solid #e2e8f0;
    padding: 5px;
}

.time-table td:first-child {
    background: #f1f5f9;
    font-weight: 700;
    font-size: 8pt;
    text-transform: uppercase;
    color: #475569;
    text-align: center;
}

.time-table input {
    width: 100%;
    border: none;
    padding: 3px;
    font-size: 9pt;
    text-align: center;
    background: transparent;
    font-family: inherit;
    outline: none;
}

/* ─── EMPLOYEE CARDS ──────────────────────────────────────── */
.selected-employees {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    margin: 12px 0;
}

.selected-employee-card {
    border: 1px solid #e2e8f0;
    padding: 8px 10px;
    display: flex;
    align-items: center;
    gap: 10px;
    background: white;
    cursor: pointer;
    transition: all 150ms;
    border-radius: 2px;
}

.selected-employee-card:hover {
    background: #f8fafc;
    border-color: #94a3b8;
}

.employee-name {
    font-weight: 600;
    font-size: 8.5pt;
    min-width: 110px;
    color: #334155;
}

.employee-signature {
    flex: 1;
    border: 1px dashed #e2e8f0;
    padding: 4px;
    min-height: 33px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f8fafc;
    border-radius: 2px;
}

.remove-employee {
    color: #dc2626;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 11pt;
    line-height: 1;
    padding: 2px;
    opacity: .6;
    transition: opacity 150ms;
}

.remove-employee:hover { opacity: 1; }

/* ─── VALID STAMP ─────────────────────────────────────────── */
.valid-stamp {
    text-align: center;
    font-family: 'Roboto Condensed', sans-serif;
    font-weight: 700;
    font-size: 12pt;
    border: 2px solid #b02a37;
    color: #b02a37;
    padding: 7px 12px;
    margin: 16px 0;
    letter-spacing: 1.5px;
    text-transform: uppercase;
}

/* ─── FOOTER ACTIONS ──────────────────────────────────────── */
.footer-actions {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin: 16px 0;
}

.footer-action {
    border: 1px solid #e2e8f0;
    padding: 10px 12px;
    background: #f8fafc;
    border-radius: 2px;
}

.footer-action strong {
    display: block;
    color: #b02a37;
    font-size: 8pt;
    text-transform: uppercase;
    font-weight: 700;
    margin-bottom: 4px;
    letter-spacing: .3px;
}

.footer-action p { font-size: 7.5pt; color: #475569; line-height: 1.45; }

/* ─── OUTCOME BOX (Lanyard) ───────────────────────────────── */
.outcome-box {
    border: 2px solid #334155;
    padding: 16px;
    margin: 20px 0;
    background: #f8fafc;
    border-radius: 2px;
}

.outcome-selector {
    display: flex;
    gap: 32px;
    margin-bottom: 16px;
    justify-content: center;
}

.outcome-radio {
    display: flex;
    align-items: center;
    gap: 8px;
    font-family: 'Roboto Condensed', sans-serif;
    font-size: 14pt;
    font-weight: 700;
    cursor: pointer;
    transition: opacity 150ms;
    text-transform: uppercase;
}

.outcome-radio input[type="radio"] { width: 18px; height: 18px; border-width: 2.5px; }
.outcome-pass { color: #16a34a; }
.outcome-fail { color: #dc2626; }

/* ─── ACTION BAR ──────────────────────────────────────────── */
.action-bar {
    position: fixed;
    bottom: 0; left: 0;
    width: 100%;
    background: #0f172a;
    padding: 12px 24px;
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 10px;
    border-top: 1px solid rgba(255,255,255,.06);
    z-index: 1000;
    box-shadow: 0 -8px 24px rgba(0,0,0,.3);
}

/* ─── APP FOOTER ──────────────────────────────────────────── */
.app-footer {
    background: #111;
    color: rgba(255,255,255,.35);
    padding: 9px 16px;
    text-align: center;
    font-size: 7.5pt;
    letter-spacing: .6px;
    text-transform: uppercase;
}

/* ─── ALERT STRIP ─────────────────────────────────────────── */
.alert-strip {
    background: linear-gradient(135deg, #fffbeb, #fef3c7);
    border-left: 4px solid #d97706;
    padding: 7px 12px;
    margin: 10px 0;
    font-size: 8pt;
    color: #78350f;
    display: flex;
    gap: 6px;
    align-items: flex-start;
    line-height: 1.5;
}

/* ─── SELECT2 OVERRIDE ────────────────────────────────────── */
.select2-container--default .select2-selection--single,
.select2-container--default .select2-selection--multiple {
    border: 1px solid #e2e8f0 !important;
    border-radius: 2px !important;
    min-height: 32px !important;
    font-size: 8.5pt !important;
    background: white !important;
    font-family: 'Inter', sans-serif !important;
}

.select2-container--default .select2-selection--single .select2-selection__rendered {
    line-height: 30px !important;
    padding-left: 8px !important;
    font-size: 8.5pt !important;
}

.select2-container--default .select2-results__option--highlighted {
    background-color: #b02a37 !important;
}

/* ─── RESPONSIVE ──────────────────────────────────────────── */
@media (max-width: 900px) {
    .roles-container,
    .checklist-container,
    .personnel-grid,
    .footer-actions { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 640px) {
    .letterhead { flex-direction: column; align-items: center; }
    .title-section { text-align: center; }
    .roles-container,
    .checklist-container,
    .personnel-grid,
    .footer-actions { grid-template-columns: 1fr; }
    .selected-employees { grid-template-columns: 1fr; }
}
