/* Plugin CSS for Fillable PDF Viewer */

.gbl-fillable-pdf-container {
    width: 100%;
    max-width: 100%;
    margin: 0;
    padding: 0;
}

#pdf-controls {
    text-align: right;
    margin-bottom: 20px;
}

#pdf-submission-status {
    display: inline-block;
    margin-left: 15px;
    font-weight: bold;
}

#pdf-submission-status.success {
    color: green;
}

#pdf-submission-status.error {
    color: red;
}

#pdf-submission-status.processing {
    color: #f0ad4e;
    animation: pulse-text 1.5s infinite;
}

@keyframes pulse-text {
    0% {
        opacity: 0.5;
    }

    50% {
        opacity: 1;
    }

    100% {
        opacity: 0.5;
    }
}

#pdf-loading-indicator {
    text-align: center;
    font-size: 18px;
    padding: 20px;
    color: #666;
}

#pdf-viewer-container {
    position: relative;
    background: #f5f5f5;
    padding: 0;
    border: 1px solid #ccc;
    width: 100%;
}

.pdf-page-container {
    position: relative;
    margin: 0 auto 10px auto;
    background-color: white;
    box-shadow: 0px 4px 6px rgba(0, 0, 0, 0.1);
    width: 100% !important;
}

.pdf-canvas {
    display: block;
    margin: 0 auto;
}

/* Annotation Layer for form fields */
.annotationLayer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    /* Let clicks pass through except for actual inputs */
}

/* Styling for the actual input elements rendered by pdf.js */
.annotationLayer section {
    position: absolute;
    pointer-events: auto;
}

.annotationLayer input[type="text"],
.annotationLayer input[type="password"],
.annotationLayer textarea,
.annotationLayer select,
.annotationLayer input[type="checkbox"],
.annotationLayer input[type="radio"] {
    background-color: rgba(175, 238, 238, 0.2);
    border: 1px solid rgba(0, 0, 0, 0.2);
    box-sizing: border-box;
    width: 100%;
    height: 100%;
    font-family: inherit;
    font-size: inherit;
    color: #000;
    border-radius: 0 !important;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    padding: 0 2px;
}

/* Specific styling for checkboxes/radios if needed */
.annotationLayer input[type="checkbox"],
.annotationLayer input[type="radio"] {
    cursor: pointer;
}

.annotationLayer input:focus,
.annotationLayer textarea:focus,
.annotationLayer select:focus {
    background-color: rgba(175, 238, 238, 0.5);
    border-color: #007cba;
    outline: none;
}

/* Required Field Styling */
.annotationLayer .is-required,
.annotationLayer input.is-required,
.annotationLayer textarea.is-required,
.annotationLayer select.is-required {
    background-color: rgba(217, 83, 79, 0.1) !important;
    border: 1px solid rgb(187, 8, 2) !important;
}

.annotationLayer input.required-empty,
.annotationLayer textarea.required-empty,
.annotationLayer select.required-empty {
    border: 1px solid #ff0800 !important;
    background-color: rgba(217, 83, 79, 0.3) !important;
    animation: flash-red 1.5s infinite;
}

@keyframes flash-red {
    0% {
        box-shadow: 0 0 0 0px rgba(217, 83, 79, 0.4);
    }

    70% {
        box-shadow: 0 0 0 10px rgba(217, 83, 79, 0);
    }

    100% {
        box-shadow: 0 0 0 0px rgba(217, 83, 79, 0);
    }
}

.signature-overlay.required-empty {
    border: 3px solid #d9534f !important;
    background: rgba(217, 83, 79, 0.2) !important;
    animation: flash-red 1.5s infinite;
}

.signature-overlay.is-required::after {
    content: "*";
    color: #d9534f;
    position: absolute;
    top: 2px;
    right: 5px;
    font-weight: bold;
    font-size: 14px;
}

/* Signature Field Overlay */
.signature-overlay {
    position: absolute;
    background: rgba(255, 255, 224, 0.4);
    border: 1px dashed #f0ad4e;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    color: #8a6d3b;
    overflow: hidden;
    pointer-events: auto !important;
    z-index: 100;
}

.signature-overlay:hover {
    background: rgba(255, 255, 224, 0.6);
    border-style: solid;
}

.signature-overlay img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

/* Signature Modal Styles */
#gbl-signature-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
}

.gbl-signature-modal-content {
    background: white;
    padding: 20px;
    border-radius: 0;
    width: 90%;
    max-width: 800px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

.signature-pad-wrapper {
    border: 1px solid #ccc;
    background: #f9f9f9;
    margin: 15px 0;
    position: relative;
    width: 100%;
    /* 10:1 Aspect Ratio using aspect-ratio property */
    aspect-ratio: 10 / 1;
}

#signature-pad-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.signature-modal-controls {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

/* Floating Navigation Styles */
#pdf-floating-nav {
    position: fixed;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    flex-direction: column;
    gap: 10px;
    z-index: 1000;
}

#pdf-floating-nav button {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    border: none;
    background: #065B00;
    color: white;
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.2);
    transition: background 0.3s, transform 0.2s;
}

#pdf-floating-nav button:hover {
    background: #065B00;
    transform: scale(1.1);
}

#pdf-floating-nav button:active {
    transform: scale(0.9);
}

@media (max-width: 768px) {
    #pdf-floating-nav {
        right: 10px;
    }

    #pdf-floating-nav button {
        width: 40px;
        height: 40px;
        font-size: 16px;
    }
}

/* File Attachment Grid styling */
#pdf-attachment-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 10px;
}

.pdf-attachment-item {
    background: white;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 10px 25px 10px 10px;
    position: relative;
    font-size: 12px;
    word-break: break-all;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.pdf-attachment-item .file-name {
    font-weight: bold;
    margin-bottom: 5px;
}

.pdf-attachment-item .file-size {
    color: #666;
}

.pdf-attachment-item .remove-btn {
    position: absolute;
    top: 5px;
    right: 5px;
    background: #ff4d4d;
    color: white;
    border: none;
    border-radius: 50%;
    width: 18px;
    height: 18px;
    font-size: 12px;
    line-height: 18px;
    text-align: center;
    cursor: pointer;
    font-weight: bold;
    padding: 0;
}

.pdf-attachment-item .remove-btn:hover {
    background: #cc0000;
}