/* Neumorphism Login Form - Blue Minimal Gradient Theme (con errores animados) */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: linear-gradient(135deg, #dbe9ff, #b3cfff);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    line-height: 1.6;
}

.login-container {
    width: 100%;
    max-width: 420px;
}

.login-card {
    background: linear-gradient(145deg, #c2d8ff, #e6f0ff);
    border-radius: 30px;
    padding: 50px 40px;
    box-shadow:
        20px 20px 60px rgba(30, 60, 100, 0.15),
        -20px -20px 60px rgba(255, 255, 255, 0.9);
    position: relative;
    transition: all 0.3s ease;
}

.login-card:hover {
    transform: translateY(-5px);
}

.login-header {
    text-align: center;
    margin-bottom: 40px;
}

.neu-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto 24px;
    background: linear-gradient(145deg, #c9ddff, #eaf3ff);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow:
        8px 8px 20px rgba(30, 60, 100, 0.15),
        -8px -8px 20px rgba(255, 255, 255, 0.9);
    transition: all 0.3s ease;
}

.neu-icon:hover {
    box-shadow:
        4px 4px 10px rgba(30, 60, 100, 0.15),
        -4px -4px 10px rgba(255, 255, 255, 0.9),
        inset 4px 4px 10px rgba(30, 60, 100, 0.05),
        inset -4px -4px 10px rgba(255, 255, 255, 0.9);
}

.icon-inner {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #375a8c;
}

.icon-inner svg {
    width: 100%;
    height: 100%;
}

.login-header h2 {
    color: #2b4470;
    font-size: 2rem;
    font-weight: 600;
    margin-bottom: 8px;
}

.login-header p {
    color: #6880aa;
    font-size: 15px;
    font-weight: 400;
}

/* ===== Inputs ===== */
.form-group {
    margin-bottom: 28px;
    position: relative;
}

.neu-input {
    position: relative;
    background: linear-gradient(145deg, #d3e2ff, #f2f7ff);
    border-radius: 15px;
    box-shadow:
        inset 8px 8px 16px rgba(30, 60, 100, 0.12),
        inset -8px -8px 16px rgba(255, 255, 255, 0.8);
    transition: all 0.3s ease;
}

.neu-input:focus-within {
    box-shadow:
        inset 4px 4px 8px rgba(30, 60, 100, 0.15),
        inset -4px -4px 8px rgba(255, 255, 255, 0.9);
}

.neu-input input {
    width: 100%;
    background: transparent;
    border: none;
    padding: 20px 24px;
    padding-left: 55px;
    color: #2b4470;
    font-size: 16px;
    font-weight: 500;
    outline: none;
    transition: all 0.3s ease;
}

.neu-input input::placeholder {
    color: transparent;
}

.neu-input label {
    position: absolute;
    left: 55px;
    top: 50%;
    transform: translateY(-50%);
    color: #6f8ab8;
    font-size: 16px;
    font-weight: 400;
    pointer-events: none;
    transition: all 0.3s ease;
}

.neu-input input:focus + label,
.neu-input input:not(:placeholder-shown) + label {
    top: 8px;
    font-size: 12px;
    color: #375a8c;
    transform: translateY(0);
}

.input-icon {
    position: absolute;
    left: 20px;
    top: 50%;
    transform: translateY(-50%);
    width: 20px;
    height: 20px;
    color: #6f8ab8;
    transition: all 0.3s ease;
}

.input-icon svg {
    width: 100%;
    height: 100%;
}

.neu-input:focus-within .input-icon {
    color: #375a8c;
}

/* ===== Toggle contraseña ===== */
.password-group {
    padding-right: 50px;
}

.neu-toggle {
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    background: linear-gradient(145deg, #d3e2ff, #f2f7ff);
    border: none;
    width: 35px;
    height: 35px;
    border-radius: 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #6f8ab8;
    box-shadow:
        4px 4px 10px rgba(30, 60, 100, 0.15),
        -4px -4px 10px rgba(255, 255, 255, 0.9);
    transition: all 0.3s ease;
}

.neu-toggle:hover {
    color: #375a8c;
}

.neu-toggle:active {
    box-shadow:
        inset 2px 2px 5px rgba(30, 60, 100, 0.15),
        inset -2px -2px 5px rgba(255, 255, 255, 0.9);
}

.neu-toggle svg {
    width: 18px;
    height: 18px;
}

.eye-closed { display: none; }
.neu-toggle.show-password .eye-open { display: none; }
.neu-toggle.show-password .eye-closed { display: block; }

/* ===== Opciones del formulario ===== */
.form-options {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 35px;
    flex-wrap: wrap;
    gap: 16px;
}

.remember-wrapper { display: flex; align-items: center; cursor: pointer; }
.remember-wrapper input[type="checkbox"] { display: none; }

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    user-select: none;
    color: #375a8c;
    font-size: 14px;
    font-weight: 500;
}

.neu-checkbox {
    width: 22px;
    height: 22px;
    background: linear-gradient(145deg, #d3e2ff, #f2f7ff);
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow:
        3px 3px 8px rgba(30, 60, 100, 0.15),
        -3px -3px 8px rgba(255, 255, 255, 0.9);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.remember-wrapper input[type="checkbox"]:checked + .checkbox-label .neu-checkbox {
    box-shadow:
        inset 2px 2px 5px rgba(30, 60, 100, 0.15),
        inset -2px -2px 5px rgba(255, 255, 255, 0.9);
}

.neu-checkbox svg {
    width: 14px;
    height: 14px;
    color: #00c896;
    opacity: 0;
    transform: scale(0);
    transition: all 0.3s ease;
}

.remember-wrapper input[type="checkbox"]:checked + .checkbox-label .neu-checkbox svg {
    opacity: 1;
    transform: scale(1);
}

.forgot-link {
    color: #375a8c;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: color 0.3s ease;
}

.forgot-link:hover { color: #2b4470; }

/* ===== Botón ===== */
.neu-button {
    width: 100%;
    background: linear-gradient(145deg, #c2d8ff, #e6f0ff);
    border: none;
    border-radius: 15px;
    padding: 18px 32px;
    color: #2b4470;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    position: relative;
    margin-bottom: 30px;
    box-shadow:
        8px 8px 20px rgba(30, 60, 100, 0.15),
        -8px -8px 20px rgba(255, 255, 255, 0.9);
    transition: all 0.3s ease;
    overflow: hidden;
}

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

.neu-button:hover {
    transform: translateY(-2px);
    box-shadow:
        12px 12px 30px rgba(30, 60, 100, 0.2),
        -12px -12px 30px rgba(255, 255, 255, 0.95);
}

.neu-button:hover::before { left: 100%; }

.neu-button:active {
    transform: translateY(0);
    box-shadow:
        inset 4px 4px 10px rgba(30, 60, 100, 0.2),
        inset -4px -4px 10px rgba(255, 255, 255, 0.9);
}

.btn-text { position: relative; z-index: 1; transition: opacity 0.3s ease; }
.btn-loader {
    position: absolute; top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    opacity: 0; transition: opacity 0.3s ease;
}

.neu-spinner {
    width: 20px; height: 20px;
    border: 3px solid rgba(30, 60, 100, 0.2);
    border-top: 3px solid #375a8c;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin { 0% { transform: rotate(0deg);} 100% { transform: rotate(360deg);} }

.neu-button.loading .btn-text { opacity: 0; }
.neu-button.loading .btn-loader { opacity: 1; }

/* ===== Divider / Social (por si lo usas) ===== */
.divider { display: flex; align-items: center; margin: 30px 0; gap: 16px; }
.divider-line { flex: 1; height: 2px; background: linear-gradient(90deg, transparent, rgba(190, 195, 207, .8), transparent); }
.divider span {
    color: #6f8ab8; font-size: 13px; font-weight: 500;
    text-transform: uppercase; letter-spacing: 1px;
}

.social-login { display: flex; justify-content: center; gap: 16px; margin-bottom: 30px; }
.neu-social {
    width: 50px; height: 50px;
    background: linear-gradient(145deg, #d3e2ff, #f2f7ff);
    border: none; border-radius: 15px; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    color: #375a8c;
    box-shadow:
        6px 6px 15px rgba(30, 60, 100, 0.15),
        -6px -6px 15px rgba(255, 255, 255, 0.9);
    transition: all 0.3s ease;
}
.neu-social:hover {
    transform: translateY(-2px);
    box-shadow:
        8px 8px 20px rgba(30, 60, 100, 0.2),
        -8px -8px 20px rgba(255, 255, 255, 0.95);
}
.neu-social:active {
    transform: translateY(0);
    box-shadow:
        inset 3px 3px 8px rgba(30, 60, 100, 0.2),
        inset -3px -3px 8px rgba(255, 255, 255, 0.9);
}
.neu-social svg { width: 22px; height: 22px; }

.signup-link { text-align: center; }
.signup-link p { color: #6f8ab8; font-size: 14px; }
.signup-link a {
    color: #375a8c; text-decoration: none; font-weight: 600; transition: color 0.3s ease;
}
.signup-link a:hover { color: #2b4470; }

/* ===== Mensaje de éxito ===== */
.success-message {
    display: none;
    text-align: center;
    padding: 40px 20px;
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.5s ease;
}

.success-message.show { display: block; opacity: 1; transform: translateY(0); }

.success-message .neu-icon {
    background: linear-gradient(145deg, #c2d8ff, #e6f0ff);
    color: #0094ff;
    margin-bottom: 20px;
}

.success-message h3 { color: #2b4470; font-size: 1.5rem; margin-bottom: 8px; }
.success-message p { color: #6880aa; font-size: 14px; }

/* ===== Estados de error (restaurados y optimizados) ===== */
.error-message {
    color: #ff3b5c;
    font-size: 12px;
    font-weight: 500;
    margin-top: 8px;
    margin-left: 20px;
    opacity: 0;
    transform: translateY(-10px);
    transition: all 0.3s ease;
}

.error-message.show {
    opacity: 1;
    transform: translateY(0);
}

.form-group.error .neu-input {
    background: linear-gradient(145deg, #ffdfe4, #fff3f4);
    box-shadow:
        inset 8px 8px 16px rgba(255, 90, 120, 0.25),
        inset -8px -8px 16px #ffffff,
        0 0 0 2px #ff3b5c;
    animation: gentleShake 0.5s ease-in-out;
}

/* (extra) Si por alguna razón el JS no inyecta la animación, la definimos aquí también */
@keyframes gentleShake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-4px); }
    75% { transform: translateX(4px); }
}

/* ===== Responsive ===== */
@media (max-width: 480px) {
    body { padding: 16px; }
    .login-card { padding: 35px 25px; border-radius: 20px; }
    .login-header h2 { font-size: 1.75rem; }
    .neu-input input { padding: 18px 20px; padding-left: 50px; }
    .neu-input label { left: 50px; }
    .form-options { flex-direction: column; align-items: flex-start; gap: 16px; }
}

/* Fix: conservar esquinas redondeadas en cualquier estado */
.neu-input,
.neu-input:focus-within,
.form-group.error .neu-input {
  border-radius: 15px;       /* fuerza el radio */
  overflow: hidden;          /* recorta el glow rojo dentro del radio */
}

/* (opcional) suaviza el contenido interno por si algún navegador dibuja esquinas del input */
.neu-input input {
  border-radius: 14px;
}

/* Fix: estabilizar el botón de ver contraseña */
.password-group { position: relative; }  /* ya lo tienes, reforzamos */

.neu-toggle {
  top: 50%;
  transform: translateY(-50%) translateZ(0);  /* fija su centro y evita jank */
  transition: box-shadow 0.25s ease, color 0.25s ease;  /* sin transición de transform */
  will-change: box-shadow;
}

/* Cuando se hace click, mantenemos la misma posición (sin escala) */
.neu-toggle:active {
  transform: translateY(-50%) translateZ(0);
}

/* --- Error visible al primer intento --- */
.error-message {
  display: block;            /* ocupa su línea desde el inicio */
  min-height: 16px;          /* reserva espacio (evita salto) */
  visibility: hidden;        /* oculto pero con layout */
  opacity: 0;
  transform: translateY(-6px);
  transition: opacity .25s ease, transform .25s ease, visibility 0s linear .25s;
}

.error-message.show {
  visibility: visible;       /* aparece de inmediato */
  opacity: 1;
  transform: translateY(0);
  transition-delay: 0s;      /* sin retraso */
}

/* --- Mantener bordes redondeados SIEMPRE --- */
.neu-input,
.neu-input:focus-within,
.form-group.error .neu-input {
  border-radius: 15px;
  overflow: hidden;          /* el glow rojo respeta el radio */
}

/* --- Separación entre label y texto escrito --- */
.neu-input input {
  padding-top: 24px;         /* + espacio arriba del texto */
  padding-bottom: 18px;
}

.neu-input label {
  top: 52%;                  /* label centrado cuando está "grande" */
}

/* Cuando el label flota (focus o hay texto), súbelo un poco más */
.neu-input input:focus + label,
.neu-input input:not(:placeholder-shown) + label {
  top: 4px;                  /* antes estaba a 8px */
  font-size: 12px;
}

/* --- Estabilizar el botón del "ojito" (por si faltaba) --- */
.neu-toggle {
  transform: translateY(-50%) translateZ(0);
  transition: box-shadow .25s ease, color .25s ease; /* sin transición de transform */
  will-change: box-shadow;
}
.neu-toggle:active {
  transform: translateY(-50%) translateZ(0);
}
