/* ------------------------------------------------------------
   HERO COMPACTO + BUSCADOR
   ------------------------------------------------------------ */

.lg-hero-compact {
    position: relative;
    overflow: hidden;
    background: linear-gradient(135deg, var(--lg-teal) 0%, var(--lg-teal-dark) 55%, #07434A 100%);
    color: #fff;
    padding: clamp(2.25rem, 5vw, 3.25rem) 0 clamp(4rem, 7vw, 5rem);
}

.lg-hero-compact::before {
    content: "";
    position: absolute;
    inset: 0;
    background-image: radial-gradient(rgba(255, 255, 255, .14) 1.5px, transparent 1.5px);
    background-size: 18px 18px;
    mask-image: radial-gradient(ellipse at 50% 0%, black, transparent 78%);
    -webkit-mask-image: radial-gradient(ellipse at 50% 0%, black, transparent 78%);
    pointer-events: none;
}

.lg-hero-compact .lg-eyebrow {
    color: rgba(255, 255, 255, .85);
}

.lg-hero-compact .lg-eyebrow::before {
    background: #fff;
    opacity: .6;
}

.lg-track-head {
    position: relative;
    z-index: 2;
    text-align: center;
    max-width: 640px;
    margin: 0 auto;
}

.lg-track-head h1 {
    font-weight: 800;
    letter-spacing: -.03em;
    line-height: 1.1;
    font-size: clamp(1.6rem, 4vw, 2.4rem);
    margin-bottom: 1.5rem;
    text-wrap: balance;
}

.lg-track-search {
    background: var(--lg-surface);
    border: 1px solid var(--lg-mist);
    border-radius: 18px;
    padding: clamp(1rem, 2.5vw, 1.35rem);
    box-shadow: 0 24px 50px -18px rgba(0, 0, 0, .45);
    text-align: left;
}

.lg-track-search-row {
    display: flex;
    gap: .6rem;
}

@media (max-width: 575.98px) {
    .lg-track-search-row {
        flex-direction: column;
    }
}

.lg-track-search-row .track-input-group {
    flex: 1;
    min-width: 0;
}

.lg-track-search-row .lg-track-cta {
    width: auto;
    flex-shrink: 0;
    padding: .7rem 1.5rem;
}

@media (max-width: 575.98px) {
    .lg-track-search-row .lg-track-cta {
        width: 100%;
    }
}

/* ------------------------------------------------------------
   PANEL DE RESULTADO (montado sobre el hero)
   ------------------------------------------------------------ */

.lg-result {
    position: relative;
    z-index: 3;
    margin-top: clamp(-3.5rem, -5vw, -2.5rem);
    padding-bottom: clamp(3rem, 6vw, 4.5rem);
}

.lg-result-inner {
    max-width: 780px;
    margin: 0 auto;
}

/* Resumen del envío */
.lg-shipment {
    background: var(--lg-surface);
    border: 1px solid var(--lg-mist);
    border-radius: 20px;
    padding: clamp(1.25rem, 3vw, 1.85rem);
    box-shadow: 0 18px 40px -22px rgba(0, 0, 0, .4);
    margin-bottom: 1.5rem;
}

.lg-shipment-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 1.25rem;
}

.lg-shipment-label {
    display: block;
    font-family: var(--lg-font-mono);
    font-size: .62rem;
    letter-spacing: .14em;
    text-transform: uppercase;
    color: var(--lg-ink-soft);
    margin-bottom: .35rem;
}

.lg-shipment-number {
    display: flex;
    align-items: center;
    gap: .6rem;
    font-family: var(--lg-font-mono);
    font-weight: 600;
    font-size: clamp(1.15rem, 3vw, 1.5rem);
    letter-spacing: .02em;
    color: var(--lg-ink);
    word-break: break-all;
    line-height: 1.2;
}

.lg-copy-btn {
    border: 1px solid var(--lg-mist);
    background: transparent;
    color: var(--lg-ink-soft);
    width: 30px;
    height: 30px;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: .8rem;
    cursor: pointer;
    transition: color .2s var(--lg-ease-out), border-color .2s var(--lg-ease-out);
}

