/* assets/css/forms.css - Centralized form stylesheet for Canwide Steel Document Portal */

/* ── PRINT ─────────────────────────────────────────── */
@media print {
    @page {
        size: A4;
        margin: 1.2cm 1cm;
    }
    body {
        background: white !important;
        padding: 0 !important;
        margin: 0 !important;
    }
    .app-container {
        max-width: 100% !important;
        box-shadow: none !important;
        border-radius: 0 !important;
        background: white !important;
    }
    .print-hide, .action-bar, .share-buttons, .remove-employee, .select-all-btn, 
    .select2-container, #employeeMultiSelect + .select2, .pai-select + .select2, 
    .fw-select + .select2, .hwo-select + .select2 {
        display: none !important;
    }
    .section, .checklist-block, .checklist-group, .selected-employee-card {
        break-inside: avoid;
        page-break-inside: avoid;
    }
    ::placeholder { color: transparent !important; }
    .no-signature { display: none !important; }
    
    /* Hot Work Specific Overrides */
    .selected-employee-card, .signature-display {
        border: 1px solid #ccc !important;
        background: white !important;
    }
    .signature-display {
        border-color: #333 !important;
    }
}

/* ── RESET & VARS ───────────────────────────────────── */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --black:          #000000;
    --white:          #ffffff;
    --light-gray:     #f8f9fa;
    --mid-gray:       #dee2e6;
    --dark-gray:      #495057;
    --border:         #adb5bd;
    --accent:         #b02a37;
    --success-green:  #198754;
    
    /* Hot Work variable aliases for backward compatibility */
    --primary-black:  var(--black);
    --primary-white:  var(--white);
    --border-color:   var(--border);
    --accent-red:     var(--accent);
    
    --font:           'Roboto', 'Helvetica', Arial, sans-serif;
    --font-cond:      'Roboto Condensed', 'Arial Narrow', Arial, sans-serif;
    --font-primary:   var(--font);
    --font-condensed: var(--font-cond);
}

body {
    background: #e9ecef;
    font-family: var(--font);
    display: flex;
    justify-content: center;
    padding: 20px;
    color: #000;
    font-size: 11pt; /* Middle ground for font-size */
    line-height: 1.4;
}

.app-container {
    max-width: 1200px;
    width: 100%;
    background: white;
    box-shadow: 0 10px 30px rgba(0,0,0,.15);
}

/* ── PAGE CONTENT ───────────────────────────────────── */
.page-content {
    padding: 0.5in 0.35in;
}

/* ── LETTERHEAD ─────────────────────────────────────── */
.letterhead {
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 3px solid #000;
    padding-bottom: 14px;
    margin-bottom: 14px;
}
.logo-section {
    width: 250px;
}
.logo-section img {
    max-width: 100%;
    height: auto;
}
.title-section {
    text-align: right;
}
.title-main {
    font-family: var(--font-cond);
    font-size: 24pt;
    font-weight: 900;
    letter-spacing: -.5px;
    color: #000;
    text-transform: uppercase;
    line-height: 1.2;
}
.title-sub {
    font-size: 11pt;
    font-weight: 500;
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: 1px;
}
.form-info {
    font-size: 9pt;
    color: #6c757d;
    margin-top: 5px;
}

/* ── SECTION HEADERS ────────────────────────────────── */
.section-header {
    background: #f8f9fa;
    border-left: 6px solid var(--accent);
    padding: 8px 12px;
    margin: 22px 0 14px 0;
    font-family: var(--font-cond);
    font-weight: 700;
    font-size: 14pt;
    text-transform: uppercase;
    border-bottom: 1px solid #dee2e6;
}

