/**
 * Forms in Dashboard for Latepoint - Customer cabinet (Forms tab)
 */

.lpfd-forms-progress {
    margin-bottom: 1.25em;
    padding: 12px 0;
}

.lpfd-forms-progress-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    font-size: 0.95em;
}

.lpfd-forms-progress-label {
    color: #475569;
    font-weight: 500;
}

.lpfd-forms-progress-percent {
    color: #0f172a;
    font-weight: 600;
}

.lpfd-forms-progress-track {
    height: 10px;
    background: #e2e8f0;
    border-radius: 10px;
    overflow: hidden;
}

.lpfd-forms-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #22c55e, #16a34a);
    border-radius: 10px;
    transition: width 0.35s ease;
}

.lpfd-forms-list {
    margin-top: 1em;
}

.lpfd-form-item {
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    padding: 14px 16px;
    margin-bottom: 12px;
    background: #fff;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 16px;
}

.lpfd-form-item-heading {
    display: flex;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 10px;
    flex: 1;
    min-width: 0;
}

.lpfd-form-item-icon {
    flex-shrink: 0;
}

.lpfd-form-item-icon img {
    display: block;
    border-radius: 6px;
    object-fit: contain;
}

.lpfd-form-item-title-desc {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.lpfd-form-item-description {
    font-size: 0.9em;
    color: #64748b;
    font-weight: normal;
}

.lpfd-form-item-archived-badge {
    font-size: 0.85em;
    color: #94a3b8;
    font-weight: normal;
}

.lpfd-form-item-archived {
    background: #f8fafc;
}

/* Acordeón: documentos ya no requeridos */
.lpfd-archived-accordion {
    margin-top: 1.5em;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    background: #f8fafc;
    overflow: hidden;
}

.lpfd-archived-accordion-summary {
    list-style: none;
    padding: 12px 16px;
    cursor: pointer;
    font-weight: 600;
    color: #475569;
    display: flex;
    align-items: center;
    gap: 8px;
    user-select: none;
}

.lpfd-archived-accordion-summary::-webkit-details-marker {
    display: none;
}

.lpfd-archived-accordion-summary::before {
    content: '';
    display: inline-block;
    width: 0;
    height: 0;
    border-style: solid;
    border-width: 5px 0 5px 8px;
    border-color: transparent transparent transparent #64748b;
    transition: transform 0.2s ease;
}

.lpfd-archived-accordion[open] .lpfd-archived-accordion-summary::before {
    transform: rotate(90deg);
}

.lpfd-archived-accordion-summary:hover {
    background: #f1f5f9;
    color: #334155;
}

.lpfd-archived-accordion .lpfd-archived-forms-list {
    margin: 0;
    padding: 12px 16px 16px;
    border-top: 1px solid #e2e8f0;
    background: #fff;
}

.lpfd-form-item-right {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px 14px;
    flex-shrink: 0;
}

.lpfd-form-item-status {
    font-size: 0.85em;
    padding: 4px 10px;
    border-radius: 4px;
    line-height: 1.3;
    display: inline-flex;
    align-items: center;
}

.lpfd-status-pending {
    color: #b45309;
    background: #fef3c7;
}

.lpfd-status-uploaded {
    color: #047857;
    background: #d1fae5;
}

.lpfd-status-rejected {
    color: #b91c1c;
    background: #fee2e2;
}

.lpfd-cabinet-rejection {
    width: 100%;
    margin-top: 10px;
    padding: 10px 12px;
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 6px;
    font-size: 0.9em;
}
.lpfd-cabinet-rejection strong {
    display: block;
    margin-bottom: 4px;
    color: #b91c1c;
}
.lpfd-cabinet-rejection .lpfd-rejection-reason {
    margin: 0 0 6px;
    white-space: pre-wrap;
    word-break: break-word;
}
.lpfd-cabinet-rejection .lpfd-rejection-hint {
    margin: 0;
    font-size: 0.9em;
    color: #64748b;
}

.lpfd-form-item-actions {
    font-size: 0.95em;
    display: inline-flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 4px 6px;
}

.lpfd-form-item-actions .lpfd-sep {
    color: #94a3b8;
}

.lpfd-form-item-message {
    width: 100%;
    margin-top: 4px;
    font-size: 0.9em;
}

.lpfd-msg-success {
    color: #047857;
}

.lpfd-msg-error {
    color: #b91c1c;
}

.lpfd-form-item-message.lpfd-msg-fluent-err {
    white-space: pre-wrap;
    line-height: 1.45;
    padding: 8px 10px;
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 4px;
    margin-top: 8px;
    text-align: left;
}

.lpfd-form-item.lpfd-uploading .lpfd-form-item-actions {
    opacity: 0.7;
    pointer-events: none;
}

.lpfd-upload-label input[type="file"] {
    position: absolute;
    width: 0.1px;
    height: 0.1px;
    opacity: 0;
    overflow: hidden;
    z-index: -1;
}

.lpfd-upload-label {
    cursor: pointer;
    display: inline-block;
}

.lpfd-complete-form-btn {
    white-space: nowrap;
}

/* Por encima del modal Documents (wp-admin, z-index ~100000). */
.lpfd-fluent-modal {
    position: fixed;
    inset: 0;
    z-index: 500000;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 20px 12px;
    box-sizing: border-box;
    pointer-events: auto;
}
.lpfd-fluent-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.55);
    z-index: 0;
}
.lpfd-fluent-modal-box {
    position: relative;
    z-index: 1;
    width: min(900px, calc(100vw - 40px));
    max-height: calc(100vh - 40px);
    display: flex;
    flex-direction: column;
    margin: 0;
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 16px 40px rgba(0,0,0,.2);
    padding: 18px 20px;
    box-sizing: border-box;
    /* visible: intl-tel / listas no quedan recortadas por el contenedor */
    overflow: visible;
}
.lpfd-fluent-modal-close {
    position: absolute;
    right: 8px;
    top: 8px;
    z-index: 2;
    width: 32px;
    height: 32px;
    border: 0;
    border-radius: 6px;
    background: #f1f5f9;
    color: #334155;
    cursor: pointer;
    font-size: 22px;
    line-height: 1;
}
.lpfd-fluent-modal-content {
    margin-top: 14px;
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    overflow-x: visible;
    -webkit-overflow-scrolling: touch;
    /* Fluent Choices: z-index en .choices; sin isolation para no interferir con capas de intl-tel */
    position: relative;
}
.lpfd-fluent-modal-iframe {
    flex: 1 1 auto;
    min-height: min(560px, calc(100vh - 120px));
    width: 100%;
    background: #fff;
}
/* intl-tel-input: misma geometría que en página normal (banderas sobre el input, no una franja aparte) */
.lpfd-fluent-modal .iti__country-list {
    position: absolute !important;
    z-index: 200002 !important;
    background-color: #fff !important;
    border: 1px solid #ccc !important;
    box-shadow: 1px 1px 4px rgba(0, 0, 0, 0.2) !important;
    box-sizing: border-box !important;
    /* intl-tel: max-height efectiva vía .iti--inline-dropdown; sin ella el scroll lo absorbe .lpfd-fluent-modal-content */
    max-height: min(185px, 45vh) !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
}
/* Dropdown de intl-tel montado en body (.iti--container) mientras el modal Fluent está abierto */
body:has(#lpfd-fluent-modal.lpfd-is-open) .iti--container .iti__country-list {
    max-height: min(185px, 45vh) !important;
    overflow-y: auto !important;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
}
.lpfd-fluent-modal .iti__country-list.iti__hide {
    display: none !important;
    visibility: hidden !important;
    pointer-events: none !important;
}
/* NO forzar position en .iti--container: es el popup (fixed); position:relative rompe el desplegable y el layout */
.lpfd-fluent-modal .iti.iti--allow-dropdown {
    position: relative !important;
    z-index: 3;
}
.lpfd-fluent-modal .iti {
    --iti-flag-height: 12px;
    --iti-flag-width: 16px;
    display: inline-block !important;
    width: 100%;
    max-width: 100%;
    vertical-align: top;
    box-sizing: border-box;
    position: relative !important;
}
.lpfd-fluent-modal .iti--allow-dropdown {
    display: inline-block !important;
}
/* intl-tel usa .iti__flag-container (no .iti__country-container) */
.lpfd-fluent-modal .iti--allow-dropdown .iti__flag-container,
.lpfd-fluent-modal .iti--separate-dial-code .iti__flag-container {
    position: absolute !important;
    top: 0 !important;
    bottom: 0 !important;
    left: 0 !important;
    right: auto !important;
    z-index: 1 !important;
    /* Temas / columnas a veces fuerzan width:50% en divs: sin esto la franja gris (Fluent .iti__selected-flag) invade el input */
    width: auto !important;
    max-width: 72px !important;
    min-width: 0 !important;
    flex: none !important;
}
.lpfd-fluent-modal .iti--separate-dial-code > .iti__flag-container {
    max-width: 120px !important;
}
.lpfd-fluent-modal .iti input.iti__tel-input,
.lpfd-fluent-modal .iti input.iti__tel-input[type="tel"],
.lpfd-fluent-modal .iti input.iti__tel-input[type="text"] {
    position: relative !important;
    z-index: 0 !important;
    width: 100% !important;
    box-sizing: border-box !important;
}
/* Coincide con intlTelInput.min.css para allow-dropdown (padding-left del prefijo bandera) */
.lpfd-fluent-modal .iti--allow-dropdown input.iti__tel-input,
.lpfd-fluent-modal .iti--allow-dropdown input.iti__tel-input[type="tel"],
.lpfd-fluent-modal .iti--allow-dropdown input.iti__tel-input[type="text"],
.lpfd-fluent-modal .iti--allow-dropdown input[type="tel"],
.lpfd-fluent-modal .iti--allow-dropdown input[type="text"] {
    /* v0.10.3: v25 intl-tel-input's .iti__country-container renders ~60-65px wide (8px left
     * padding + 16px flag + spacer + 6px arrow + 6px right padding). v25 vendor CSS calculates
     * 48px via --iti-selected-country-arrow-padding, but in the LPFD modal context the container
     * expands slightly past that because our v18-era .iti__flag-container { max-width: 72px }
     * rule no longer matches (v25 renamed to .iti__country-container). 72px leaves comfortable
     * clearance so the input's text doesn't start behind the flag overlay. */
    padding-left: 72px !important;
    padding-right: 6px !important;
}
.lpfd-fluent-modal .iti__flag {
    transform: none !important;
    flex-shrink: 0;
}
/* Fluent public: .iti__selected-flag{background:rgba(0,0,0,.1)} — limitar al ancho real del contenedor */
.lpfd-fluent-modal .fluentform .iti__selected-flag,
.lpfd-fluent-modal .iti__selected-flag {
    display: flex !important;
    align-items: center !important;
    height: 100% !important;
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
    background: rgba(0, 0, 0, 0.06) !important;
}
.lpfd-fluent-modal .iti__flag-box,
.lpfd-fluent-modal .iti__arrow {
    display: block !important;
}
/* Choices.js dentro del modal: por encima del resto de capas del formulario */
.lpfd-fluent-modal .choices,
.lpfd-fluent-modal .choices__list--dropdown,
.lpfd-fluent-modal .choices__list[aria-expanded="true"] {
    z-index: 200000 !important;
}
.lpfd-fluent-modal .choices.is-open,
.lpfd-fluent-modal .choices.is-flipped,
.lpfd-fluent-modal .choices__list--dropdown {
    z-index: 200001 !important;
}
/* <select> nativo: asegurar interacción (temas/Elementor a veces desactivan pointer-events) */
.lpfd-fluent-modal .frm-fluent-form select.ff-el-form-control {
    pointer-events: auto !important;
    touch-action: manipulation;
    position: relative;
    z-index: 1;
}
/* Botones: si faltan clases de tema Fluent (.ff-default) o el CSS público, mantener apariencia legible */
.lpfd-fluent-modal .frm-fluent-form .ff-btn-primary.ff_btn_style,
.lpfd-fluent-modal .frm-fluent-form .ff-btn-primary.ff-button,
.lpfd-fluent-modal .frm-fluent-form .ff-btn-submit.ff-btn-primary,
.lpfd-fluent-modal .frm-fluent-form button.ff-btn-submit.ff-btn-primary,
.lpfd-fluent-modal .frm-fluent-form input.ff-btn-submit.ff-btn-primary {
    background-color: var(--fluentform-primary, #1a7efb) !important;
    color: #fff !important;
    border-color: transparent !important;
}
.lpfd-fluent-modal .frm-fluent-form .ff-btn-primary.ff_btn_style:hover,
.lpfd-fluent-modal .frm-fluent-form button.ff-btn-submit:hover {
    opacity: 0.92;
    filter: brightness(0.97);
}
.lpfd-fluent-loading {
    color: #64748b;
}
.lpfd-fluent-modal .fluentform-signature-pad-wrapper canvas.fluentform-signature-pad {
    pointer-events: auto !important;
    cursor: default;
    position: relative;
    z-index: 2;
    user-select: none;
    -webkit-user-select: none;
    background: #ffffff !important;
    border: 1px solid #cbd5e1 !important;
    border-radius: 8px !important;
    max-height: 260px !important;
}
.lpfd-fluent-modal .fluentform-signature-pad-wrapper,
.lpfd-fluent-modal .ff-el-signature {
    pointer-events: auto;
}
.lpfd-fluent-modal fieldset.lpfd-signature-fieldset {
    border: 0;
    margin: 0;
    padding: 0;
    min-width: 0;
    width: 100%;
}
.lpfd-fluent-modal .fluentform-signature-pad-wrapper {
    width: 100% !important;
    max-width: 100% !important;
    background: #f8fafc;
    border: 1px dashed #94a3b8;
    border-radius: 10px;
    padding: 4px;
}
.lpfd-fluent-modal .ff-el-signature input.force-hide,
.lpfd-fluent-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;
}
