/* RDI Press Inspection Form Styles */

body {
    font-family: Arial, sans-serif;
    background-color: #ffffff;
    margin: 0;
    padding: 20px;
    color: #000000;
}

h1, h2, h3 {
    text-align: center;
    color: #003366;
    margin-bottom: 10px;
}

form {
    max-width: 1000px;
    margin: 0 auto;
    padding: 20px;
    border: 2px solid #003366;
    background-color: #f9f9f9;
}

fieldset {
    border: 1px solid #003366;
    padding: 15px;
    margin-bottom: 20px;
}

legend {
    font-weight: bold;
    color: #003366;
    padding: 0 10px;
}

label {
    display: block;
    margin-top: 10px;
    font-weight: bold;
}

input[type="text"],
input[type="number"],
input[type="date"],
select,
textarea {
    width: 100%;
    padding: 8px;
    margin-top: 5px;
    margin-bottom: 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
    box-sizing: border-box;
}

textarea {
    height: 80px;
}

/* New: Flex layout for side-by-side inputs */
.flex-row {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
}

.input-block {
    flex: 1 1 200px; /* min width 200px, grow as needed */
    display: flex;
    flex-direction: column;
}

/* For inputs with checkboxes beside them */
.input-with-checkboxes {
    display: flex;
    align-items: center;
    gap: 15px;
}

.input-with-checkboxes input[type="text"] {
    flex: 1; /* text field fills available space */
}

.input-with-checkboxes label {
    font-weight: normal; /* checkbox labels lighter */
    margin: 0;
}

table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 10px;
    margin-bottom: 20px;
}

table th, table td {
    border: 1px solid #003366;
    padding: 8px;
    text-align: left;
}

table th {
    background-color: #e6f0ff;
    color: #003366;
}

button {
    background-color: #003366;
    color: white;
    padding: 10px 20px;
    border: none;
    margin: 10px 5px;
    cursor: pointer;
    border-radius: 4px;
}

button:hover {
    background-color: #0055aa;
}

.nav-buttons {
    text-align: center;
}

/* --- Navigation Tabs --- */
.nav-tabs {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 20px;
    margin-bottom: 10px;
}

.nav-tabs a {
    text-decoration: none;
    color: #003366;
    background-color: #e6f0ff;
    border: 1px solid #003366;
    border-radius: 5px 5px 0 0;
    padding: 8px 16px;
    font-weight: bold;
    transition: all 0.2s ease;
}

.nav-tabs a:hover {
    background-color: #0055aa;
    color: #ffffff;
}

.nav-tabs a.active {
    background-color: #003366;
    color: #ffffff;
    border-bottom: 2px solid #f9f9f9;
}

.center-image {
    text-align: center;
}

.center-image img {
    width: 75%;
    height: auto;
}

/* Responsive adjustments for screens smaller than 768px */
@media (max-width: 768px) {
    body {
        padding: 10px;
        font-size: 14px;
    }

    h1, h2, h3 {
        font-size: 1.2em;
    }

    form {
        padding: 10px;
    }

    .label-input {
        width: 100px;
        font-size: 10px;
    }

    .label-input label {
        font-size: 12px;
    }

    .label-input input {
        font-size: 12px;
    }

    .flex-row {
        flex-direction: column;
        gap: 10px;
    }

    .input-block {
        flex: 1 1 100%;
    }

    .input-with-checkboxes {
        flex-direction: column;
        align-items: flex-start;
    }

    .nav-tabs {
        flex-direction: column;
        align-items: stretch;
    }

    .nav-tabs a {
        width: 90%;
        text-align: center;
    }

    /* Prevent overflow by adjusting negative left/right values */
    .left_front_top_gib_front,
    .left_front_bottom_gib_front,
    .right_front_top_gib_front,
    .right_front_bottom_gib_front,
    .left_back_top_gib_front,
    .left_back_bottom_gib_front,
    .right_back_top_gib_front,
    .right_back_bottom_gib_front {
        left: 0 !important;
        right: 0 !important;
    }
}

/* ============================================
   PRINT STYLES FOR PDF GENERATION
   ============================================ */
@media print {
    /* Remove margins and padding for full-page printing */
    body {
        margin: 0;
        padding: 5px;
        background-color: white;
        font-size: 11px; /* Smaller font for PDF */
    }

    /* Make headers more compact */
    h1, h2, h3 {
        margin: 8px 0;
        font-size: 14px;
    }

    h2 {
        font-size: 13px;
    }

    /* Hide navigation tabs in print */
    .nav-tabs {
        display: none !important;
    }

    /* Hide any buttons in print */
    button {
        display: none !important;
    }

    /* Remove form border for cleaner print */
    form {
        border: none;
        padding: 5px;
        background-color: white;
        max-width: 100%;
        margin: 0;
    }

    /* More compact fieldsets */
    fieldset {
        border: 1px solid #003366;
        padding: 8px;
        margin-bottom: 10px;
        page-break-inside: avoid;
        break-inside: avoid;
    }

    /* Compact legend */
    legend {
        font-size: 12px;
        padding: 0 5px;
    }

    /* Compact labels */
    label {
        margin-top: 3px;
        margin-bottom: 2px;
        font-size: 11px;
    }

    /* Ensure headers are visible */
    header {
        page-break-after: avoid;
        break-after: avoid;
        margin-bottom: 10px;
        font-size: 11px;
    }

    /* Prevent flex-row containers from breaking */
    .flex-row {
        page-break-inside: avoid;
        break-inside: avoid;
        gap: 10px;
        margin-bottom: 5px;
    }

    /* Prevent input blocks from breaking */
    .input-block {
        page-break-inside: avoid;
        break-inside: avoid;
        margin-bottom: 5px;
    }

    /* Force page breaks between major sections */
    .page-break {
        page-break-before: always;
    }

    /* Avoid breaking tables across pages */
    table {
        page-break-inside: avoid;
        font-size: 10px;
    }

    /* Print background colors for table headers */
    table th {
        background-color: #e6f0ff !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
        padding: 5px;
    }

    table td {
        padding: 5px;
    }

    /* More compact inputs in print */
    input[type="text"],
    input[type="number"],
    input[type="date"],
    select,
    textarea {
        border: 1px solid #666;
        background-color: white;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
        padding: 4px;
        margin: 2px 0;
        font-size: 11px;
    }

    /* Show checkbox states */
    input[type="checkbox"],
    input[type="radio"] {
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    /* Ensure images print properly */
    img {
        max-width: 100%;
        page-break-inside: avoid;
    }

    /* Canvas elements (drawings) should print */
    canvas {
        page-break-inside: avoid;
        max-width: 100%;
    }

    /* Ensure colors print */
    h1, h2, h3, legend {
        color: #003366 !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    /* Reduce header image sizes slightly */
    header img {
        height: 50px !important;
    }

    /* More compact input-with-checkboxes */
    .input-with-checkboxes {
        gap: 8px;
        margin-bottom: 3px;
    }

    /* Page margins for PDF */
    @page {
        margin: 0.4in;
        size: letter;
    }
}