/**
 * PDF Forms Styling
 * Makes form builder and daily capture forms look like the original PDFs
 */

/* ========================================
   GENERAL PDF FORM STYLING
======================================== */

.form-preview-pdf,
.pdf-form-render {
    background: #ffffff !important;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* ========================================
   PDF HEADER BAR (Blue header)
======================================== */

.pdf-header-bar {
    background: #1d4ed8 !important; /* Blue similar to PDFs */
    color: white !important;
    padding: 16px 24px;
    margin-bottom: 20px;
    text-align: center;
    border-radius: 4px;
}

.pdf-header-bar h5 {
    font-size: 16px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin: 0;
}

/* ========================================
   PDF HEADER FIELDS (Project, Date, etc.)
======================================== */

.pdf-header-fields {
    background: #f8f9fa;
    padding: 12px;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    margin-bottom: 20px;
}

.pdf-header-fields label {
    font-size: 11px;
    font-weight: 600;
    color: #495057;
    margin-bottom: 4px;
}

.pdf-header-fields input {
    font-size: 13px;
    background: white;
}

/* ========================================
   PDF SECTION HEADERS
======================================== */

.pdf-section-header {
    background: #e9ecef !important;
    border-left: 4px solid #1d4ed8 !important;
    padding: 10px 16px;
    margin: 20px 0 16px 0;
}

.pdf-section-header h5 {
    color: #1d4ed8;
    font-size: 14px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    margin: 0;
}

/* ========================================
   PDF CHECKLIST TABLES
======================================== */

.pdf-table-container {
    margin-bottom: 20px;
}

.pdf-checklist-table {
    font-size: 12px;
    border: 2px solid #000 !important;
}

.pdf-checklist-table thead {
    background: #e9ecef !important;
}

.pdf-checklist-table thead th {
    font-weight: 700;
    font-size: 11px;
    text-transform: uppercase;
    border: 1px solid #000 !important;
    padding: 8px 12px;
    color: #000;
}

.pdf-checklist-table tbody td {
    border: 1px solid #000 !important;
    padding: 8px 12px;
    vertical-align: middle;
}

.pdf-checklist-table tbody tr:nth-child(even) {
    background: #f8f9fa;
}

/* Larger checkboxes for PDF-like appearance */
.pdf-checklist-table .form-check-input {
    width: 18px !important;
    height: 18px !important;
    margin: 0 auto;
    border: 2px solid #000 !important;
    cursor: pointer;
}

.pdf-checklist-table .form-check-input:checked {
    background-color: #1d4ed8;
    border-color: #1d4ed8 !important;
}

/* Notes column styling */
.pdf-checklist-table input[type="text"],
.pdf-checklist-table .notes-input {
    border: 1px solid #dee2e6;
    background: #fff;
    font-size: 12px;
    padding: 6px 10px;
    width: 100%;
    min-width: 120px;
    border-radius: 3px;
    transition: all 0.2s ease;
    font-family: Arial, sans-serif;
    color: #212529;
    /* Ensure text is selectable and copyable */
    user-select: text;
    -webkit-user-select: text;
    -moz-user-select: text;
    -ms-user-select: text;
}

.pdf-checklist-table input[type="text"]:hover,
.pdf-checklist-table .notes-input:hover {
    border-color: #adb5bd;
    background: #f8f9fa;
}

.pdf-checklist-table input[type="text"]:focus,
.pdf-checklist-table .notes-input:focus {
    outline: none;
    background: #fff;
    border: 2px solid #1d4ed8;
    box-shadow: 0 0 0 0.2rem rgba(29, 78, 216, 0.15);
    padding: 5px 9px; /* Adjust for thicker border */
}

.pdf-checklist-table input[type="text"]::placeholder,
.pdf-checklist-table .notes-input::placeholder {
    color: #adb5bd;
    font-style: italic;
    font-size: 11px;
}

/* Ensure notes input is fully functional */
.pdf-checklist-table .notes-input:disabled {
    background: #e9ecef;
    cursor: not-allowed;
    opacity: 0.6;
}

/* ========================================
   CREW LIST (Numbered inputs)
======================================== */

.pdf-crew-list .badge {
    font-size: 11px;
    padding: 4px 8px;
    min-width: 30px;
}

.pdf-crew-list input {
    font-size: 12px;
}

/* ========================================
   FORM FIELDS
======================================== */

.pdf-form-render label,
.form-preview-pdf label {
    font-size: 12px;
    font-weight: 600;
    color: #212529;
    margin-bottom: 4px;
}

/* Label groups for checkboxes/radios */
.pdf-form-render .form-check + .form-check,
.form-preview-pdf .form-check + .form-check {
    margin-top: 0;
}

.pdf-form-render input[type="text"],
.pdf-form-render input[type="date"],
.pdf-form-render textarea,
.pdf-form-render select {
    font-size: 13px;
    border: 1px solid #ced4da;
}

.pdf-form-render input[type="text"]:focus,
.pdf-form-render input[type="date"]:focus,
.pdf-form-render textarea:focus,
.pdf-form-render select:focus {
    border-color: #1d4ed8;
    box-shadow: 0 0 0 0.2rem rgba(29, 78, 216, 0.15);
}

/* ========================================
   FIELD ITEM (in Form Builder)
======================================== */

.field-item {
    position: relative;
    background: #fff !important;
    border: 2px solid #e5e7eb !important;
    border-radius: 6px;
    transition: all 0.2s ease;
}

.field-item:hover {
    border-color: #1d4ed8 !important;
    box-shadow: 0 2px 6px rgba(29, 78, 216, 0.15);
}

.field-item .field-controls {
    opacity: 0.7;
    transition: opacity 0.2s ease;
}

.field-item:hover .field-controls {
    opacity: 1;
}

/* ========================================
   SIGNATURE AREAS
======================================== */

.pdf-form-render canvas[id^="signature_"],
.form-preview-pdf canvas {
    border: 2px solid #dee2e6 !important;
    border-radius: 4px;
    background: #ffffff;
    cursor: crosshair;
    display: block;
    width: 100%;
    max-width: 500px;
}

/* ========================================
   PRINT STYLES
======================================== */

@media print {
    .pdf-form-render,
    .form-preview-pdf {
        box-shadow: none;
        border: none;
        max-width: 100%;
    }

    .field-controls,
    .btn,
    .modal-footer {
        display: none !important;
    }

    .pdf-checklist-table {
        page-break-inside: avoid;
    }

    .pdf-section-header {
        page-break-after: avoid;
    }
}

/* ========================================
   RESPONSIVE ADJUSTMENTS
======================================== */

@media (max-width: 768px) {
    .pdf-header-bar h5 {
        font-size: 14px;
    }

    .pdf-checklist-table {
        font-size: 11px;
    }

    .pdf-checklist-table thead th,
    .pdf-checklist-table tbody td {
        padding: 6px 8px;
    }

    .form-preview-pdf,
    .pdf-form-render {
        padding: 16px !important;
    }
}

/* ========================================
   RADIO/CHECKBOX GROUPS
======================================== */

.pdf-form-render .form-check,
.form-preview-pdf .form-check {
    padding: 10px 12px;
    margin-bottom: 8px;
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.pdf-form-render .form-check:hover,
.form-preview-pdf .form-check:hover {
    background: #fff;
    border-color: #1d4ed8;
}

.pdf-form-render .form-check-input,
.form-preview-pdf .form-check-input {
    width: 18px;
    height: 18px;
    margin-top: 2px;
    margin-right: 10px;
    border: 2px solid #6c757d;
    cursor: pointer;
}

.pdf-form-render .form-check-input:checked,
.form-preview-pdf .form-check-input:checked {
    background-color: #1d4ed8;
    border-color: #1d4ed8;
}

.pdf-form-render .form-check-label {
    font-size: 13px;
    font-weight: 500;
    color: #212529;
    line-height: 1.5;
    cursor: pointer;
    user-select: none;
}

/* Single checkbox styling (when not in a group) */
.pdf-form-render .mb-3 > .form-check,
.form-preview-pdf .mb-3 > .form-check {
    display: flex;
    align-items: center;
    padding: 12px 14px;
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 4px;
}

/* Radio button groups - container with label */
.pdf-form-render > div > label.form-label.fw-bold,
.form-preview-pdf > div > label.form-label.fw-bold {
    display: block;
    margin-bottom: 12px;
}

/* Radio button groups spacing */
.pdf-form-render .mb-3 > label.form-label + .form-check:first-of-type,
.form-preview-pdf .mb-3 > label.form-label + .form-check:first-of-type {
    margin-top: 0;
}

/* Radio/Checkbox groups container */
.pdf-form-render .mb-3:has(.form-check),
.form-preview-pdf .mb-3:has(.form-check) {
    background: transparent;
    padding: 0;
}

/* ========================================
   TEXTAREA STYLING
======================================== */

.pdf-form-render textarea {
    min-height: 80px;
    resize: vertical;
    font-family: Arial, sans-serif;
    line-height: 1.5;
}

/* ========================================
   REQUIRED FIELD INDICATOR
======================================== */

.text-danger {
    color: #dc3545 !important;
}

/* ========================================
   FORM CANVAS BACKGROUND
======================================== */

#form-canvas {
    background: #f3f4f6 !important;
    padding: 20px;
    border-radius: 6px;
}
