/** ============================================================
 *  LOGIN - Estilos Premium con Animaciones
 *  MediaClouding SAS - API de Streaming
 *  ============================================================ */

/* ---------- Canvas de red neuronal ---------- */
.network-canvas {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
}

/* Gradiente de fondo fallback */
.login-bg-gradient {
    position: fixed;
    inset: 0;
    z-index: -1;
    background:
        radial-gradient(ellipse 80% 60% at 20% 40%, rgba(3,152,158,0.12) 0%, transparent 60%),
        radial-gradient(ellipse 60% 50% at 80% 80%, rgba(0,128,55,0.10) 0%, transparent 50%),
        linear-gradient(160deg, #024d50 0%, #0a1f21 40%, #051517 100%);
}

/* ---------- Contenedor del login ---------- */
.login-body {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    position: relative;
    overflow: hidden;
}

/* ---------- Tarjeta de login con glassmorphism ---------- */
.login-card {
    position: relative;
    z-index: 1;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: var(--radius);
    box-shadow:
        0 8px 32px rgba(3, 152, 158, 0.15),
        0 0 0 1px rgba(255, 255, 255, 0.5) inset,
        0 24px 60px rgba(0, 0, 0, 0.1);
    padding: 2.8rem 2.4rem;
    width: 100%;
    max-width: 440px;
    margin: auto;
    animation: card-entrance 0.8s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    opacity: 0;
    transform: translateY(30px) scale(0.95);
}
@keyframes card-entrance {
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Brillo sutil en la parte superior de la tarjeta */
.login-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 10%;
    right: 10%;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(3,152,158,0.3), transparent);
    border-radius: 1px;
}

/* ---------- Logo con glow y animacion ---------- */
.login-logo {
    text-align: center;
    margin-bottom: 0.6rem;
    animation: logo-reveal 0.6s cubic-bezier(0.16, 1, 0.3, 1) 0.3s forwards;
    opacity: 0;
    transform: translateY(-10px);
}
@keyframes logo-reveal {
    to { opacity: 1; transform: translateY(0); }
}

.logo-glow {
    display: inline-block;
    position: relative;
}
.logo-glow::before {
    content: '';
    position: absolute;
    inset: -10px;
    background: radial-gradient(circle, rgba(3,152,158,0.2) 0%, transparent 70%);
    border-radius: 50%;
    animation: glow-pulse 3s ease-in-out infinite;
    z-index: -1;
}
@keyframes glow-pulse {
    0%, 100% { transform: scale(1); opacity: 0.6; }
    50% { transform: scale(1.2); opacity: 0.3; }
}

.login-logo img {
    height: 64px;
    margin: 0 auto;
    filter: drop-shadow(0 4px 8px rgba(3,152,158,0.2));
    transition: transform 0.3s ease;
}
.login-logo img:hover {
    transform: scale(1.05);
}

/* ---------- Titulo ---------- */
.login-card h1 {
    text-align: center;
    font-size: 1.6rem;
    color: var(--ink);
    margin-top: 0.8rem;
    animation: text-reveal 0.5s cubic-bezier(0.16, 1, 0.3, 1) 0.5s forwards;
    opacity: 0;
    transform: translateY(8px);
    letter-spacing: -0.5px;
}
@keyframes text-reveal {
    to { opacity: 1; transform: translateY(0); }
}

/* ---------- Badge "En vivo" ---------- */
.streaming-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin: 0.8rem auto 0.4rem;
    padding: 0.35rem 1rem;
    background: linear-gradient(135deg, rgba(3,152,158,0.08) 0%, rgba(0,128,55,0.08) 100%);
    border: 1px solid rgba(3,152,158,0.15);
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--teal-600);
    letter-spacing: 0.5px;
    animation: badge-reveal 0.5s cubic-bezier(0.16, 1, 0.3, 1) 0.6s forwards;
    opacity: 0;
    transform: scale(0.9);
}
@keyframes badge-reveal {
    to { opacity: 1; transform: scale(1); }
}

.live-dot {
    width: 8px;
    height: 8px;
    background: var(--green-500);
    border-radius: 50%;
    box-shadow: 0 0 0 3px rgba(0,128,55,0.2);
    animation: live-pulse 2s ease-in-out infinite;
}
@keyframes live-pulse {
    0%, 100% { box-shadow: 0 0 0 3px rgba(0,128,55,0.2); }
    50% { box-shadow: 0 0 0 8px rgba(0,128,55,0); }
}

/* ---------- Subtitulo ---------- */
.login-subtitle {
    text-align: center;
    color: var(--muted);
    font-size: 0.92rem;
    margin: 0.4rem 0 1.8rem;
    animation: text-reveal 0.5s cubic-bezier(0.16, 1, 0.3, 1) 0.7s forwards;
    opacity: 0;
}

