/**
 * Food Inspection Manager - Admin Styles
 * 
 * Styles for the Illinois IOCI 17-356 inspection form
 */

.fim-inspection-form {
    max-width: 1200px;
    margin: 20px auto;
    background: #fff;
    padding: 20px;
}

.fim-save-status {
    position: fixed;
    top: 32px;
    right: 20px;
    background: #fff;
    border: 1px solid #ddd;
    padding: 10px 15px;
    border-radius: 3px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    z-index: 9999;
}

.fim-save-status.success {
    border-color: #46b450;
    background: #ecf7ed;
}

.fim-save-status.error {
    border-color: #dc3232;
    background: #f8d7da;
}

.fim-save-status .spinner {
    float: left;
    margin: 0 5px 0 0;
}

/* Header Section */
.fim-form-section {
    margin-bottom: 30px;
    border: 1px solid #333;
    padding: 15px;
}

.fim-form-section h2 {
    margin: 0 0 10px 0;
    font-size: 18px;
    font-weight: bold;
    text-align: center;
    border-bottom: 2px solid #000;
    padding-bottom: 5px;
}

.fim-form-section h3 {
    margin: 15px 0 10px 0;
    font-size: 14px;
    font-weight: bold;
    text-transform: uppercase;
}

.fim-page-indicator {
    text-align: right;
    font-size: 11px;
    margin: 0;
}

/* Header Table */
.fim-header-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 15px;
}

.fim-header-table td {
    border: 1px solid #666;
    padding: 5px;
    vertical-align: top;
}

.fim-header-table label {
    display: block;
    font-size: 10px;
    font-weight: bold;
    margin-bottom: 3px;
    color: #333;
}

.fim-header-table input[type="text"],
.fim-header-table input[type="date"],
.fim-header-table input[type="time"],
.fim-header-table input[type="number"],
.fim-header-table select,
.fim-header-table textarea {
    width: 100%;
    padding: 4px;
    border: none;
    font-size: 12px;
    background: transparent;
}

.fim-header-table input[readonly] {
    background: #f5f5f5;
}

.fim-header-table select {
    background: #fff;
    border: 1px solid #ddd;
}

/* Section Notes */
.fim-section-note {
    font-size: 10px;
    line-height: 1.4;
    margin: 0 0 10px 0;
    padding: 8px;
    background: #f9f9f9;
    border-left: 3px solid #0073aa;
}

/* Violations Table */
.fim-violations-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 15px;
    font-size: 11px;
    table-layout: auto;
}

.fim-violations-table thead th {
    background: #1a1a2e;
    color: #fff;
    padding: 5px 3px;
    text-align: center;
    font-weight: bold;
    border: 1px solid #000;
    font-size: 10px;
    white-space: nowrap;
}

.fim-violations-table tbody td {
    border: 1px solid #bbb;
    padding: 4px 3px;
    vertical-align: middle;
}

.fim-violations-table .item-text {
    font-size: 10px;
    line-height: 1.3;
    vertical-align: top;
    padding: 4px 6px;
}

