﻿@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700&display=swap');

/* ============================================================
   RESET & BASE
   ============================================================ */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Poppins', 'Segoe UI', sans-serif;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    background: #f5f0f4;
    position: relative;
}

/* ============================================================
   FONDO ANIMADO CON BLOBS
   ============================================================ */
.login-bg {
    position: fixed;
    inset: 0;
    z-index: 0;
    background: linear-gradient(135deg, #fdf6fb 0%, #f0e6ee 40%, #ede0ed 100%);
    overflow: hidden;
}

.blob {
    position: absolute;
    border-radius: 50%;
    filter: blur(70px);
    opacity: 0.55;
    animation: blobFloat 8s ease-in-out infinite;
}

.blob-1 {
    width: 480px;
    height: 480px;
    background: radial-gradient(circle, #B36FA4 0%, #d4a0c8 100%);
    top: -120px;
    left: -100px;
    animation-delay: 0s;
}

.blob-2 {
    width: 360px;
    height: 360px;
    background: radial-gradient(circle, #949498 0%, #c2c2c6 100%);
    bottom: -100px;
    right: -80px;
    animation-delay: -3s;
}

.blob-3 {
    width: 280px;
    height: 280px;
    background: radial-gradient(circle, #c88cbc 0%, #e8c4e0 100%);
    top: 50%;
    left: 60%;
    animation-delay: -5s;
}

.blob-4 {
    width: 200px;
    height: 200px;
    background: radial-gradient(circle, #B36FA4 0%, #9a5a8e 100%);
    bottom: 15%;
    left: 10%;
    animation-delay: -2s;
    opacity: 0.3;
}

@keyframes blobFloat {
    0%, 100% {
        transform: translateY(0px) scale(1);
    }

    33% {
        transform: translateY(-28px) scale(1.04);
    }

    66% {
        transform: translateY(18px) scale(0.97);
    }
}

/* Partículas flotantes */
.particles {
    position: absolute;
    inset: 0;
    pointer-events: none;
}

.particle {
    position: absolute;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: rgba(179, 111, 164, 0.4);
    animation: particleRise linear infinite;
}

@keyframes particleRise {
    0% {
        transform: translateY(100vh) scale(0);
        opacity: 0;
    }

    10% {
        opacity: 1;
    }

    90% {
        opacity: 0.6;
    }

    100% {
        transform: translateY(-10vh) scale(1.2);
        opacity: 0;
    }
}

/* ============================================================
   CONTENEDOR PRINCIPAL
   ============================================================ */
.login-container {
    position: relative;
    z-index: 10;
    width: 100%;
    max-width: 460px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    animation: containerEntry 0.9s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

@keyframes containerEntry {
    from {
        opacity: 0;
        transform: translateY(40px) scale(0.95);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* ============================================================
   CARD
   ============================================================ */
.login-card {
    width: 100%;
    background: rgba(255, 255, 255, 0.82);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: 28px;
    border: 1px solid rgba(255, 255, 255, 0.9);
    box-shadow: 0 8px 40px rgba(179, 111, 164, 0.18), 0 2px 12px rgba(0,0,0,0.07), inset 0 1px 0 rgba(255,255,255,0.95);
    overflow: hidden;
    transition: box-shadow 0.4s ease, transform 0.4s ease;
}

    .login-card:hover {
        box-shadow: 0 16px 60px rgba(179, 111, 164, 0.25), 0 4px 20px rgba(0,0,0,0.09), inset 0 1px 0 rgba(255,255,255,0.95);
        transform: translateY(-2px);
    }

/* ============================================================
   HEADER
   ============================================================ */
.login-header {
    position: relative;
    padding: 42px 36px 36px;
    text-align: center;
    overflow: hidden;
    background: linear-gradient(150deg, #B36FA4 0%, #c98abd 60%, #d4a0c8 100%);
}

    /* Líneas decorativas en header */
    .login-header::before {
        content: '';
        position: absolute;
        top: -60px;
        right: -60px;
        width: 200px;
        height: 200px;
        border-radius: 50%;
        border: 2px solid rgba(255,255,255,0.2);
        animation: headerRingRotate 12s linear infinite;
    }

    .login-header::after {
        content: '';
        position: absolute;
        bottom: -80px;
        left: -50px;
        width: 260px;
        height: 260px;
        border-radius: 50%;
        border: 2px solid rgba(255,255,255,0.12);
        animation: headerRingRotate 18s linear infinite reverse;
    }

@keyframes headerRingRotate {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

.login-logo-wrap {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 16px;
}

.login-logo-ring {
    position: absolute;
    width: 90px;
    height: 90px;
    border-radius: 50%;
    border: 2px dashed rgba(255,255,255,0.45);
    animation: logoRingSpin 10s linear infinite;
}

@keyframes logoRingSpin {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

.login-logo {
    position: relative;
    width: 72px;
    height: 72px;
    border-radius: 20px;
    object-fit: contain;
    background: rgba(255,255,255,0.22);
    padding: 8px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.18);
    backdrop-filter: blur(8px);
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

    .login-logo:hover {
        transform: rotate(-6deg) scale(1.08);
    }

.login-header h2 {
    color: #fff;
    font-size: 1.65rem;
    font-weight: 700;
    letter-spacing: 0.3px;
    margin-bottom: 4px;
    text-shadow: 0 2px 10px rgba(0,0,0,0.12);
}

.login-header-subtitle {
    color: rgba(255,255,255,0.85);
    font-size: 0.82rem;
    font-weight: 400;
    letter-spacing: 0.5px;
    margin-bottom: 0;
}

/* Roles badges */
.login-roles {
    display: flex;
    gap: 8px;
    justify-content: center;
    margin-top: 14px;
    flex-wrap: wrap;
}

.role-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: rgba(255,255,255,0.18);
    backdrop-filter: blur(6px);
    border: 1px solid rgba(255,255,255,0.35);
    border-radius: 20px;
    padding: 4px 12px;
    color: #fff;
    font-size: 0.72rem;
    font-weight: 500;
    letter-spacing: 0.3px;
    transition: background 0.3s, transform 0.2s;
}

    .role-badge:hover {
        background: rgba(255,255,255,0.28);
        transform: translateY(-1px);
    }

    .role-badge i {
        font-size: 0.75rem;
    }

/* ============================================================
   BODY
   ============================================================ */
.login-body {
    padding: 36px 36px 30px;
}

/* ============================================================
   FORM FLOATING CUSTOMIZADO
   ============================================================ */
.field-wrap {
    position: relative;
    margin-bottom: 20px;
}

    .field-wrap .form-control {
        height: 58px;
        padding: 18px 48px 6px 46px;
        border: 2px solid #e8dde6;
        border-radius: 14px;
        font-size: 0.95rem;
        font-family: 'Poppins', sans-serif;
        font-weight: 500;
        color: #3a3040;
        background: rgba(255,255,255,0.7);
        transition: border-color 0.3s, box-shadow 0.3s, background 0.3s;
        width: 100%;
        outline: none;
    }

        .field-wrap .form-control:focus {
            border-color: #B36FA4;
            background: #fff;
            box-shadow: 0 0 0 4px rgba(179, 111, 164, 0.12);
        }

        .field-wrap .form-control.is-valid-field {
            border-color: #8ec98e;
            box-shadow: 0 0 0 3px rgba(100, 180, 100, 0.1);
        }

    .field-wrap label {
        position: absolute;
        left: 46px;
        top: 50%;
        transform: translateY(-50%);
        color: #9a8a98;
        font-size: 0.92rem;
        font-weight: 400;
        pointer-events: none;
        transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
        white-space: nowrap;
    }

    .field-wrap .form-control:focus ~ label,
    .field-wrap .form-control:not(:placeholder-shown) ~ label {
        top: 14px;
        transform: translateY(0);
        font-size: 0.72rem;
        font-weight: 600;
        color: #B36FA4;
        letter-spacing: 0.3px;
    }

.field-icon-left {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: #c0a8bc;
    font-size: 1.05rem;
    pointer-events: none;
    transition: color 0.3s;
    z-index: 2;
}

.field-wrap:focus-within .field-icon-left {
    color: #B36FA4;
}

.password-toggle {
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: #c0a8bc;
    font-size: 1rem;
    cursor: pointer;
    z-index: 10;
    padding: 4px;
    border-radius: 6px;
    transition: color 0.2s, background 0.2s;
}

    .password-toggle:hover {
        color: #B36FA4;
        background: rgba(179, 111, 164, 0.1);
    }

/* ============================================================
   BOTÓN DE LOGIN
   ============================================================ */
.btn-login {
    position: relative;
    width: 100%;
    padding: 15px;
    border: none;
    border-radius: 14px;
    background: linear-gradient(135deg, #B36FA4 0%, #c98abd 100%);
    color: #fff;
    font-family: 'Poppins', sans-serif;
    font-size: 1rem;
    font-weight: 600;
    letter-spacing: 0.5px;
    cursor: pointer;
    overflow: hidden;
    transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.25s ease;
    box-shadow: 0 6px 24px rgba(179, 111, 164, 0.4);
    margin-top: 4px;
}

    .btn-login::before {
        content: '';
        position: absolute;
        inset: 0;
        background: linear-gradient(135deg, rgba(255,255,255,0.25) 0%, transparent 100%);
        opacity: 0;
        transition: opacity 0.3s;
    }

    .btn-login:hover {
        transform: translateY(-3px) scale(1.01);
        box-shadow: 0 12px 36px rgba(179, 111, 164, 0.5);
    }

        .btn-login:hover::before {
            opacity: 1;
        }

    .btn-login:active {
        transform: translateY(1px) scale(0.98);
        box-shadow: 0 3px 12px rgba(179, 111, 164, 0.35);
    }

    /* Ripple on click */
    .btn-login .ripple {
        position: absolute;
        border-radius: 50%;
        background: rgba(255,255,255,0.35);
        transform: scale(0);
        animation: rippleAnim 0.6s linear;
        pointer-events: none;
    }

@keyframes rippleAnim {
    to {
        transform: scale(4);
        opacity: 0;
    }
}

/* Loading state */
.btn-login.loading {
    pointer-events: none;
    opacity: 0.85;
}

.btn-login .btn-text {
    transition: opacity 0.2s;
}

.btn-login .btn-loader {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s;
}

.btn-login.loading .btn-text {
    opacity: 0;
}

.btn-login.loading .btn-loader {
    opacity: 1;
}

.spinner {
    width: 22px;
    height: 22px;
    border: 2.5px solid rgba(255,255,255,0.35);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ============================================================
   ALERTA DE ERROR
   ============================================================ */
.login-alert {
    margin-top: 16px;
    padding: 13px 16px;
    border-radius: 12px;
    background: linear-gradient(135deg, #fde8e8, #fdf0f0);
    border: 1px solid rgba(220, 80, 80, 0.2);
    color: #c0392b;
    font-size: 0.86rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 8px;
    opacity: 0;
    transform: translateY(-8px) scale(0.97);
    transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

    .login-alert.show {
        opacity: 1;
        transform: translateY(0) scale(1);
    }

/* ============================================================
   ENLACE OLVIDÉ CONTRASEÑA
   ============================================================ */
.recovery-link {
    display: block;
    text-align: center;
    margin-top: 18px;
    color: #B36FA4;
    font-size: 0.82rem;
    font-weight: 500;
    text-decoration: none;
    letter-spacing: 0.2px;
    position: relative;
    transition: color 0.2s;
}

    .recovery-link::after {
        content: '';
        position: absolute;
        bottom: -2px;
        left: 50%;
        width: 0;
        height: 1.5px;
        background: #B36FA4;
        transform: translateX(-50%);
        transition: width 0.3s;
    }

    .recovery-link:hover::after {
        width: 80%;
    }

    .recovery-link:hover {
        color: #9a5a8e;
    }

/* ============================================================
   DIVISOR
   ============================================================ */
.divider {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 20px 0 0;
    color: #c0b0be;
    font-size: 0.75rem;
}

    .divider::before, .divider::after {
        content: '';
        flex: 1;
        height: 1px;
        background: linear-gradient(to right, transparent, #e0d0de, transparent);
    }

/* ============================================================
   FOOTER
   ============================================================ */
.login-footer {
    margin-top: 24px;
    text-align: center;
    color: rgba(100, 70, 90, 0.7);
    font-size: 0.75rem;
    line-height: 1.6;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 480px) {
    .login-container {
        padding: 12px;
    }

    .login-header {
        padding: 32px 24px 28px;
    }

    .login-body {
        padding: 28px 24px 24px;
    }

    .login-header h2 {
        font-size: 1.4rem;
    }

    .role-badge {
        font-size: 0.68rem;
        padding: 3px 10px;
    }
}


@keyframes shakeInput {
    0%, 100% {
        transform: translateX(0);
    }

    18% {
        transform: translateX(-6px);
    }

    36% {
        transform: translateX(6px);
    }

    54% {
        transform: translateX(-4px);
    }

    72% {
        transform: translateX(4px);
    }
}

.shake-field {
    animation: shakeInput 0.45s ease;
}
