#lp-ff-modal,
#lp-ff-upload-modal {
    position: fixed;
    z-index: 100000;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: #fff;
    padding: 24px 28px;
    box-shadow: 0 20px 50px rgba(15, 23, 42, 0.18);
    width: 90%;
    max-width: 900px;
    height: auto;
    max-height: 85vh;
    overflow-y: auto;
    border-radius: 14px;
}

/* Desplazar el modal del formulario a la izquierda para que no lo tape el panel derecho (Edit Order) */
#lp-ff-modal {
    transform: translate(calc(-50% - 140px), -50%);
}

#lp-ff-upload-modal {
    max-width: 540px;
}

#lp-ff-upload-modal h3 {
    font-size: 18px;
    margin-bottom: 18px;
}

#lp-ff-modal h3,
#lp-ff-upload-modal h3 {
    margin-bottom: 15px;
}

#lp-ff-modal select,
#lp-ff-upload-modal input {
    width: 100%;
    margin-bottom: 15px;
}

#lp-ff-upload-modal .lp-ff-upload-dropzone {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 150px;
    border: 2px dashed #b6c4f7;
    background: #f8faff;
    border-radius: 14px;
    padding: 18px;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

#lp-ff-upload-modal .lp-ff-upload-dropzone:hover {
    border-color: #4f6ef7;
    box-shadow: 0 10px 25px rgba(79, 110, 247, 0.15);
    background: #f1f5ff;
}

#lp-ff-upload-modal .lp-ff-upload-dropzone.is-dragover {
    border-color: #0b6efc;
    box-shadow: 0 12px 30px rgba(11, 110, 252, 0.2);
    background: #eef4ff;
}

#lp-ff-upload-modal .lp-ff-upload-dropzone-text {
    text-align: center;
    color: #5b6b8b;
    font-weight: 600;
    font-size: 14px;
    line-height: 1.4;
}

#lp-ff-upload-modal .lp-ff-upload-dropzone-text em {
    font-style: normal;
    font-weight: 500;
    color: #8a97b6;
}

#lp-ff-upload-modal #lp-ff-pdf-file {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
    margin: 0;
}

.lp-ff-upload-body {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.lp-ff-upload-error {
    display: none;
    font-size: 12px;
    font-weight: 600;
    color: #b42318;
    background: #fef3f2;
    border: 1px solid #fecdca;
    padding: 8px 10px;
    border-radius: 10px;
}

.lp-ff-upload-has-error .lp-ff-upload-error {
    display: block;
}

.lp-ff-upload-actions {
    display: flex;
    justify-content: flex-end;
    margin-top: 6px;
}

#lp-ff-upload-btn {
    background: #fff;
    border-color: #fff;
    color: #0b6efc;
    padding: 10px 22px;
    border-radius: 10px;
    font-weight: 600;
}

#lp-ff-upload-btn:hover {
    background: #fff;
    border-color: #fff;
}

.lp-ff-documentation {
    margin-top: 20px;
    padding: 20px;
    border: 1px solid #e1e4e8;
    background: #fff;
    border-radius: 8px;
}

.lp-ff-documentation__heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 15px;
}

.lp-ff-documentation__heading h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
}

.lp-ff-documentation__line {
    flex: 1;
    height: 1px;
    background: #0b6efc;
    margin-left: 16px;
}

.lp-ff-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 15px;
}

.lp-ff-modal-title {
    font-weight: 600;
    font-size: 16px;
}

.lp-ff-modal-exit {
    border-radius: 8px;
    background: #fff;
    color: #0b6efc;
    border: 1px solid #0b6efc;
    padding: 6px 14px;
    font-weight: 600;
}

.lp-ff-modal-exit:hover {
    background: #0b6efc;
    color: #fff;
}