.lg-copy-btn:hover {
    color: var(--lg-teal);
    border-color: var(--lg-teal);
}

.lg-copy-btn.is-copied {
    color: #fff;
    background: var(--lg-teal);
    border-color: var(--lg-teal);
}

/* Chips */
.lg-chips {
    display: flex;
    flex-wrap: wrap;
    gap: .45rem;
}

.lg-chip {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    padding: .35rem .7rem;
    border-radius: 999px;
    font-size: .74rem;
    font-weight: 600;
    border: 1px solid var(--lg-mist);
    color: var(--lg-ink-soft);
    background: var(--lg-paper);
    white-space: nowrap;
}

.lg-chip-teal {
    background: var(--lg-teal-light);
    border-color: color-mix(in srgb, var(--lg-teal) 35%, transparent);
    color: var(--lg-teal);
}

.lg-chip-magenta {
    background: color-mix(in srgb, var(--lg-magenta) 12%, transparent);
    border-color: color-mix(in srgb, var(--lg-magenta) 35%, transparent);
    color: var(--lg-magenta);
}

[data-bs-theme="dark"] .lg-chip-magenta {
    color: #F06CB8;
}

.lg-chip-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
    flex-shrink: 0;
}

.lg-chip-live .lg-chip-dot {
    animation: lgPulseDot 1.8s ease-in-out infinite;
}

@keyframes lgPulseDot {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: .35; transform: scale(.75); }
}

/* ------------------------------------------------------------
   RUTA HORIZONTAL
   ------------------------------------------------------------ */

.lg-route-h {
    position: relative;
    padding: .5rem 0 .25rem;
}

.lg-route-h-track {
    position: relative;
    height: 4px;
    border-radius: 999px;
    background: var(--lg-mist);
    margin: 0 6px;
}

.lg-route-h-fill {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    border-radius: 999px;
    background: linear-gradient(90deg, var(--lg-teal), var(--lg-teal-dark));
    transform-origin: left;
    animation: lgFillIn .9s var(--lg-ease-out) both;
}

@keyframes lgFillIn {
    from { transform: scaleX(0); }
    to { transform: scaleX(1); }
}

.lg-route-h-nodes {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.lg-route-h-node {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--lg-mist);
    border: 2px solid var(--lg-surface);
    flex-shrink: 0;
    position: relative;
    z-index: 2;
}

.lg-route-h-node.is-done {
    background: var(--lg-teal);
}

.lg-route-h-node.is-current {
    width: 16px;
    height: 16px;
    background: var(--lg-magenta);
    box-shadow: 0 0 0 4px color-mix(in srgb, var(--lg-magenta) 22%, transparent);
}

.lg-route-h-node.is-current::after {
    content: "";
    position: absolute;
    inset: -4px;
    border-radius: 50%;
    border: 2px solid var(--lg-magenta);
    animation: lgPing 2s var(--lg-ease-out) infinite;
}

@keyframes lgPing {
    0% { transform: scale(.85); opacity: .8; }
    70%, 100% { transform: scale(1.9); opacity: 0; }
}

.lg-route-h-ends {
    display: flex;
    justify-content: space-between;
    margin-top: .85rem;
    font-family: var(--lg-font-mono);
    font-size: .62rem;
    letter-spacing: .12em;
    text-transform: uppercase;
    color: var(--lg-ink-soft);
}

/* ------------------------------------------------------------
   TIMELINE VERTICAL
   ------------------------------------------------------------ */

.lg-timeline {
    list-style: none;
    margin: 0;
    padding: 0;
}

.lg-tl-item {
    display: flex;
    gap: 1rem;
    position: relative;
    padding-bottom: 1.15rem;
}

.lg-tl-item:last-child {
    padding-bottom: 0;
}

/* Línea de conexión */
.lg-tl-item:not(:last-child)::before {
    content: "";
    position: absolute;
    left: 19px;
    top: 44px;
    bottom: -4px;
    width: 2px;
    background: linear-gradient(var(--lg-teal), color-mix(in srgb, var(--lg-teal) 35%, transparent));
    border-radius: 2px;
}