/* ── IOCI column layout for compliance status radio buttons ── */
.ioci-col-num  { width:28px; text-align:center; font-weight:700; background:#f0f0f0; font-size:11px; padding:3px 4px; }
.ioci-col-status { width:38px; text-align:center; padding:2px; white-space:nowrap; }
.ioci-col-cos  { width:32px; text-align:center; padding:2px; }
.ioci-col-r    { width:28px; text-align:center; padding:2px; }
.ioci-col-sep  { width:8px; background:#ccc; padding:0; }

.ioci-radio { display:none; }
.ioci-radio-lbl {
    display:inline-flex; align-items:center; justify-content:center;
    width:34px; height:22px; border-radius:11px; border:1.5px solid #999;
    font-size:10px; font-weight:700; cursor:pointer; color:#555;
    transition:all .15s; white-space:nowrap; user-select:none;
}
.ioci-radio-lbl:hover { border-color:#1258C2; color:#1258C2; background:#eef4ff; }
.ioci-radio-lbl.ioci-sel { background:#1258C2; color:#fff; border-color:#1258C2; }
.ioci-radio-lbl.ioci-out.ioci-sel { background:#dc2626; border-color:#dc2626; color:#fff; }

.fim-violations-table input[type="checkbox"] { margin:0; width:16px; height:16px; cursor:pointer; }
.fim-violations-table .fim-section-header {
    background:#1258C2; color:#fff; font-weight:700; padding:5px 8px;
    text-transform:uppercase; font-size:11px;
}
.fim-violations-table .fim-subsection-header {
    background:#374151; color:#fff; font-weight:700; padding:4px 8px; font-size:11px;
}
.fim-good-practices-table .grp-out-cb { width:16px; height:16px; cursor:pointer; }


/* Page Break for Printing */
.fim-page-break {
    page-break-before: always;
}

/* Details Table */
.fim-details-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 15px;
}

.fim-details-table td {
    border: 1px solid #999;
    padding: 8px;
}

.fim-details-table label {
    display: block;
    font-size: 11px;
    font-weight: bold;
    margin-bottom: 5px;
}

.fim-details-table input[type="text"],
.fim-details-table input[type="checkbox"] {
    margin-right: 5px;
}

/* Two Column Layout */
.fim-row {
    display: flex;
    gap: 20px;
    margin-bottom: 15px;
}

.fim-col-half {
    flex: 1;
}

/* Temperature Table */
.fim-temperature-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 10px;
}

.fim-temperature-table thead th {
    background: #333;
    color: #fff;
    padding: 8px;
    text-align: left;
    border: 1px solid #000;
}

.fim-temperature-table tbody td {
    border: 1px solid #999;
    padding: 4px;
}

.fim-temperature-table input[type="text"] {
    width: 100%;
    padding: 6px;
    border: 1px solid #ddd;
    font-size: 12px;
}

/* Observations Section */
.fim-observations-container {
    margin-bottom: 20px;
}

.fim-observations-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 10px;
}

.fim-observations-table thead th {
    background: #333;
    color: #fff;
    padding: 8px;
    text-align: left;
    border: 1px solid #000;
}

.fim-observations-table tbody td {
    border: 1px solid #999;
    padding: 4px;
    vertical-align: top;
}

.fim-observations-table input[type="number"] {
    width: 100%;
    padding: 6px;
    border: 1px solid #ddd;
    font-size: 12px;
}

.fim-observations-table textarea {
    width: 100%;
    padding: 6px;
    border: 1px solid #ddd;
    font-size: 12px;
    resize: vertical;
}

/* Signature Pads */
.fim-signatures-section {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin: 20px 0;
}

.fim-signature-block {
    border: 1px solid #ddd;
    padding: 15px;
    background: #f9f9f9;
}

.fim-signature-block label {
    display: block;
    font-weight: bold;
    margin: 10px 0 5px 0;
    font-size: 12px;
}

.fim-signature-block input[type="text"],
.fim-signature-block input[type="date"] {
    width: 100%;
    padding: 6px;
    border: 1px solid #ddd;
    font-size: 12px;
    margin-bottom: 10px;
}

.signature-pad-container {
    position: relative;
    margin: 10px 0;
}

.signature-pad {
    border: 2px solid #333;
    background: #fff;
    cursor: crosshair;
    display: block;
    width: 100%;
    height: 150px;
    touch-action: none;   /* prevents page scroll while signing on touch devices */
    box-sizing: border-box;
}

.signature-pad-container .clear-signature {
    position: absolute;
    top: 6px;
    right: 6px;
    background: rgba(255,255,255,.9);
    border: 1px solid #ccc;
    border-radius: 4px;
    padding: 3px 10px;
    font-size: 12px;
    cursor: pointer;
    color: #333;
    z-index: 2;
}
.signature-pad-container .clear-signature:hover {
    background: #fff;
    border-color: #999;
}

/* Fallback for non-absolute placement */
.clear-signature:not(.signature-pad-container .clear-signature) {
    margin-top: 5px;
}

/* Follow-up Section */
.fim-follow-up-section {
    border: 1px solid #ddd;
    padding: 15px;
    margin: 20px 0;
    background: #f9f9f9;
}

.fim-follow-up-section label {
    display: block;
    margin: 10px 0;
    font-weight: bold;
}

.fim-follow-up-section input[type="checkbox"] {
    margin-right: 8px;
}

.fim-follow-up-section input[type="date"] {
    width: 200px;
    padding: 6px;
    border: 1px solid #ddd;
}

/* Form Actions */
.fim-form-actions {
    margin-top: 30px;
    padding: 20px;
    background: #f5f5f5;
    border-top: 3px solid #0073aa;
    text-align: center;
}

.fim-form-actions .button {
    margin: 0 10px;
}

/* Responsive Design */
@media screen and (max-width: 782px) {
    .fim-violations-table {
        font-size: 10px;
    }
    
    .fim-signatures-section {
        grid-template-columns: 1fr;
    }
    
    .fim-row {
        flex-direction: column;
    }
}

/* Print Styles */
@media print {
    .fim-form-actions,
    .fim-save-status,
    .clear-signature,
    #add-temp-row,
    #add-observation-row,
    .wp-heading-inline,
    .page-title-action,
    .wp-header-end {
        display: none !important;
    }
    
    .fim-form-section {
        page-break-inside: avoid;
    }
    
    .fim-page-break {
        page-break-before: always;
    }
    
    .signature-pad {
        border: 1px solid #000;
    }
}

/* ----- SIGNATURE BLOCKS: PAGE 2 & 3 ----- */

.fim-signature-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 12px;
}

.fim-signature-table td {
    padding: 6px 8px;
    vertical-align: bottom;
}

/* Signature & date boxes (the big lines) */
.fim-signature-box,
.fim-signature-date-box,
.fim-followup-cell {
    height: 60px;           /* height of the box area */
}

/* Draw the actual line/box for signatures & follow-up date */
.fim-signature-placeholder,
.fim-followup-date-placeholder {
    width: 100%;
    height: 24px;
    border-bottom: 1px solid #000;   /* looks like the paper line */
    box-sizing: border-box;
    margin-top: 8px;
}

/* Small label text under each line */
.fim-signature-label-row .fim-signature-label {
    font-size: 12px;
    padding-top: 2px;
}

/* Layout for “Follow-up: Yes  No  (Check one)  Follow-up Date:” */
.fim-follow-up-inline,
.fim-follow-up-inline-page3 {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px;
    font-size: 13px;
}

/* Empty Yes/No boxes on PAGE 3 (read-only view) */
.fim-follow-empty-box {
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 1px solid #000;
    margin: 0 2px;
}

/* Keep the little ‘Yes’ / ‘No’ labels snug next to boxes */
.fim-follow-yes-text,
.fim-follow-no-text,
.fim-follow-check-one,
.fim-follow-date-label {
    margin-left: 2px;
}
/* ── Per-item violation notes (inline under item text) ── */
.ioci-notes {
    display:block;
    width:100%;
    margin-top:4px;
    font-size:11px;
    border:1px solid #fbbf24;
    border-radius:3px;
    padding:3px 5px;
    resize:vertical;
    background:#fffbeb;
    font-family:inherit;
    box-sizing:border-box;
}
.ioci-notes:focus { outline:none; border-color:#d97706; background:#fff; }