.lp-ff-form-chooser {
    margin-bottom: 16px;
}
.lp-ff-form-chooser label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: #334155;
    margin-bottom: 6px;
}
.lp-ff-select-form {
    font-size: 13px;
    padding: 8px 12px;
    border-radius: 8px;
    border: 1px solid #cbd5e1;
    background: #fff;
    min-width: 200px;
    width: 100%;
    max-width: 320px;
}
.lp-ff-form-container {
    min-height: 120px;
    margin-top: 8px;
}
.lp-ff-form-placeholder,
.lp-ff-form-loading,
.lp-ff-form-error {
    padding: 20px;
    text-align: center;
    color: #64748b;
    font-size: 14px;
    background: #f8fafc;
    border-radius: 10px;
}
.lp-ff-form-error {
    color: #b91c1c;
    background: #fef2f2;
}
.lp-ff-form-loading {
    color: #0b6efc;
}

.lp-ff-documentation__actions {
    display: flex;
    gap: 12px;
    margin-bottom: 18px;
}

.lp-ff-documentation__actions .button {
    border-radius: 8px;
    background: #fff;
    color: #0b6efc;
    border: 1px solid #0b6efc;
    padding: 8px 22px;
    font-weight: 600;
}

.lp-ff-documentation__actions .button:hover {
    background: #0b6efc;
    color: #fff;
}

.lp-ff-documents-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.lp-ff-doc-item {
    background: #f7f9fc;
    border-radius: 10px;
    padding: 12px 16px;
    display: flex;
    align-items: center;
    box-shadow: 0 2px 6px rgba(15, 40, 97, 0.08);
}

.lp-ff-doc-link {
    display: flex;
    align-items: center;
    text-decoration: none;
    color: inherit;
    gap: 14px;
    width: 100%;
}

.lp-ff-doc-icon {
    width: 44px;
    height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    background: #fff;
    border: 1px solid #e6edf6;
    overflow: hidden;
    flex: 0 0 44px;
}

