/* ================================================================
   Underwing · loading_sheet.css — pantalla de "Solicitando briefing"
   con aspecto de app: ruta del vuelo, barra de progreso real (n de N
   fuentes) y una fila por fuente con su estado dibujado en CSS
   (sin iconos de fuente, que se veían mal en iOS).
     · iPhone (app): hoja inferior a todo el ancho, como las de iOS.
     · iPad y web: tarjeta centrada.
   ================================================================ */

.loading {
    background: rgba(6, 12, 20, .42) !important;
    backdrop-filter: blur(10px) saturate(140%) !important;
    -webkit-backdrop-filter: blur(10px) saturate(140%) !important;
    animation: none !important;
}
.loading .loading-box {
    width: min(440px, 100%) !important;
    min-width: 0 !important;
    max-width: 440px !important;
    padding: 26px 26px 18px !important;
    border-radius: 22px !important;
    border: 1px solid var(--line) !important;
    box-shadow: 0 30px 80px rgba(0, 0, 0, .35) !important;
    background: var(--bg-card, var(--bg-2)) !important;
}
.loading .loading-box::before { display: none !important; }      /* sin la barra "shimmer" */
.loading .loading-spinner { display: none !important; }

/* Cabecera: ruta + título + cuántas fuentes llevamos */
.lx-route {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 14px;
    font-family: var(--font-num, ui-monospace, SFMono-Regular, Menlo, monospace);
    font-size: 26px;
    font-weight: 700;
    letter-spacing: .04em;
    color: var(--text);
    margin-bottom: 6px;
}
.lx-route:empty, .lx-route.lx-noroute { display: none; }
.lx-path { position: relative; width: 74px; height: 22px; flex: none; color: var(--accent); }
.lx-path::before {                                 /* trazo de la ruta */
    content: "";
    position: absolute; left: 0; right: 0; top: 50%;
    border-top: 2px dashed color-mix(in srgb, var(--accent) 45%, transparent);
}
.lx-plane {                                         /* avión que avanza */
    position: absolute; top: 50%; left: 0;
    width: 20px; height: 20px; margin-top: -10px;
    animation: lx-fly 2.4s ease-in-out infinite;
}
@keyframes lx-fly { 0% { left: 0; opacity: 0; } 15% { opacity: 1; } 85% { opacity: 1; } 100% { left: calc(100% - 20px); opacity: 0; } }
.loading .loading-text {
    font-size: 17px !important;
    font-weight: 700 !important;
    text-align: center;
    margin: 0 !important;
    color: var(--text) !important;
}
.lx-sub {
    text-align: center;
    font-size: 13px;
    color: var(--text-3);
    margin-top: 3px;
    font-variant-numeric: tabular-nums;
}

/* Barra de progreso real */
.lx-bar {
    height: 6px;
    border-radius: 999px;
    background: color-mix(in srgb, var(--text) 8%, transparent);
    overflow: hidden;
    margin: 16px 0 10px;
}
.lx-bar-fill {
    height: 100%;
    width: 4%;
    border-radius: inherit;
    background: var(--accent);
    transition: width .45s cubic-bezier(.2, .8, .2, 1);
}

/* Filas de fuentes */
.loading .loading-steps {
    border-top: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
}
.loading .loading-steps li {
    display: grid !important;
    grid-template-columns: 22px 1fr auto;
    align-items: center;
    gap: 12px !important;
    padding: 9px 2px !important;
    font-size: 15px !important;
    font-weight: 500 !important;
    color: var(--text-3) !important;
    border-bottom: .5px solid var(--line-soft, var(--line));
}
.loading .loading-steps li:last-child { border-bottom: 0; }
.loading .loading-steps li::before { content: none !important; display: none !important; }
.loading .loading-steps li.active { color: var(--text) !important; }
.loading .loading-steps li.done { color: var(--text-2) !important; }
.loading .loading-steps li.error { color: var(--text) !important; }
.lx-l { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lx-src {
    font-size: 11.5px;
    font-weight: 600;
    letter-spacing: .03em;
    color: var(--text-3);
    white-space: nowrap;
}

/* Indicador de estado, dibujado en CSS */
.lx-ic {
    width: 20px; height: 20px;
    box-sizing: border-box;
    border-radius: 50%;
    border: 2px solid color-mix(in srgb, var(--text) 18%, transparent);
    position: relative;
}
li.active > .lx-ic {
    border-color: color-mix(in srgb, var(--accent) 25%, transparent);
    border-top-color: var(--accent);
    animation: lx-spin .8s linear infinite;
}
li.done > .lx-ic { border: 0; background: var(--accent); }
li.done > .lx-ic::after {                           /* ✓ */
    content: "";
    position: absolute;
    left: 7px; top: 4px;
    width: 5px; height: 9px;
    border: solid #fff;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}
li.error > .lx-ic { border: 0; background: #e8930c; }
li.error > .lx-ic::after {                          /* ! */
    content: "!";
    position: absolute; inset: 0;
    display: grid; place-items: center;
    color: #fff; font-weight: 800; font-size: 13px; line-height: 1;
}
li.error > .lx-src { color: #c77700; }
@keyframes lx-spin { to { transform: rotate(360deg); } }

.lx-foot {
    text-align: center;
    font-size: 12px;
    color: var(--text-3);
    margin-top: 12px;
}

/* ── iPhone (app): hoja inferior a todo el ancho ── */
html.cap-iphone .loading {
    padding: 0 !important;
    align-items: end !important;
    place-items: end stretch !important;
}
html.cap-iphone .loading .loading-box {
    width: 100% !important;
    max-width: none !important;
    border-radius: 24px 24px 0 0 !important;
    border-left: 0 !important; border-right: 0 !important; border-bottom: 0 !important;
    padding: 12px 22px calc(16px + env(safe-area-inset-bottom, 0px)) !important;
    transform: none !important;
    opacity: 1 !important;
    animation: lx-sheet-up .38s cubic-bezier(.2, .9, .25, 1) both !important;
}
html.cap-iphone .loading .loading-box::after {       /* asa de la hoja */
    content: "";
    display: block;
    width: 38px; height: 5px;
    border-radius: 3px;
    background: color-mix(in srgb, var(--text) 18%, transparent);
    position: absolute; top: 8px; left: 50%; margin-left: -19px;
}
html.cap-iphone .lx-head { padding-top: 14px; }
@keyframes lx-sheet-up { from { transform: translateY(100%); } to { transform: translateY(0); } }
@media (orientation: landscape) {
    html.cap-iphone .loading { place-items: center !important; padding: 12px !important; }
    html.cap-iphone .loading .loading-box {
        width: min(520px, 100%) !important;
        border-radius: 22px !important;
        border: 1px solid var(--line) !important;
        padding: 16px 22px 12px !important;
        animation: none !important;
        max-height: calc(100vh - 24px);
        overflow: auto;
    }
    html.cap-iphone .loading .loading-box::after { display: none; }
    html.cap-iphone .lx-route { font-size: 20px; margin-bottom: 2px; }
    html.cap-iphone .loading .loading-steps li { padding: 5px 2px !important; font-size: 14px !important; }
    html.cap-iphone .lx-bar { margin: 10px 0 6px; }
    html.cap-iphone .lx-foot { display: none; }
}

@media (prefers-reduced-motion: reduce) {
    .lx-plane { animation: none; left: calc(50% - 10px); }
    li.active > .lx-ic { animation-duration: 2s; }
}