.lg-tl-rail {
    flex-shrink: 0;
}

.lg-tl-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--lg-teal);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.05rem;
    position: relative;
    z-index: 2;
    border: 3px solid var(--lg-surface);
    box-shadow: 0 0 0 1px var(--lg-mist);
    transition: transform .3s var(--lg-ease-out);
}

.lg-tl-item:hover .lg-tl-icon {
    transform: scale(1.1);
}

.lg-tl-item.is-current .lg-tl-icon {
    background: var(--lg-magenta);
    box-shadow: 0 0 0 1px color-mix(in srgb, var(--lg-magenta) 40%, transparent),
                0 0 0 6px color-mix(in srgb, var(--lg-magenta) 12%, transparent);
}

.lg-tl-card {
    flex: 1;
    min-width: 0;
    background: var(--lg-surface);
    border: 1px solid var(--lg-mist);
    border-radius: 16px;
    padding: 1rem 1.15rem;
    transition: transform .22s var(--lg-ease-out), border-color .22s var(--lg-ease-out), box-shadow .22s var(--lg-ease-out);
}

.lg-tl-item:hover .lg-tl-card {
    transform: translateX(3px);
    border-color: color-mix(in srgb, var(--lg-teal) 45%, transparent);
    box-shadow: 0 14px 30px -20px rgba(19, 131, 142, .7);
}

.lg-tl-item.is-current .lg-tl-card {
    border-color: color-mix(in srgb, var(--lg-magenta) 45%, transparent);
    box-shadow: 0 14px 34px -18px color-mix(in srgb, var(--lg-magenta) 55%, transparent);
}

.lg-tl-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: .75rem;
    flex-wrap: wrap;
    margin-bottom: .3rem;
}

.lg-tl-card h5 {
    font-weight: 700;
    font-size: 1rem;
    color: var(--lg-ink);
    margin: 0;
}

.lg-tl-item.is-current .lg-tl-card h5 {
    color: var(--lg-magenta);
}

[data-bs-theme="dark"] .lg-tl-item.is-current .lg-tl-card h5 {
    color: #F06CB8;
}

.lg-tl-time {
    font-family: var(--lg-font-mono);
    font-size: .68rem;
    color: var(--lg-ink-soft);
    white-space: nowrap;
}

.lg-tl-card p {
    margin: 0;
    font-size: .88rem;
    color: var(--lg-ink-soft);
    line-height: 1.55;
}

/* Entrada escalonada */
.lg-tl-item {
    opacity: 0;
    transform: translateY(12px);
    animation: lgTlIn .5s var(--lg-ease-out) forwards;
}

.lg-tl-item:nth-child(1) { animation-delay: .05s; }
.lg-tl-item:nth-child(2) { animation-delay: .12s; }
.lg-tl-item:nth-child(3) { animation-delay: .19s; }
.lg-tl-item:nth-child(4) { animation-delay: .26s; }
.lg-tl-item:nth-child(5) { animation-delay: .33s; }
.lg-tl-item:nth-child(6) { animation-delay: .40s; }
.lg-tl-item:nth-child(7) { animation-delay: .47s; }
.lg-tl-item:nth-child(8) { animation-delay: .54s; }
.lg-tl-item:nth-child(n+9) { animation-delay: .6s; }

@keyframes lgTlIn {
    to { opacity: 1; transform: translateY(0); }
}

/* Encabezado del bloque de proceso */
.lg-process-head {
    text-align: center;
    margin-bottom: 1.5rem;
}

.lg-process-head h2 {
    font-weight: 800;
    letter-spacing: -.02em;
    font-size: clamp(1.25rem, 3vw, 1.6rem);
    color: var(--lg-ink);
    margin-bottom: .4rem;
}

.lg-process-head p {
    color: var(--lg-ink-soft);
    font-size: .9rem;
    margin: 0;
    max-width: 52ch;
    margin-inline: auto;
}

/* ------------------------------------------------------------
   ESTADOS: VACÍO / NO ENCONTRADO
   ------------------------------------------------------------ */