.lp-ff-doc-icon-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.lp-ff-doc-content {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.lp-ff-doc-content strong {
    font-size: 16px;
}

.lp-ff-doc-content span {
    font-size: 14px;
    color: #47536a;
}

/* Compact mode for documentation rendered inside each booking card */
.lp-ff-documentation.lp-ff-documentation--compact {
    margin-top: 14px;
    padding: 14px;
}
.lp-ff-documentation.lp-ff-documentation--compact .lp-ff-documentation__heading {
    margin-bottom: 10px;
}
.lp-ff-documentation.lp-ff-documentation--compact .lp-ff-documentation__heading h3 {
    font-size: 15px;
}
.lp-ff-documentation.lp-ff-documentation--compact .lp-ff-documentation__heading h4 {
    font-size: 14px;
    margin: 0;
}
.lp-ff-documentation.lp-ff-documentation--compact .lp-ff-documentation__line {
    margin-left: 10px;
}
.lp-ff-documentation.lp-ff-documentation--compact .lp-ff-documentation__actions {
    gap: 8px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}
.lp-ff-documentation.lp-ff-documentation--compact .lp-ff-documentation__actions .button {
    flex: 1 1 0;
    min-width: 0;
    padding: 7px 10px;
    font-size: 12px;
    line-height: 1.2;
}
.lp-ff-documentation.lp-ff-documentation--compact .lp-ff-documents-list {
    gap: 8px;
}
.lp-ff-documentation.lp-ff-documentation--compact .lp-ff-doc-item {
    padding: 8px 10px;
    border-radius: 8px;
}
.lp-ff-documentation.lp-ff-documentation--compact .lp-ff-doc-icon {
    width: 32px;
    height: 32px;
    flex: 0 0 32px;
}
.lp-ff-documentation.lp-ff-documentation--compact .lp-ff-doc-link {
    gap: 8px;
}
.lp-ff-documentation.lp-ff-documentation--compact .lp-ff-doc-content strong {
    font-size: 13px;
    line-height: 1.2;
}
.lp-ff-documentation.lp-ff-documentation--compact .lp-ff-doc-content span {
    font-size: 11px;
    line-height: 1.3;
}
.lp-ff-documentation.lp-ff-documentation--compact .lp-ff-doc-delete {
    width: 22px;
    height: 22px;
    font-size: 16px;
    margin-left: 6px;
}

/* Delete document button (admin only) */
.lp-ff-doc-item {
    position: relative;
    display: flex;
    align-items: center;
}
.lp-ff-doc-item .lp-ff-doc-link {
    flex: 1;
    min-width: 0;
}
.lp-ff-doc-delete {
    flex-shrink: 0;
    width: 26px;
    height: 26px;
    margin-left: 8px;
    padding: 0;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    background: #fff;
    color: #64748b;
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    transition: color 0.2s, border-color 0.2s, background 0.2s;
}
.lp-ff-doc-delete:hover {
    color: #dc2626;
    border-color: #fecaca;
    background: #fef2f2;
}
.lp-ff-doc-delete:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Ocultar sección vacía (Online Form / Uploaded PDFs) de forma persistente */
.lp-ff-doc-section--hidden {
    display: none !important;
}

/* Si la lista de documentos está vacía, ocultar toda la sección (evita que el título quede visible) */
.lp-ff-doc-section-form:has([data-document-list]:not(:has(.lp-ff-doc-item))) {
    display: none !important;
}
.lp-ff-doc-section-upload:has([data-upload-document-list]:not(:has(.lp-ff-doc-item))) {
    display: none !important;
}

/* Confirmación de borrado dentro del panel (caja en rojo + mensaje encima) */
.lp-ff-doc-item--confirm-delete {
    background: #fef2f2 !important;
    border: 2px solid #fecaca;
    box-shadow: 0 0 0 1px rgba(220, 38, 38, 0.2);
}
.lp-ff-delete-confirm {
    margin-top: 4px;
    padding: 14px 16px;
    background: #fff;
    border: 1px solid #fecaca;
    border-radius: 10px;
    box-shadow: 0 4px 14px rgba(220, 38, 38, 0.12);
}
.lp-ff-delete-confirm-text {
    margin: 0 0 12px 0;
    font-size: 14px;
    color: #991b1b;
    font-weight: 500;
    line-height: 1.4;
}
.lp-ff-delete-confirm-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}
.lp-ff-delete-confirm-btn {
    padding: 8px 18px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    border: 1px solid transparent;
    transition: background 0.2s, color 0.2s, border-color 0.2s;
}
.lp-ff-delete-confirm-yes {
    background: #dc2626;
    color: #fff;
    border-color: #b91c1c;
}
.lp-ff-delete-confirm-yes:hover:not(:disabled) {
    background: #b91c1c;
}
.lp-ff-delete-confirm-no {
    background: #fff;
    color: #475569;
    border-color: #e2e8f0;
}
.lp-ff-delete-confirm-no:hover {
    background: #f8fafc;
    border-color: #cbd5e1;
}
.lp-ff-delete-confirm-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}
.lp-ff-delete-error {
    padding: 10px 14px;
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 8px;
    color: #b91c1c;
    font-size: 13px;
    font-weight: 500;
}

/* Wrapper para animación de borrado (fade + slide) */
.lp-ff-doc-removing {
    display: block;
}

.lp-ff-no-documents {
    font-style: italic;
    color: #666;
}

/* Mensaje de éxito y estado de carga al generar documento */
.lp-ff-success-message {
    padding: 10px 0;
    text-align: center;
    color: #10b981;
    font-weight: bold;
    margin-bottom: 4px;
    transition: opacity 0.35s ease;
}
.lp-ff-success-message-fadeout {
    opacity: 0;
}
.lp-ff-doc-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 14px 16px;
    margin-top: 8px;
    background: #f8fafc;
    border-radius: 10px;
    border: 1px dashed #e2e8f0;
}
.lp-ff-doc-loading-spinner {
    width: 20px;
    height: 20px;
    border: 2px solid #e2e8f0;
    border-top-color: #0b6efc;
    border-radius: 50%;
    animation: lpff-spin 0.7s linear infinite;
}
.lp-ff-doc-loading-text {
    font-size: 14px;
    color: #64748b;
    font-weight: 500;
}
@keyframes lpff-spin {
    to { transform: rotate(360deg); }
}