/* ---------- Alerta de error con animacion ---------- */
.alert-error {
    background: linear-gradient(135deg, #fef2f2 0%, #fff5f5 100%);
    color: #b91c1c;
    border: 1px solid #fecaca;
    border-radius: 10px;
    padding: 0.8rem 1rem;
    margin-bottom: 1rem;
    font-size: 0.9rem;
    animation: shake 0.5s ease-in-out;
    position: relative;
    overflow: hidden;
}
.alert-error::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: #dc2626;
    border-radius: 10px 0 0 10px;
}
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    20% { transform: translateX(-6px); }
    40% { transform: translateX(6px); }
    60% { transform: translateX(-3px); }
    80% { transform: translateX(3px); }
}

/* ---------- Grupos de input ---------- */
.input-group {
    animation: input-reveal 0.5s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    opacity: 0;
    transform: translateY(12px);
}
#group-user { animation-delay: 0.8s; }
#group-pass { animation-delay: 0.9s; }
@keyframes input-reveal {
    to { opacity: 1; transform: translateY(0); }
}

form label {
    display: block;
    margin: 1rem 0 0.35rem;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--ink);
    transition: color 0.2s ease;
}
.input-group:focus-within label {
    color: var(--teal-600);
}

/* ---------- Input con icono y animaciones ---------- */
.input-wrap {
    position: relative;
    display: flex;
    align-items: center;
}

.input-icon {
    position: absolute;
    left: 0.9rem;
    width: 20px;
    height: 20px;
    color: var(--muted);
    pointer-events: none;
    transition: color 0.2s ease, transform 0.2s ease;
    z-index: 2;
}

.input-wrap input {
    width: 100%;
    padding: 0.75rem 0.9rem 0.75rem 2.6rem;
    border: 1.5px solid var(--line);
    border-radius: 12px;
    font-size: 0.95rem;
    font-family: inherit;
    color: var(--ink);
    background: #fff;
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    position: relative;
}

.input-wrap input:focus {
    outline: none;
    border-color: var(--teal-500);
    box-shadow:
        0 0 0 4px rgba(3,152,158,0.1),
        0 4px 12px rgba(3,152,158,0.08);
    transform: translateY(-1px);
}

.input-wrap input:focus + .toggle-password,
.input-wrap input:focus ~ .input-icon {
    color: var(--teal-500);
}

.input-wrap input:focus ~ .input-icon {
    transform: scale(1.1);
}

/* Placeholder estilizado */
.input-wrap input::placeholder {
    color: #a0b0b1;
    font-size: 0.9rem;
    transition: opacity 0.2s ease;
}
.input-wrap input:focus::placeholder {
    opacity: 0.5;
}

/* ---------- Boton toggle password ---------- */
.toggle-password {
    position: absolute;
    right: 0.7rem;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.3rem;
    color: var(--muted);
    transition: color 0.2s ease, transform 0.2s ease;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
}
.toggle-password:hover {
    color: var(--teal-600);
    transform: translateY(-50%) scale(1.1);
}
.toggle-password svg {
    width: 20px;
    height: 20px;
}
.toggle-password .eye-closed {
    display: none;
}
.toggle-password.showing .eye-open {
    display: none;
}
.toggle-password.showing .eye-closed {
    display: block;
}

/* ---------- Fila Recuerdame + Olvide ---------- */
.remember-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 1rem;
    animation: input-reveal 0.5s cubic-bezier(0.16, 1, 0.3, 1) 0.95s forwards;
    opacity: 0;
    transform: translateY(12px);
}

.remember-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    font-size: 0.85rem;
    color: var(--text);
    user-select: none;
    position: relative;
}

.remember-label input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.check-custom {
    width: 18px;
    height: 18px;
    border: 2px solid var(--line);
    border-radius: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    flex-shrink: 0;
    background: #fff;
}
.check-custom svg {
    width: 12px;
    height: 12px;
    color: #fff;
    opacity: 0;
    transform: scale(0.5);
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.remember-label input:checked + .check-custom {
    background: var(--grad-primary);
    border-color: transparent;
    box-shadow: 0 2px 8px rgba(3,152,158,0.3);
}
.remember-label input:checked + .check-custom svg {
    opacity: 1;
    transform: scale(1);
}

.remember-label:hover .check-custom {
    border-color: var(--teal-300);
}

.remember-text {
    font-size: 0.85rem;
    color: var(--text);
    transition: color 0.2s ease;
}
.remember-label:hover .remember-text {
    color: var(--teal-700);
}

.forgot-link {
    font-size: 0.82rem;
    color: var(--teal-600);
    font-weight: 500;
    transition: color 0.2s ease;
    position: relative;
}
.forgot-link::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    width: 0;
    height: 1px;
    background: var(--teal-500);
    transition: width 0.3s ease;
}
.forgot-link:hover {
    color: var(--teal-500);
}
.forgot-link:hover::after {
    width: 100%;
}

