/* Reset de Scroll Global - Simplificado y Robusto */
html,
body {
    margin: 0;
    padding: 0;
    width: 100%;
    min-height: 100%;
    /* Dejar el overflow en auto por defecto permite el comportamiento nativo */
    overflow-x: hidden;
    /* Solo evitar scroll horizontal */
    background-color: var(--bg);
    font-family: var(--font-main);
}

/* Contenedor Principal */
.auth-page {
    width: 100%;
    min-height: 100dvh;
    /* Dynamic viewport height para móviles */
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 4rem 1.5rem;
    /* Padding generoso */
    position: relative;
    /* IMPORTANTE: No definir overflow aquí para evitar scroll traps */
}

/* Background Abstracto */
.auth-page::before {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    background:
        radial-gradient(circle at 10% 20%, rgba(0, 123, 255, 0.15) 0%, transparent 40%),
        radial-gradient(circle at 90% 80%, rgba(108, 99, 255, 0.1) 0%, transparent 40%);
    z-index: -1;
    pointer-events: none;
}

/* Tarjeta Glassmorphism Premium */
.auth-card {
    background: rgba(30, 30, 35, 0.7);
    /* Base oscura semi-transparente */
    border: 1px solid rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(25px);
    /* Desenfoque potente */
    -webkit-backdrop-filter: blur(25px);
    width: 100%;
    max-width: 480px;
    /* Un poco más ancha */
    padding: 2.5rem;
    border-radius: 24px;
    box-shadow:
        0 20px 40px rgba(0, 0, 0, 0.4),
        0 0 0 1px rgba(255, 255, 255, 0.05) inset;
    animation: fadeInUp 0.6s cubic-bezier(0.2, 0.8, 0.2, 1);
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Headers */
.auth-header {
    text-align: center;
    margin-bottom: 2rem;
}

.auth-header .logo {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.5rem;
    font-weight: 700;
    color: #fff;
    text-decoration: none;
    margin-bottom: 1rem;
}

.auth-header .logo span {
    color: var(--primary);
}

.auth-header h2 {
    font-size: 1.75rem;
    font-weight: 700;
    color: #fff;
    margin-bottom: 0.5rem;
    letter-spacing: -0.5px;
}

.auth-header p {
    color: var(--text-muted);
    font-size: 0.95rem;
}

/* Formularios */
.form-group {
    margin-bottom: 1.25rem;
}

.form-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: #e0e0e0;
    margin-left: 0.25rem;
}

.form-control {
    width: 100%;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 0.9rem 1rem;
    border-radius: 12px;
    color: white;
    font-family: inherit;
    font-size: 0.95rem;
    transition: all 0.2s ease;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    background: rgba(0, 0, 0, 0.3);
    box-shadow: 0 0 0 4px rgba(0, 123, 255, 0.15);
    transform: translateY(-1px);
}

.form-control::placeholder {
    color: rgba(255, 255, 255, 0.3);
}

/* Selects */
select.form-control {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='rgba(255,255,255,0.7)' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    background-size: 1em;
    padding-right: 2.5rem;
}

/* Botones */
.btn {
    border: none;
    cursor: pointer;
    font-weight: 600;
    border-radius: 12px;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    font-size: 1rem;
    box-shadow: 0 4px 15px rgba(0, 123, 255, 0.3);
}

.btn-primary:hover {
    box-shadow: 0 6px 20px rgba(0, 123, 255, 0.4);
    transform: translateY(-1px);
}

.btn-primary:active {
    transform: translateY(1px);
}

.btn-outline {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: #fff;
    padding: 0.7rem;
    font-size: 0.9rem;
}

.btn-outline:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.3);
}

/* Footer */
.auth-footer {
    text-align: center;
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    font-size: 0.9rem;
    color: var(--text-muted);
}

.auth-footer a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
    transition: color 0.2s;
}

.auth-footer a:hover {
    color: #4da3ff;
    text-decoration: underline;
}

/* Alertas */
.alert {
    padding: 1rem;
    border-radius: 12px;
    margin-bottom: 1.5rem;
    font-size: 0.9rem;
    display: none;
    text-align: left;
    line-height: 1.5;
}

.alert-success {
    background: rgba(16, 185, 129, 0.2);
    border: 1px solid rgba(16, 185, 129, 0.3);
    color: #6ee7b7;
}

.alert-danger {
    background: rgba(239, 68, 68, 0.2);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #fca5a5;
}

/* Responsive */
@media (max-width: 480px) {
    .auth-page {
        padding: 1rem;
        /* Scroll: asegurar que en móviles muy pequeños haya espacio */
        align-items: flex-start;
        /* Permite scroll arriba si es necesario */
    }

    .auth-card {
        padding: 1.5rem;
        margin-top: 2rem;
        /* Espacio para el top */
        margin-bottom: 2rem;
    }

    .auth-header h2 {
        font-size: 1.5rem;
    }
}