/* ============================================================
   Archivo  : espera_sap.css
   Ruta     : Shared.EsperaSap/wwwroot/espera-sap/  (servido en /_content/Shared.EsperaSap/espera-sap/)
   Modulo   : MOTOR DE ESPERA DE SAP (transversal, todas las Web.*)
   Fase     : 8 - Views
   Version  : V2.0 - 2026-10-25 - CANDIDATO (opcion C aprobada por FV 19:24; motor transversal OK FV 19:31)
   Sistema  : Hana_Trianon_Satelital
   ------------------------------------------------------------
   Companero de espera_sap.js (misma carpeta). Velo que cubre la pantalla mientras
   el portal crea o envia algo a SAP: un documento sale del monitor del
   portal, viaja en arco con profundidad y entra al servidor SAP, que late,
   emite ondas en el piso y chispas. Solo CSS (sin librerias ni CDN).
   Colores: tokens --esap-* de este archivo; el acento toma --theme-primary.
   ============================================================ */

.esap-velo {
    --esap-acento: var(--theme-primary, #1ab394);
    --esap-sap: #0a6ed1;
    --esap-sap-claro: #4fa8ff;
    --esap-fondo-1: #0b1626;
    --esap-fondo-2: #12304d;
    --esap-texto: #eef4fb;
    --esap-texto-2: #a9bdd3;
    --esap-aviso-fondo: rgba(255, 196, 61, .14);
    --esap-aviso-borde: rgba(255, 196, 61, .45);
    --esap-aviso-texto: #ffe3a1;
    position: fixed;
    inset: 0;
    z-index: 2100;                  /* encima de modales (1055) y SweetAlert2 (1060) */
    display: none;
    align-items: center;
    justify-content: center;
    padding: 16px;
    background: rgba(8, 14, 24, .62);
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
}
.esap-velo.esap-on { display: flex; animation: esap-aparece .25s ease-out; }
@keyframes esap-aparece { from { opacity: 0; } to { opacity: 1; } }

.esap-caja {
    position: relative;
    width: min(440px, 100%);
    padding: 22px 22px 20px;
    border-radius: 16px;
    text-align: center;
    color: var(--esap-texto);
    background: radial-gradient(120% 90% at 50% 0%, var(--esap-fondo-2) 0%, var(--esap-fondo-1) 70%);
    border: 1px solid rgba(79, 168, 255, .28);
    box-shadow: 0 0 0 1px rgba(255, 255, 255, .04) inset, 0 24px 60px rgba(0, 0, 0, .45), 0 0 40px rgba(10, 110, 209, .25);
    overflow: hidden;
    outline: none;
    font-family: var(--theme-body-font-family, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif);
    animation: esap-entra .35s cubic-bezier(.2, .9, .3, 1.2);
}
@keyframes esap-entra { from { transform: translateY(14px) scale(.96); opacity: 0; } to { transform: none; opacity: 1; } }
/* brillo que recorre el borde superior */
.esap-caja::before {
    content: "";
    position: absolute;
    top: 0; left: -40%;
    width: 40%; height: 2px;
    background: linear-gradient(90deg, transparent, var(--esap-sap-claro), transparent);
    animation: esap-brillo 2.4s linear infinite;
}
@keyframes esap-brillo { to { left: 100%; } }

/* ---------- Escena 3D ---------- */
.esap-escena {
    position: relative;
    width: 300px;
    height: 180px;
    margin: 4px auto 8px;
    perspective: 700px;
}
/* piso en perspectiva con lineas que avanzan hacia SAP */
.esap-piso {
    position: absolute;
    left: -30px; right: -30px; bottom: -6px;
    height: 90px;
    transform: rotateX(68deg);
    transform-origin: 50% 100%;
    background-image:
        linear-gradient(rgba(79, 168, 255, .35) 1px, transparent 1px),
        linear-gradient(90deg, rgba(79, 168, 255, .35) 1px, transparent 1px);
    background-size: 22px 22px;
    animation: esap-piso 1.2s linear infinite;
    -webkit-mask-image: radial-gradient(70% 90% at 50% 100%, #000 30%, transparent 75%);
    mask-image: radial-gradient(70% 90% at 50% 100%, #000 30%, transparent 75%);
}
@keyframes esap-piso { to { background-position: 22px 0, 22px 0; } }

/* ---------- Portal: monitor en 3D ---------- */
.esap-portal {
    position: absolute;
    left: 2px; top: 62px;
    width: 86px;
    transform-style: preserve-3d;
    transform: rotateY(22deg);
}
.esap-monitor {
    position: relative;
    height: 60px;
    border-radius: 7px;
    background: linear-gradient(160deg, #263a52, #15263a);
    border: 2px solid #3b5675;
    box-shadow: -6px 6px 0 #0d1a2a, -6px 6px 14px rgba(0, 0, 0, .5), 0 0 18px rgba(26, 179, 148, .35);
    overflow: hidden;
}
.esap-pantalla {
    position: absolute;
    inset: 5px;
    border-radius: 3px;
    background: linear-gradient(180deg, rgba(26, 179, 148, .28), rgba(26, 179, 148, .06));
    padding: 5px 6px;
}
.esap-pantalla i {
    display: block;
    height: 4px;
    margin: 0 0 4px;
    border-radius: 2px;
    background: var(--esap-acento);
    transform-origin: left;
    animation: esap-escribe 1.8s ease-in-out infinite;
}
.esap-pantalla i:nth-child(2) { width: 75%; animation-delay: .2s; }
.esap-pantalla i:nth-child(3) { width: 55%; animation-delay: .4s; }
.esap-pantalla i:nth-child(4) { width: 85%; animation-delay: .6s; }
@keyframes esap-escribe { 0% { transform: scaleX(0); opacity: .4; } 40%, 80% { transform: scaleX(1); opacity: 1; } 100% { transform: scaleX(1); opacity: 0; } }
.esap-pie {
    width: 14px; height: 10px; margin: 0 auto;
    background: linear-gradient(#3b5675, #1d3047);
}
.esap-base {
    width: 46px; height: 5px; margin: 0 auto;
    border-radius: 3px;
    background: #3b5675;
    box-shadow: 0 6px 10px rgba(0, 0, 0, .5);
}
.esap-rotulo {
    position: absolute;
    left: 0; right: 0; top: 100%;
    margin-top: 6px;
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: .06em;
    color: var(--esap-texto-2);
    text-transform: uppercase;
    white-space: nowrap;
}

/* ---------- SAP: servidor de base de datos en 3D ---------- */
.esap-sap {
    position: absolute;
    right: 8px; top: 52px;
    width: 76px;
    transform-style: preserve-3d;
    transform: rotateY(-18deg);
}
.esap-disco {
    position: relative;
    height: 24px;
    margin-top: -6px;
    border-radius: 0 0 38px 38px / 0 0 12px 12px;
    background: linear-gradient(90deg, #06386e 0%, var(--esap-sap) 35%, var(--esap-sap-claro) 55%, var(--esap-sap) 75%, #06386e 100%);
    box-shadow: 0 6px 10px rgba(0, 0, 0, .35);
}
.esap-disco:first-child { margin-top: 0; }
/* tapa eliptica de cada disco */
.esap-disco::before {
    content: "";
    position: absolute;
    left: 0; right: 0; top: -12px;
    height: 24px;
    border-radius: 50%;
    background: radial-gradient(60% 60% at 45% 40%, #8fc7ff, var(--esap-sap) 70%);
    border: 1px solid rgba(255, 255, 255, .25);
}
.esap-disco:first-child::before { animation: esap-tapa 1.8s ease-in-out infinite; }
@keyframes esap-tapa {
    0%, 60%, 100% { box-shadow: 0 0 0 rgba(79, 168, 255, 0); }
    75% { box-shadow: 0 0 22px 6px rgba(79, 168, 255, .9); }
}
/* luces de actividad */
.esap-disco::after {
    content: "";
    position: absolute;
    left: 12px; bottom: 6px;
    width: 5px; height: 5px;
    border-radius: 50%;
    background: #7dffcf;
    box-shadow: 9px 0 0 #7dffcf, 18px 0 0 #ffd36b;
    animation: esap-led .7s steps(2) infinite;
}
.esap-disco:nth-child(2)::after { animation-delay: .2s; }
.esap-disco:nth-child(3)::after { animation-delay: .45s; }
@keyframes esap-led { 50% { opacity: .25; } }
.esap-sap .esap-rotulo { left: -24px; right: -24px; margin-top: 22px; color: var(--esap-sap-claro); }
.esap-sap .esap-marca {
    position: absolute;
    left: 0; right: 0; top: 16px;
    font-size: 13px;
    font-weight: 800;
    letter-spacing: .08em;
    color: #fff;
    text-shadow: 0 1px 2px rgba(0, 0, 0, .6);
    pointer-events: none;
}
/* ondas en el piso bajo SAP */
.esap-onda {
    position: absolute;
    right: 8px; top: 124px;
    width: 76px; height: 76px;
    margin-top: -38px;
    border-radius: 50%;
    border: 2px solid var(--esap-sap-claro);
    transform: rotateX(72deg) scale(.4);
    opacity: 0;
    animation: esap-onda 1.8s ease-out infinite;
}
.esap-onda.esap-o2 { animation-delay: .6s; }
.esap-onda.esap-o3 { animation-delay: 1.2s; }
@keyframes esap-onda { 0% { transform: rotateX(72deg) scale(.4); opacity: .9; } 100% { transform: rotateX(72deg) scale(1.9); opacity: 0; } }
/* chispas que suben desde SAP */
.esap-chispa {
    position: absolute;
    top: 46px;
    width: 4px; height: 4px;
    border-radius: 50%;
    background: #bfe0ff;
    box-shadow: 0 0 6px 2px rgba(79, 168, 255, .9);
    opacity: 0;
    animation: esap-chispa 1.8s ease-out infinite;
}
.esap-chispa:nth-of-type(1) { right: 30px; animation-delay: 1.35s; }
.esap-chispa:nth-of-type(2) { right: 48px; animation-delay: 1.45s; }
.esap-chispa:nth-of-type(3) { right: 62px; animation-delay: 1.55s; }
.esap-chispa:nth-of-type(4) { right: 40px; animation-delay: 1.65s; }
@keyframes esap-chispa { 0% { transform: translate(0, 0); opacity: 1; } 100% { transform: translate(var(--dx, 6px), -46px) scale(.3); opacity: 0; } }
.esap-chispa:nth-of-type(2) { --dx: -10px; }
.esap-chispa:nth-of-type(3) { --dx: -16px; }
.esap-chispa:nth-of-type(4) { --dx: 12px; }

/* ---------- Ruta en arco y documentos que viajan ---------- */
.esap-ruta { position: absolute; inset: 0; width: 300px; height: 180px; overflow: visible; pointer-events: none; }
.esap-ruta path { fill: none; stroke-linecap: round; }
.esap-ruta .esap-guia { stroke: rgba(169, 189, 211, .35); stroke-width: 2; stroke-dasharray: 3 7; }
.esap-ruta .esap-estela {
    stroke: url(#esap-grad);
    stroke-width: 4;
    stroke-dasharray: 60 300;
    filter: drop-shadow(0 0 4px rgba(79, 168, 255, .9));
    animation: esap-estela 1.8s linear infinite;
}
@keyframes esap-estela { from { stroke-dashoffset: 60; } to { stroke-dashoffset: -300; } }
.esap-doc {
    position: absolute;
    top: 0; left: 0;
    offset-path: path("M 84 84 C 126 18, 196 16, 240 64");
    offset-rotate: 0deg;
    offset-distance: 0%;
    opacity: 0;
    animation: esap-viaje 1.8s cubic-bezier(.45, .05, .55, .95) infinite;
    transform-style: preserve-3d;
}
.esap-doc:nth-of-type(2) { animation-delay: .6s; }
.esap-doc:nth-of-type(3) { animation-delay: 1.2s; }
/* escala = profundidad: el documento se acerca a la camara en el punto alto del arco */
@keyframes esap-viaje {
    0% { offset-distance: 0%; opacity: 0; transform: scale(.55) translateZ(0); }
    12% { opacity: 1; }
    50% { transform: scale(1.3) translateZ(40px); }
    88% { opacity: 1; }
    100% { offset-distance: 100%; opacity: 0; transform: scale(.45) translateZ(0); }
}
.esap-hoja {
    position: relative;
    width: 20px; height: 26px;
    margin: -13px 0 0 -10px;
    border-radius: 3px;
    background: linear-gradient(160deg, #ffffff, #dfe9f5);
    box-shadow: 0 4px 10px rgba(0, 0, 0, .45), 0 0 10px rgba(79, 168, 255, .55);
    animation: esap-gira 1.8s linear infinite;
    backface-visibility: visible;
}
.esap-doc:nth-of-type(2) .esap-hoja { animation-delay: .6s; }
.esap-doc:nth-of-type(3) .esap-hoja { animation-delay: 1.2s; }
.esap-hoja::before,
.esap-hoja::after {
    content: "";
    position: absolute;
    left: 4px; right: 4px; top: 7px;
    height: 2px;
    background: var(--esap-acento);
    box-shadow: 0 5px 0 var(--esap-acento), 0 10px 0 rgba(10, 110, 209, .6);
}
.esap-hoja::after { left: auto; right: 4px; width: 5px; top: 3px; height: 3px; background: var(--esap-sap); box-shadow: none; }
@keyframes esap-gira { from { transform: rotateY(0) rotateZ(-8deg); } to { transform: rotateY(360deg) rotateZ(8deg); } }

/* ---------- Textos ---------- */
.esap-titulo { margin: 4px 0 4px; font-size: 17px; font-weight: 700; color: var(--esap-texto); }
.esap-puntos::after { content: ""; animation: esap-puntos 1.2s steps(4) infinite; }
@keyframes esap-puntos { 0% { content: ""; } 25% { content: "."; } 50% { content: ".."; } 75% { content: "..."; } }
.esap-sub { margin: 0; font-size: 13px; color: var(--esap-texto-2); }
.esap-reloj {
    display: inline-block;
    margin-top: 10px;
    padding: 2px 10px;
    border-radius: 10px;
    font-size: 12px;
    font-variant-numeric: tabular-nums;
    color: var(--esap-texto-2);
    background: rgba(255, 255, 255, .06);
}
.esap-lento {
    display: none;
    margin-top: 12px;
    padding: 8px 10px;
    border-radius: 8px;
    font-size: 12.5px;
    text-align: left;
    color: var(--esap-aviso-texto);
    background: var(--esap-aviso-fondo);
    border: 1px solid var(--esap-aviso-borde);
}
.esap-lento.esap-on { display: block; }

/* ---------- Pantallas chicas y movimiento reducido ---------- */
@media (max-width: 380px) {
    .esap-escena { transform: scale(.88); transform-origin: 50% 0; margin-bottom: -14px; }
}
@media (prefers-reduced-motion: reduce) {
    .esap-velo *, .esap-velo *::before, .esap-velo *::after { animation-duration: 4s !important; }
    .esap-hoja { animation: none !important; }
}
