/* FirmaPlus · indicador de «procesando»: solo el logo animado sobre un fondo difuminado y semitransparente.
   Si en algún equipo muy lento se siente pesado, pon --fd-blur: 0px (queda solo el fondo semitransparente). */
:root {
    --fd-blur: 5px;
    --fd-scrim: rgba(8, 12, 30, 0.58);
}

.fd-busy {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: grid;
    place-items: center;
    background: var(--fd-scrim);
    -webkit-backdrop-filter: blur(var(--fd-blur));
    backdrop-filter: blur(var(--fd-blur));
    /* sin transiciones: aparece al instante */
}
.fd-busy[hidden],
.pdf-loader[hidden] {
    display: none;
}

/* Logo animado: solo transform (acelerado por la GPU) */
.fd-anim {
    --fd-ring: #fff;
    --fd-track: rgba(255, 255, 255, 0.28);
    position: relative;
    width: 6rem;
    height: 6rem;
}
.fd-ring {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    animation: fd-giro 1s linear infinite;
    will-change: transform;
}
.fd-ring circle {
    fill: none;
    stroke-width: 3.5;
}
.fd-ring .pista {
    stroke: var(--fd-track);
}
.fd-ring .arco {
    stroke: var(--fd-ring);
    stroke-linecap: round;
    stroke-dasharray: 72 217;
}
.fd-logo {
    position: absolute;
    inset: 18%;
    width: 64%;
    height: 64%;
    filter: none;
    animation: fd-pulso 1.4s ease-in-out infinite;
    will-change: transform;
}
@keyframes fd-giro {
    to {
        transform: rotate(360deg);
    }
}
@keyframes fd-pulso {
    0%,
    100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.08);
    }
}
.fd-sr {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
    border: 0;
}

/* Visor PDF: el mismo logo, sin fondo difuminado, mientras se carga o se cambia de página */
.pdf-wrap {
    position: relative;
}
.pdf-loader {
    position: absolute;
    inset: 0;
    z-index: 5;
    display: grid;
    place-items: center;
    border-radius: var(--r-m, 12px);
    background: color-mix(in srgb, var(--papel, #edeff3) 66%, transparent);
}
.pdf-loader .fd-anim {
    --fd-ring: #0550ff;
    --fd-track: var(--linea, #dce0e8);
    width: 5rem;
    height: 5rem;
}

/* Botón ocupado: mini spinner antes del texto */
.btn.is-busy {
    position: relative;
    cursor: progress;
    opacity: 0.85;
}
.btn.is-busy::before {
    content: "";
    display: inline-block;
    width: 0.95em;
    height: 0.95em;
    margin-right: 0.5em;
    vertical-align: -0.12em;
    border: 2px solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    animation: fd-giro 0.7s linear infinite;
}

/* Barra superior al abrir otra página (aparece si tarda más de ~0,3 s) */
.fd-topbar {
    position: fixed;
    top: 0;
    left: 0;
    height: 3px;
    width: 0;
    z-index: 10000;
    background: linear-gradient(90deg, #0550ff, #6b8cff);
    box-shadow: 0 0 8px rgba(5, 80, 255, 0.5);
    transition: width 8s cubic-bezier(0.1, 0.7, 0.2, 1);
}
.fd-topbar[hidden] {
    display: none;
}
.fd-topbar.on {
    width: 88%;
}

@media (prefers-reduced-motion: reduce) {
    .fd-logo {
        animation: none;
    }
    .fd-ring {
        animation-duration: 2.4s;
    }
    .fd-topbar {
        transition: none;
    }
}

/* ---- Razón y localización de la firma (ventana de detalles) ---- */
.sd-box {
    margin: 0 0 1rem;
}
.sd-resumen {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.7rem 0.85rem;
    border: 1px dashed var(--linea, #dce0e8);
    border-radius: var(--r-m, 12px);
    background: var(--hoja-2, #f6f7f9);
    font-size: 0.875rem;
}
.sd-resumen .txt {
    flex: 1;
    min-width: 0;
    color: var(--tinta-2, #4a5167);
    overflow-wrap: anywhere;
}
.sd-resumen .txt b {
    color: var(--tinta, #13172a);
    font-weight: 600;
}
dialog.sd {
    width: min(30rem, calc(100vw - 1.5rem));
    max-height: calc(100dvh - 1.5rem);
    padding: 0;
    border: 0;
    border-radius: var(--r-l, 18px);
    background: var(--hoja, #fff);
    color: var(--tinta, #13172a);
    box-shadow: 0 30px 70px -20px rgba(0, 0, 0, 0.55), 0 0 0 1px var(--linea, #dce0e8);
}
dialog.sd::backdrop {
    background: rgba(10, 13, 28, 0.5);
    backdrop-filter: blur(2px);
}
dialog.sd .sd-in {
    padding: 1.35rem 1.3rem 1.2rem;
    display: grid;
    gap: 0.95rem;
}
dialog.sd h2 {
    margin: 0;
    font-size: 1.15rem;
}
dialog.sd .field {
    margin: 0;
}
dialog.sd textarea,
dialog.sd select,
dialog.sd input[type="text"] {
    width: 100%;
}
dialog.sd .sd-sug {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-top: 0.45rem;
}
dialog.sd .sd-estado {
    margin: 0.4rem 0 0;
    font-size: 0.8125rem;
    color: var(--tinta-2, #4a5167);
}
dialog.sd .sd-estado.err {
    color: var(--err, #b9302a);
}
dialog.sd .sd-acc {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
    justify-content: flex-end;
}
@media (max-width: 36rem) {
    dialog.sd {
        margin: auto 0.75rem 0.75rem;
        width: calc(100vw - 1.5rem);
    }
    dialog.sd .sd-acc .btn {
        flex: 1 1 auto;
    }
}
