/* RESET GENERAL */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Arial', sans-serif;
    min-height: 100vh;
    background: linear-gradient(-45deg, #eaf4fc, #0353a1, #002855, #013e7d);
    background-size: 400% 400%;
    animation: gradientBG 6s ease infinite;
    color: #002855;
}

@keyframes gradientBG {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

.login-container {
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
}

.login-form {
    background: #fff;
    padding: 44px 36px 36px 36px;
    border-radius: 32px;
    box-shadow: 0 8px 40px 0 rgba(33,52,123,0.12), 0 1.5px 4px rgba(33,52,123,0.10);
    max-width: 380px;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.logo {
    width: 250px;      /* o 300px, o el tamaño que quieras */
    max-width: 100%;
    margin-bottom: 40px;
    display: block;
}

h2 {
    margin-bottom: 22px;
    margin-top: 0;
    font-size: 1rem;
    color: #7e8294;
    font-weight: 400;
    letter-spacing: 0.5px;
}

h1 {
    margin-bottom: 6px;
    font-size: 1.6rem;
    font-weight: 400;
    color: #013e7d;
    letter-spacing: 0.5px;
}

.input-group {
    position: relative;
    width: 100%;
    margin-bottom: 22px;
}

.input-group input {
    width: 100%;
    padding: 14px 48px 14px 40px;  /* Espacio para íconos */
    border: 1.5px solid #dde5ec;
    border-radius: 30px;
    font-size: 1rem;
    background: #f8fafc;
    color: #002855;
    transition: border-color 0.25s, box-shadow 0.25s;
    box-shadow: 0 1.5px 5px rgba(33,52,123,0.03);
}

.input-group input:focus {
    border-color: #3078c2;
    box-shadow: 0 0 0 2px #0353a132;
    outline: none;
}

/* Ícono de usuario/candado a la izquierda */
/* Íconos del input (usuario, correo, candado, etc.) */
.input-group > i {
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: #0353a1;
    font-size: 1.13em;
    z-index: 2;
    pointer-events: none;
}

/* Ícono de ojo (toggle password) a la derecha */
.toggle-password {
    position: absolute;
    right: 18px;
    top: 50%;
    transform: translateY(-50%);
    cursor: pointer;
    color: #0353a1;
    font-size: 1.22em;
    z-index: 4;
    background: transparent;
    border: none;
    outline: none;
    display: flex;
    align-items: center;
    line-height: 1;
    user-select: none;
    transition: color 0.15s;
}

.toggle-password:focus,
.toggle-password:hover {
    color: #013e7d;
}

/* Solo el campo password tiene padding extra a la derecha */
.input-group input[type="password"] {
    padding-right: 48px;
}

.input-group input[type="email"] {
    padding-left: 38px;
}

.input-group input:disabled,
.btn-login:disabled {
    opacity: 0.66;
    cursor: not-allowed;
}


/* Opciones de recordar contraseña y link de recuperación */
.options {
    width: 100%;
    display: flex;
    justify-content: space-between;
    margin-bottom: 18px;
    font-size: 0.96rem;
}

.options a {
    color: #0353a1;
    text-decoration: none;
    position: relative;
    transition: color 0.3s ease;
}

.options a:hover {
    color: #013e7d;
}

.options a::after {
    content: "";
    position: absolute;
    left: 0;
    bottom: -2px;
    width: 0%;
    height: 2px;
    background: #013e7d;
    transition: width 0.3s ease;
}

.options a:hover::after {
    width: 100%;
}

/* Botón de inicio de sesión */
.btn-login {
    width: 100%;
    padding: 14px;
    background: linear-gradient(90deg, #0353a1 0%, #3078c2 100%);
    color: #fff;
    border: none;
    border-radius: 30px;
    font-size: 1.09rem;
    font-weight: 600;
    cursor: pointer;
    margin-top: 6px;
    box-shadow: 0 1.5px 4px rgba(33,52,123,0.09);
    transition: background 0.3s, transform 0.2s;
    position: relative;
}

.btn-login:hover {
    background: linear-gradient(90deg, #013e7d 0%, #3078c2 100%);
    transform: translateY(-2px) scale(1.025);
}

/* Mensaje de error/success SweetAlert2 */
.swal2-popup {
    border-radius: 25px !important;
}

/* Responsivo */
@media (max-width: 500px) {
    .login-form {
        padding: 26px 3vw 18px 3vw;
        max-width: 98vw;
    }
    .logo {
        width: 250px;
    }
    .btn-login {
        font-size: 1rem;
        padding: 12px;
    }
    .input-group input {
        font-size: 0.98rem;
    }
}

/* Bloque: Link de registro */
.register-link {
    margin-top: 22px;
    width: 100%;
    text-align: center;
    font-size: 1rem;
}
.register-link a {
    color: #0353a1;
    text-decoration: none;
    position: relative;
    transition: color 0.3s ease;
}

.register-link a:hover {
    color: #013e7d;
}

.register-link a::after {
    content: "";
    position: absolute;
    left: 0;
    bottom: -2px;
    width: 0%;
    height: 2px;
    background: #013e7d;
    transition: width 0.3s ease;
}

.register-link a:hover::after {
    width: 100%;
}

/* Bloque: Redes sociales */
.social-login {
    margin-top: 18px;
    text-align: center;
    width: 100%;
}

.social-login p {
    font-size: 0.97rem;
    color: #002855;
    margin-bottom: 8px;
    font-weight: 600;
    letter-spacing: 0.4px;
}

.social-login a {
    margin: 0 9px;
    color: #0353a1;
    font-size: 1.45rem;
    text-decoration: none;
    display: inline-block;
    transition: transform 0.23s, color 0.23s;
    border-radius: 50%;
    padding: 4px;
}

.social-login a:hover {
    transform: scale(1.18) rotate(8deg);
    color: #fff;
    background: linear-gradient(90deg, #3078c2 0%, #0353a1 100%);
    box-shadow: 0 3px 14px #3078c225;
}

.spinner {
  display: none;
  position: absolute;
  right: 22px;
  top: 52%;
  transform: translateY(-50%);
  width: 22px;
  height: 22px;
  border: 3px solid #f8fafc;
  border-top: 3px solid #0353a1;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  z-index: 2;
}
.spinner.active {
  display: inline-block;
}
@keyframes spin {
  to { transform: translateY(40%) rotate(360deg); }
}

.fade-in {
    animation: fadein 0.6s ease;
}

@keyframes fadein {
    from { opacity: 0; transform: translateY(-20px);}
    to { opacity: 1; transform: none;}
}

/* ===============================
   🚀 RESPONSIVE OPTIMIZADO PARA MÓVIL
   =============================== */
@media (max-width: 768px) {

    body {
        background-size: 300% 300%;
        padding: 0 14px;
    }

    .login-container {
        padding-top: 20px;
        padding-bottom: 20px;
        align-items: flex-start; /* baja el formulario para móviles */
    }

    .login-form {
        padding: 28px 22px 26px 22px;
        max-width: 100%;
        width: 100%;
        border-radius: 22px;
        box-shadow: 0 6px 28px rgba(33,52,123,0.18);
    }

    .logo {
        width: 200px !important;
        margin-bottom: 24px !important;
    }

    h1 {
        font-size: 1.35rem;
    }

    h2 {
        font-size: 0.95rem;
        margin-bottom: 16px;
    }

    .input-group input {
        padding: 13px 45px 13px 42px;
        font-size: 0.95rem;
    }

    .input-group > i {
        font-size: 1.05rem;
        left: 14px;
    }

    .toggle-password {
        font-size: 1.1rem;
        right: 14px;
    }

    .btn-login {
        padding: 13px;
        font-size: 1.02rem;
        border-radius: 26px;
    }
}

/* ===============================
   📱 EXTRA PEQUEÑOS (iPhone SE / Android mini)
   =============================== */
@media (max-width: 420px) {

    .login-form {
        padding: 22px 16px 20px 16px;
    }

    .logo {
        width: 170px !important;
    }

    h1 {
        font-size: 1.2rem;
    }

    .input-group input {
        font-size: 0.9rem;
        padding: 12px 40px;
    }
}