.lg-state {
    background: var(--lg-surface);
    border: 1px solid var(--lg-mist);
    border-radius: 20px;
    padding: clamp(2rem, 5vw, 3rem) clamp(1.25rem, 4vw, 2.5rem);
    text-align: center;
    box-shadow: 0 18px 40px -22px rgba(0, 0, 0, .4);
}

.lg-state-art {
    width: min(320px, 100%);
    height: auto;
    margin: 0 auto 1.5rem;
    display: block;
}

.lg-state h2 {
    font-weight: 800;
    letter-spacing: -.02em;
    font-size: clamp(1.2rem, 3vw, 1.5rem);
    color: var(--lg-ink);
    margin-bottom: .5rem;
}

.lg-state p {
    color: var(--lg-ink-soft);
    font-size: .92rem;
    max-width: 46ch;
    margin: 0 auto .5rem;
    line-height: 1.6;
}

.lg-state-actions {
    display: flex;
    gap: .6rem;
    justify-content: center;
    flex-wrap: wrap;
    margin-top: 1.5rem;
}

.lg-btn-ghost {
    display: inline-flex;
    align-items: center;
    gap: .45rem;
    padding: .65rem 1.25rem;
    border-radius: 10px;
    font-weight: 600;
    font-size: .9rem;
    text-decoration: none;
    border: 1px solid var(--lg-mist);
    color: var(--lg-ink-soft);
    background: transparent;
    transition: border-color .2s var(--lg-ease-out), color .2s var(--lg-ease-out), transform .2s var(--lg-ease-out);
}

.lg-btn-ghost:hover {
    border-color: var(--lg-teal);
    color: var(--lg-teal);
    transform: translateY(-1px);
}

.lg-state-hint {
    font-family: var(--lg-font-mono);
    font-size: .72rem;
    color: var(--lg-ink-soft);
    background: var(--lg-paper);
    border: 1px solid var(--lg-mist);
    border-radius: 8px;
    padding: .3rem .6rem;
    display: inline-block;
    margin-top: .35rem;
}

/* Animación del arte de "no encontrado" */
.lg-state-art .lg-art-scan {
    animation: lgScan 3.5s var(--lg-ease-out) infinite;
    transform-box: fill-box;
    transform-origin: center;
}

@keyframes lgScan {
    0%, 100% { transform: translateX(-14px); }
    50% { transform: translateX(14px); }
}

.lg-state-art .lg-art-dash {
    stroke-dasharray: 5 7;
    animation: lgArtDash 14s linear infinite;
}

@keyframes lgArtDash {
    to { stroke-dashoffset: -120; }
}

/* ------------------------------------------------------------
   Accesibilidad
   ------------------------------------------------------------ */

@media (prefers-reduced-motion: reduce) {

    .lg-route-h-fill,
    .lg-route-h-node.is-current::after,
    .lg-chip-live .lg-chip-dot,
    .lg-state-art .lg-art-scan,
    .lg-state-art .lg-art-dash {
        animation: none;
    }

    .lg-route-h-fill {
        transform: scaleX(1);
    }

    .lg-tl-item {
        animation: none;
        opacity: 1;
        transform: none;
    }

    .lg-tl-item:hover .lg-tl-icon,
    .lg-tl-item:hover .lg-tl-card,
    .lg-btn-ghost:hover {
        transform: none;
    }
}

@media (hover: none) {

    .lg-tl-item:hover .lg-tl-icon,
    .lg-tl-item:hover .lg-tl-card {
        transform: none;
    }
}


@media print {

    .lg-nav,
    .lg-footer,
    .lg-hero-compact,
    .lg-copy-btn,
    .lg-state-actions {
        display: none !important;
    }

    .lg-result {
        margin-top: 0;
    }

    .lg-shipment,
    .lg-tl-card,
    .lg-state {
        box-shadow: none;
        border: 1px solid #ccc;
    }

    .lg-tl-item {
        opacity: 1;
        transform: none;
        animation: none;
        break-inside: avoid;
    }
}