/* Animación al actualizar la lista: cada documento entra suavemente */
.lp-ff-docs-just-updated .lp-ff-doc-item {
    animation: lpff-doc-slide-in 0.4s ease-out backwards;
}
.lp-ff-docs-just-updated .lp-ff-doc-item:nth-child(1) { animation-delay: 0.02s; }
.lp-ff-docs-just-updated .lp-ff-doc-item:nth-child(2) { animation-delay: 0.07s; }
.lp-ff-docs-just-updated .lp-ff-doc-item:nth-child(3) { animation-delay: 0.12s; }
.lp-ff-docs-just-updated .lp-ff-doc-item:nth-child(4) { animation-delay: 0.17s; }
.lp-ff-docs-just-updated .lp-ff-doc-item:nth-child(5) { animation-delay: 0.22s; }
.lp-ff-docs-just-updated .lp-ff-doc-item:nth-child(n+6) { animation-delay: 0.27s; }
@keyframes lpff-doc-slide-in {
    from {
        opacity: 0;
        transform: translateY(-8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ========== Estilo del formulario "Complete Form" en el modal ========== */
#lp-ff-modal .lp-ff-modal-header {
    padding-bottom: 20px;
    margin-bottom: 24px;
    border-bottom: 2px solid #e8eef7;
}
#lp-ff-modal .lp-ff-modal-title {
    font-size: 22px;
    font-weight: 700;
    color: #1e293b;
    letter-spacing: -0.02em;
}
#lp-ff-modal .lp-ff-modal-exit {
    padding: 8px 18px;
    border-radius: 10px;
    font-weight: 600;
    font-size: 14px;
    transition: all 0.2s ease;
}
#lp-ff-modal .lp-ff-modal-exit:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(11, 110, 252, 0.25);
}

/* Contenedor del formulario Fluent Form */
#lp-ff-modal .lp-ff-modal-body {
    padding: 4px 0;
}
#lp-ff-modal .lp-ff-modal-body form,
#lp-ff-modal .fluentform {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
}

/* Grupos de campos */
#lp-ff-modal .ff-el-group {
    margin-bottom: 24px;
}
#lp-ff-modal .lp-ff-modal-body img {
    max-width: 100%;
    height: auto;
    image-rendering: auto;
    -ms-interpolation-mode: bicubic;
}
#lp-ff-modal .ff-el-group label.ff-el-form-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: #334155;
    margin-bottom: 12px;
    line-height: 1.4;
    letter-spacing: 0.01em;
}
#lp-ff-modal .ff-el-group .ff-el-input--content,
#lp-ff-modal .ff-el-group .ff-el-form-control {
    margin-top: 2px;
}
#lp-ff-modal .ff-el-group label.ff-el-form-label .ff-el-form-required {
    color: #dc2626;
    margin-left: 2px;
}

/* Inputs y textarea */
#lp-ff-modal .lp-ff-modal-body input[type="text"],
#lp-ff-modal .lp-ff-modal-body input[type="email"],
#lp-ff-modal .lp-ff-modal-body input[type="url"],
#lp-ff-modal .lp-ff-modal-body input[type="number"],
#lp-ff-modal .lp-ff-modal-body textarea,
#lp-ff-modal .lp-ff-modal-body select,
#lp-ff-modal .ff-el-form-control {
    width: 100%;
    padding: 12px 14px;
    font-size: 15px;
    line-height: 1.5;
    color: #1e293b;
    background: #fff;
    border: 1.5px solid #e2e8f0;
    border-radius: 10px;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
