/**
 * FINAL REPLACEMENT for improved-modal.css
 */

/* Modal Background Overlay */
.form-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(17, 24, 39, 0.6);
    z-index: 3000;
    opacity: 0;
    transition: opacity 0.3s ease;
    justify-content: center;
    align-items: center;
    padding: 2vh 2vw;
    box-sizing: border-box;
}

.form-modal.active {
    display: flex;
    opacity: 1;
}

/* Modal Content Container */
.form-modal-content {
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    width: 100%;
    height: 100%;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transform: scale(0.98);
    transition: transform 0.3s ease;
}

.form-modal.active .form-modal-content {
    transform: scale(1);
}

/* Modal Header */
.form-modal-header {
    flex-shrink: 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 24px;
    border-bottom: 1px solid #eaeaea;
    background-color: #f8f9fa;
}

.form-modal-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 500;
}

.form-modal-close {
    font-size: 24px;
    font-weight: 700;
    color: #999;
    cursor: pointer;
}

/* Modal Body (Split Layout) */
.form-modal-body {
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* Document Preview Section (Left Side) */
.document-preview-container {
    padding: 16px; /* A bit of padding */
    display: flex;
    flex-direction: column;
    overflow: hidden; /* Important */
}

.document-preview {
    flex: 1; /* Allow it to grow */
    overflow: hidden; /* Important */
    display: flex;
    flex-direction: column;
}

.document-image {
    flex: 1; /* Make this the primary growing element */
    overflow-y: auto; /* THIS IS THE KEY: enable vertical scrolling */
    padding: 16px;
    background: #e8eaf0; /* A slightly darker background to contrast the white pages */
    border-radius: 6px;
}

.document-page {
    background-color: white; /* Ensure pages are white */
    max-width: 80%; /* Don't let pages get too wide */
}
.document-page img {
    display: block;
    max-width: 100%;
}

/* Form Container (Right Side) */
.form-container {
    width: 35%;
    overflow-y: auto;
    padding: 24px;
    display: flex;
    flex-direction: column;
}

#pdfFillForm {
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

#formSectionsContainer {
    flex-grow: 1;
}

/* Form Elements Styling */
.form-section-title {
    font-size: 20px;
    margin-bottom: 24px;
    padding-bottom: 8px;
    border-bottom: 1px solid #eaeaea;
}

.form-field-group {
    margin-bottom: 20px;
}

.form-field-group label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: #555;
    margin-bottom: 8px;
}

.form-field-input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 16px;
}

.form-field-input:focus {
    border-color: #0056b3;
    box-shadow: 0 0 0 3px rgba(0, 86, 179, 0.2);
    outline: none;
}

/* Form Actions (Buttons) */
.form-actions {
    margin-top: auto;
    padding-top: 24px;
    border-top: 1px solid #eaeaea;
    display: flex;
    justify-content: flex-end;
}

/* Loading and Error states */
.preview-loading, .document-placeholder.error {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: #666;
    text-align: center;
}
.preview-loading i { font-size: 32px; margin-bottom: 16px; color: #0056b3; }
.document-placeholder.error i { font-size: 32px; margin-bottom: 16px; color: #dc3545; }