/* Form document styling to mimic A4 paper */
body {
    background-color: #f0f2f5;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

.a4-container {
    max-width: 210mm; /* A4 width */
    margin: 0 auto;
    background: #fff;
    box-shadow: 0 0 10px rgba(0,0,0,0.1);
}

.a4-page {
    /* A4 dimensions: 210mm x 297mm */
    /* We don't set a hard height to allow the content to flow naturally, 
       but we ensure the width matches A4 for the PDF generation. */
    width: 100%;
    min-height: 297mm;
    /*padding: 0 !important;*/
    box-sizing: border-box;
    position: relative;
    color: #333;
}

/* Specific styling to look like a legal document */
.fs-7 {
    font-size: 0.85rem;
}

.border-dark {
    border-color: #333 !important;
}

input.border-dark, textarea.border-dark, select.border-dark {
    border-width: 1px;
    border-radius: 0;
}

input.border-dark:focus, textarea.border-dark:focus {
    box-shadow: none;
    border-color: #000 !important;
    outline: 1px solid #000;
}

/* Adjustments for printing/PDF generation */
@media print {
    body {
        background-color: #fff;
    }
    .a4-container {
        box-shadow: none;
        max-width: none;
    }
    .a4-page {
        padding: 0 !important;
        min-height: auto;
    }
    .html2pdf__exclude {
        display: none !important;
    }
}

/* Fix for PDF Generation Alignment & Input Rendering */
.pdf-mode {
    width: 794px !important; /* Exact A4 width at 96 DPI */
    max-width: 794px !important;
    box-shadow: none !important;
    margin: 0 !important;
    padding: 0 !important;
    box-sizing: border-box !important;
}

.pdf-mode .a4-page {
    width: 794px !important;
    padding: 50px !important; /* Solid pixel padding instead of relative mm */
    min-height: auto !important;
    box-sizing: border-box !important;
}

/* Ensure form controls are perfectly solid for html2canvas */
.pdf-mode input.form-control,
.pdf-mode textarea.form-control,
.pdf-mode select.form-control {
    border: 1px solid #333 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    background-color: transparent !important;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    padding: 0.375rem 0.75rem !important; /* Bootstrap default padding */
}

/* Prevent Bootstrap rows from causing horizontal overflow in PDF */
.pdf-mode .row {
    margin-right: 0 !important;
    margin-left: 0 !important;
}
.pdf-mode .col-md-8, .pdf-mode .col-md-4, .pdf-mode .col-md-6, .pdf-mode .col-12 {
    padding-right: 10px !important;
    padding-left: 10px !important;
}