#lp-ff-modal .lp-ff-modal-body textarea {
    min-height: 120px;
    resize: vertical;
}
#lp-ff-modal .lp-ff-modal-body input:focus,
#lp-ff-modal .lp-ff-modal-body textarea:focus,
#lp-ff-modal .lp-ff-modal-body select:focus,
#lp-ff-modal .ff-el-form-control:focus {
    outline: none;
    border-color: #0b6efc;
    box-shadow: 0 0 0 3px rgba(11, 110, 252, 0.15);
}

/* Filas de nombre (First Name / Last Name) */
#lp-ff-modal .ff-t-container {
    gap: 14px;
}
#lp-ff-modal .ff-t-cell {
    flex: 1;
}

/* Signature field should always take full row width inside modal */
#lp-ff-modal .ff-el-signature,
#lp-ff-modal .ff-el-signature.ff-t-cell,
#lp-ff-modal .ff-t-cell:has(.fluentform-signature-pad-wrapper) {
    width: 100% !important;
    max-width: 100% !important;
    flex: 0 0 100% !important;
}

/* Área de firma: ocultar el input que guarda el Base64 (no debe verse) */
#lp-ff-modal .ff-el-signature input.force-hide,
#lp-ff-modal input.force-hide {
    display: none !important;
    position: absolute !important;
    width: 0 !important;
    height: 0 !important;
    opacity: 0 !important;
    pointer-events: none !important;
    overflow: hidden !important;
}
#lp-ff-modal .fluentform-signature-pad-wrapper {
    margin-top: 8px;
    width: 100% !important;
    max-width: 100% !important;
    padding: 4px;
    background: linear-gradient(145deg, #fafbff 0%, #f1f5fb 100%);
    border: 2px dashed #94a3b8;
    border-radius: 12px;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
#lp-ff-modal .fluentform-signature-pad-wrapper:focus-within {
    border-color: #0b6efc;
    box-shadow: 0 0 0 3px rgba(11, 110, 252, 0.12);
}
#lp-ff-modal .fluentform-signature-pad-wrapper canvas.fluentform-signature-pad {
    border-radius: 8px !important;
    background: #fff !important;
    border: 1px solid #e2e8f0 !important;
}
#lp-ff-modal .fluentform-signature-hint,
#lp-ff-modal .ff-el-signature__actions-hint {
    font-size: 13px;
    color: #64748b;
    margin-top: 8px;
}
#lp-ff-modal .fluentform-signature-button {
    transition: transform 0.15s ease, color 0.15s ease;
}
#lp-ff-modal .fluentform-signature-button:hover {
    transform: scale(1.08);
    color: #0b6efc;
}

/* Botón Submit */
#lp-ff-modal .lp-ff-modal-body .ff-btn-submit,
#lp-ff-modal .lp-ff-modal-body button[type="submit"],
#lp-ff-modal .ff_submit_btn {
    width: 100%;
    padding: 14px 24px;
    font-size: 16px;
    font-weight: 600;
    color: #fff;
    background: linear-gradient(135deg, #0b6efc 0%, #0958d9 100%);
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    margin-top: 8px;
    box-shadow: 0 4px 14px rgba(11, 110, 252, 0.35);
}
#lp-ff-modal .lp-ff-modal-body .ff-btn-submit:hover,
#lp-ff-modal .lp-ff-modal-body button[type="submit"]:hover,
#lp-ff-modal .ff_submit_btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(11, 110, 252, 0.4);
}

/* Aumentar tamaño del campo de firma en el modal */
#lp-ff-modal .signature-pad {
    width: 100% !important;
    height: 400px !important;
    border: 1px solid #e2e8f0 !important;
    border-radius: 8px !important;
}
#lp-ff-modal .fluentform-signature-pad-wrapper canvas {
    width: 100% !important;
    max-width: 100% !important;
    height: 220px !important;
}