/* ---------- Boton de submit animado ---------- */
.login-btn-animated {
    position: relative;
    margin-top: 1.5rem;
    padding: 0.85rem 1.3rem;
    font-size: 1rem;
    font-weight: 700;
    letter-spacing: 0.3px;
    overflow: hidden;
    animation: btn-reveal 0.5s cubic-bezier(0.16, 1, 0.3, 1) 1s forwards;
    opacity: 0;
    transform: translateY(12px);
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes btn-reveal {
    to { opacity: 1; transform: translateY(0); }
}

.login-btn-animated::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transition: left 0.5s ease;
}
.login-btn-animated:hover::before {
    left: 100%;
}

.login-btn-animated:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 12px 32px rgba(3,152,158,0.4);
}

.login-btn-animated:active:not(:disabled) {
    transform: translateY(0);
}

/* Texto del boton */
.btn-text {
    display: inline-block;
    transition: opacity 0.2s ease, transform 0.2s ease;
}

/* Loader dentro del boton */
.btn-loader {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    position: absolute;
    inset: 0;
}
.loader-dot {
    width: 6px;
    height: 6px;
    background: #fff;
    border-radius: 50%;
    animation: loader-bounce 1.4s ease-in-out infinite both;
}
.loader-dot:nth-child(1) { animation-delay: -0.32s; }
.loader-dot:nth-child(2) { animation-delay: -0.16s; }
@keyframes loader-bounce {
    0%, 80%, 100% { transform: scale(0); }
    40% { transform: scale(1); }
}

/* Flecha del boton */
.btn-arrow {
    width: 18px;
    height: 18px;
    margin-left: 0.4rem;
    transition: transform 0.2s ease;
}
.login-btn-animated:hover .btn-arrow {
    transform: translateX(3px);
}

/* Estado cargando */
.login-btn-animated.loading .btn-text,
.login-btn-animated.loading .btn-arrow {
    opacity: 0;
    transform: scale(0.8);
}
.login-btn-animated.loading .btn-loader {
    opacity: 1;
}

/* ---------- Footer ---------- */
.login-footer {
    text-align: center;
    margin-top: 1.6rem;
    font-size: 0.88rem;
    color: var(--muted);
    animation: text-reveal 0.5s cubic-bezier(0.16, 1, 0.3, 1) 1.1s forwards;
    opacity: 0;
}
.login-footer a {
    color: var(--teal-600);
    font-weight: 600;
    position: relative;
    transition: color 0.2s ease;
}
.login-footer a::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 0;
    height: 1.5px;
    background: var(--teal-500);
    transition: width 0.3s ease;
}
.login-footer a:hover {
    color: var(--teal-500);
}
.login-footer a:hover::after {
    width: 100%;
}

/* ---------- Responsive ---------- */
@media (max-width: 480px) {
    .login-body {
        padding: 1rem;
    }
    .login-card {
        padding: 2rem 1.5rem;
        border-radius: 16px;
        max-width: 100%;
    }
    .login-logo img {
        height: 52px;
    }
    .login-card h1 {
        font-size: 1.35rem;
    }
    .login-subtitle {
        font-size: 0.85rem;
        margin-bottom: 1.4rem;
    }
    form label {
        margin-top: 0.9rem;
        font-size: 0.82rem;
    }
    .input-wrap input {
        padding: 0.7rem 0.85rem 0.7rem 2.4rem;
        font-size: 1rem;
    }
    .input-icon {
        left: 0.8rem;
        width: 18px;
        height: 18px;
    }
    .login-btn-animated {
        padding: 0.8rem 1.2rem;
        font-size: 0.95rem;
    }
    .remember-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.6rem;
    }
    .forgot-link {
        align-self: flex-end;
    }
}

/* ---------- Animacion de exito al login ---------- */
.login-success {
    animation: success-pulse 0.6s ease forwards;
}
@keyframes success-pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.02); box-shadow: 0 12px 40px rgba(0,128,55,0.2); }
    100% { transform: scale(1); }
}

/* ---------- Efecto de carga de pagina ---------- */
body.login-body {
    animation: body-fade-in 0.4s ease;
}
@keyframes body-fade-in {
    from { opacity: 0; }
    to { opacity: 1; }
}