/* ── SHARED FORM FIELDS ──────────────────────────────── */
.form-row { display: flex; flex-wrap: wrap; margin: 0 -5px 10px -5px; }
.form-col { flex: 1; padding: 0 5px; min-width: 180px; }
.form-field { margin-bottom: 12px; border-bottom: 1px solid #000; }
.form-field label {
    display: block;
    font-size: 7pt;
    font-weight: 700;
    text-transform: uppercase;
    color: #6c757d;
    letter-spacing: .3px;
    margin-bottom: 2px;
}
.form-field input,
.form-field select,
.form-field textarea {
    width: 100%;
    border: none;
    border-bottom: 1px dashed #adb5bd;
    padding: 5px 0;
    font-size: 10pt;
    font-family: inherit;
    background: transparent;
}
.form-field input:focus,
.form-field select:focus,
.form-field textarea:focus {
    outline: none;
    border-bottom: 2px solid #000;
}

/* ── ACTION BAR & BUTTONS ────────────────────────────── */
.action-bar {
    padding: 16px 20px;
    background: #f8f9fa;
    border-top: 2px solid #dee2e6;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    flex-wrap: wrap;
    position: fixed; /* Common Hot Work functionality */
    bottom: 0;
    left: 0;
    width: 100%;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.1);
    z-index: 1000;
}
.btn, .btn-download, .btn-share {
    padding: 10px 20px;
    border: 2px solid #000;
    background: white;
    font-family: var(--font-cond);
    font-weight: 700;
    font-size: 10pt;
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: .5px;
    display: flex;
    align-items: center;
    gap: 7px;
    transition: background .15s, color .15s;
    border-radius: 5px; /* Added for general softness */
}
.btn:hover { background: #f8f9fa; }
.btn-black, .btn-download { background: #000; color: white; }
.btn-black:hover, .btn-download:hover { background: #333; }
.btn-red { background: var(--accent); color: white; border-color: var(--accent); }
.btn-red:hover { background: #8c1f29; }

/* ── FOOTER ──────────────────────────────────────────── */
.app-footer {
    background: #000;
    color: #fff;
    padding: 10px;
    text-align: center;
    font-size: 8pt;
    letter-spacing: .3px;
    margin-bottom: 60px; /* Space for fixed action bar */
}

/* ── RESPONSIVE BASE ─────────────────────────────────── */
@media screen and (max-width: 768px) {
    .page-content { padding: 15px; }
    .letterhead { flex-direction: column; text-align: center; }
    .title-section { text-align: center; margin-top: 10px; }
    .action-bar { justify-content: center; padding: 10px; }
}

/* --------------------------------------------------------
   INSPECTION LANYARD SPECIFIC MODULES
-------------------------------------------------------- */
.info-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0;
    border: 1px solid #000;
    margin-bottom: 18px;
}
.info-cell {
    padding: 6px 10px;
    border-right: 1px solid #000;
    border-bottom: 1px solid #000;
}
.info-cell:nth-child(2n) { border-right: none; }
.info-cell:nth-last-child(-n+2) { border-bottom: none; }
.info-cell label {
    display: block;
    font-size: 7pt;
    font-weight: 700;
    text-transform: uppercase;
    color: #6c757d;
    margin-bottom: 2px;
}
.info-cell input {
    width: 100%;
    border: none;
    border-bottom: 1px dashed #adb5bd;
    padding: 3px 0;
    font-size: 10pt;
    background: transparent;
    font-family: inherit;
}
.info-cell input:focus { outline: none; border-bottom: 2px solid #000; }

.inspection-layout { display: block; }
@media screen and (max-width: 900px) { .inspection-layout { grid-template-columns: 1fr; } }

.checklist-block { border: 1px solid #000; margin-bottom: 18px; }
.checklist-block-header { background: #000; color: #fff; padding: 7px 12px; font-family: var(--font-cond); font-weight: 700; font-size: 12pt; text-transform: uppercase; }
.checklist-block-body { padding: 10px 12px; }
.checklist-row { display: flex; align-items: flex-start; gap: 8px; padding: 5px 0; border-bottom: 1px solid #f0f0f0; font-size: 9pt; }
.checklist-row:last-child { border-bottom: none; }
.checklist-row label { flex: 1; font-weight: 600; line-height: 1.4; }

.check-options { display: flex; gap: 14px; flex-shrink: 0; }
.check-option { display: flex; align-items: center; gap: 4px; font-size: 8.5pt; white-space: nowrap; }
.check-option input[type="checkbox"], .check-option input[type="radio"] { width: 14px; height: 14px; accent-color: var(--accent); cursor: pointer; }

.comment-row { background: #f8f9fa; padding: 6px 10px; border-top: 1px solid #dee2e6; }
.comment-row label { font-size: 7.5pt; font-weight: 700; color: #6c757d; text-transform: uppercase; display: block; margin-bottom: 2px; }
.comment-row textarea { width: 100%; border: 1px dashed #adb5bd; background: white; padding: 4px; font-size: 9pt; font-family: inherit; resize: vertical; min-height: 36px; }

.outcome-bar { display: flex; align-items: stretch; border: 2px solid #000; margin-top: 22px; }
.outcome-label { background: #000; color: #fff; font-family: var(--font-cond); font-weight: 700; font-size: 13pt; text-transform: uppercase; padding: 10px 16px; display: flex; align-items: center; white-space: nowrap; }
.outcome-options { display: flex; align-items: center; gap: 30px; padding: 10px 20px; flex: 1; }
.outcome-opt { display: flex; align-items: center; gap: 8px; font-family: var(--font-cond); font-size: 13pt; font-weight: 700; cursor: pointer; }
.outcome-opt input[type="radio"] { width: 18px; height: 18px; accent-color: var(--accent); cursor: pointer; }
.outcome-opt.pass-opt { color: #198754; }
.outcome-opt.fail-opt { color: var(--accent); }

.sig-row { display: flex; align-items: stretch; border: 1px solid #000; border-top: none; margin-bottom: 20px; }
.sig-cell { flex: 1; padding: 8px 12px; border-right: 1px solid #000; }
.sig-cell:last-child { border-right: none; }
.sig-cell label { display: block; font-size: 7pt; font-weight: 700; text-transform: uppercase; color: #6c757d; margin-bottom: 4px; }
.sig-cell input { width: 100%; border: none; border-bottom: 1px dashed #adb5bd; padding: 4px 0; font-size: 10pt; font-family: inherit; background: transparent; }

@media screen and (max-width: 768px) {
    .info-grid { grid-template-columns: 1fr; }
    .info-cell:nth-child(n) { border-right: none; border-bottom: 1px solid #000; }
    .info-cell:last-child { border-bottom: none; }
    .checklist-row { flex-direction: column; gap: 4px; }
}


/* --------------------------------------------------------
   HOT WORK PERMIT SPECIFIC MODULES
-------------------------------------------------------- */
.warning-box {
    background: #fff3cd;
    border: 2px solid #856404;
    padding: 8px 12px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    font-family: var(--font-condensed);
    font-weight: 700;
    font-size: 16pt;
    color: #856404;
    text-transform: uppercase;
}
.warning-box i { color: #dc3545; font-size: 20pt; }

.form-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 20px;
    border-bottom: 2px solid #000;
    padding-bottom: 15px;
}
.doc-meta { display: flex; gap: 30px; font-weight: bold; }
.doc-meta span { font-size: 11pt; color: #b02a37; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 15px; margin-bottom: 15px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 15px; margin-bottom: 15px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 15px; }

.input-group { margin-bottom: 12px; }
.input-group label { display: block; font-weight: 700; font-size: 9pt; margin-bottom: 4px; text-transform: uppercase; color: #495057; }
.input-group input[type="text"], .input-group input[type="date"], .input-group input[type="time"] { width: 100%; border: none; border-bottom: 1px dashed #000; padding: 4px 0; font-size: 10pt; font-family: inherit; }
.input-group input:focus { outline: none; border-bottom: 2px solid #000; background: #f8f9fa; }

.checkbox-group { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.checkbox-group input[type="checkbox"] { width: 16px; height: 16px; accent-color: #000; }
.checkbox-group label { font-size: 10pt; cursor: pointer; text-transform: none; margin-bottom: 0; font-weight: 400; color: #000; }

.fw-section { border: 2px solid #b02a37; padding: 15px; margin-bottom: 20px; background: #fffafb; }
.fw-header { font-family: var(--font-condensed); font-weight: 700; font-size: 14pt; color: #b02a37; margin-bottom: 10px; text-transform: uppercase; display: flex; align-items: center; gap: 10px; }

.sig-box { border: 1px solid #000; padding: 10px; text-align: center; background: #f8f9fa; }
.sig-box .role { font-weight: bold; font-size: 9pt; text-transform: uppercase; margin-bottom: 15px; color: #b02a37; }
.sig-box .sig-line { border-bottom: 1px solid #000; height: 30px; margin-bottom: 5px; position: relative; }
.sig-box .name-line { font-size: 9pt; text-transform: uppercase; color: #6c757d; }

.personnel-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 15px; margin-bottom: 20px; }
.personnel-card { border: 1px solid #dee2e6; border-radius: 6px; padding: 15px; background: #f8f9fa; position: relative; }
.personnel-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 15px; padding-bottom: 10px; border-bottom: 1px solid #dee2e6; }
.personnel-name { font-weight: 700; font-size: 12pt; color: #b02a37; display: flex; align-items: center; gap: 8px; }
.personnel-role { background: #e9ecef; padding: 2px 8px; border-radius: 4px; font-size: 8pt; font-weight: bold; text-transform: uppercase; }

.signature-display { height: 60px; background: white; border: 1px dashed #adb5bd; border-radius: 4px; display: flex; justify-content: center; align-items: center; margin-bottom: 10px; overflow: hidden; }
.signature-display img { max-height: 100%; max-width: 100%; object-fit: contain; }
.no-signature { color: #dc3545; font-size: 9pt; font-style: italic; }

.time-inputs { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.time-inputs .input-group { margin-bottom: 0; }
.time-inputs label { font-size: 8pt; color: #6c757d; }

@media screen and (max-width: 768px) {
    .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; gap: 10px; }
    .form-header { flex-direction: column; gap: 10px; }
    .doc-meta { flex-direction: column; gap: 5px; }
}
