/* Animaciones compartidas por el panel de admin, el portal de operadores y los logins. */

@keyframes gv-aparecer {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes gv-deslizar-abajo {
    from { opacity: 0; transform: translateY(-12px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes gv-desvanecer {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Entrada escalonada del contenido de cada página */
.gv-main > *:not(.modal),
.op-main > *:not(.modal),
.auth-card {
    animation: gv-aparecer .4s ease-out backwards;
}

.gv-main > *:nth-child(2), .op-main > *:nth-child(2) { animation-delay: .05s; }
.gv-main > *:nth-child(3), .op-main > *:nth-child(3) { animation-delay: .1s; }
.gv-main > *:nth-child(4), .op-main > *:nth-child(4) { animation-delay: .15s; }
.gv-main > *:nth-child(n+5), .op-main > *:nth-child(n+5) { animation-delay: .2s; }

/* Tarjetas de KPIs dentro de una fila */
.row > [class*="col-"] > .card {
    animation: gv-aparecer .45s ease-out backwards;
    transition: transform .15s ease, box-shadow .15s ease;
}

.row > [class*="col-"]:nth-child(2) > .card { animation-delay: .05s; }
.row > [class*="col-"]:nth-child(3) > .card { animation-delay: .1s; }
.row > [class*="col-"]:nth-child(4) > .card { animation-delay: .15s; }
.row > [class*="col-"]:nth-child(n+5) > .card { animation-delay: .2s; }

.row > [class*="col-"] > .card.h-100:hover {
    transform: translateY(-2px);
    box-shadow: 0 .5rem 1rem rgba(13, 27, 61, .08);
}

/* Alertas de éxito/error */
.alert {
    animation: gv-deslizar-abajo .35s ease-out backwards;
}

/* Botones: respuesta al toque y estado cargando */
.btn {
    transition: transform .1s ease, box-shadow .15s ease, background-color .15s ease, border-color .15s ease, color .15s ease;
}

.btn:active:not(:disabled):not(.disabled) {
    transform: scale(.97);
}

.btn.gv-cargando {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: progress;
    opacity: .85;
    pointer-events: none;
}

/* Filas de tablas */
.table-hover > tbody > tr {
    transition: background-color .15s ease;
}

.table > tbody > tr {
    animation: gv-desvanecer .3s ease-out backwards;
}

/* Pantalla de "enviando" */
.gv-overlay-carga {
    position: fixed;
    inset: 0;
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    background: rgba(13, 27, 61, .55);
    backdrop-filter: blur(2px);
    animation: gv-desvanecer .2s ease-out backwards;
}

.gv-overlay-caja {
    background: #fff;
    border-radius: 1rem;
    padding: 2rem 2.5rem;
    text-align: center;
    max-width: 320px;
    box-shadow: 0 1rem 3rem rgba(0, 0, 0, .2);
    animation: gv-aparecer .3s ease-out backwards;
}

.gv-overlay-caja .spinner-border {
    width: 3rem;
    height: 3rem;
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: .01ms !important;
        animation-delay: 0s !important;
        transition-duration: .01ms !important;
    }
}
