/**
 * Authentication Pages Styles
 * Styles for login, register, and password reset pages
 */

/* Auth Page Layout */
.auth-page {
    min-height: calc(100vh - 200px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem 0;
    background: linear-gradient(135deg, var(--bg-primary) 0%, var(--bg-secondary) 100%);
}

.auth-footer {
    text-align: center;
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.auth-footer a {
    color: #667eea;
    text-decoration: none;
}


.auth-footer a:hover {
    text-decoration: underline;
}

.auth-container--wide {
    max-width: 760px;
}

.auth-header .subtitle {
    max-width: 720px;
    margin: 0 auto 2rem;
}

.auth-container--compact {
    padding: 2rem;
}

.auth-container--compact .auth-header {
    margin-bottom: 1rem;
}

.auth-container--compact .main-title {
    font-size: clamp(2rem, 4vw, 3rem);
    margin-bottom: 0.5rem;
}

.auth-container--compact .subtitle {
    margin-bottom: 1.25rem;
}

.auth-container--compact .auth-form {
    gap: 1rem;
}

.auth-container--compact .form-group {
    gap: 0.35rem;
}

.auth-container--compact .form-group input {
    padding: 0.6rem 0.9rem;
}


@media (min-width: 768px) {
    .auth-form--2col {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        column-gap: 1.25rem;
        row-gap: 1rem;
    }

    .auth-form--2col > .form-group:last-of-type,
    .auth-form--2col > .cta-button {
        grid-column: 1 / -1;
    }
}

.auth-page {
    padding: 120px 0 80px;
}

.auth-header .main-title {
    font-size: clamp(2.25rem, 4vw, 3.25rem);
    margin-bottom: 0.75rem;
}

.auth-header .subtitle {
    max-width: 720px;
    margin: 0 auto 2rem;
}


.auth-card {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 2.5rem;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.1);
    text-align: center;
}

.auth-header {
    text-align: center;
    margin-bottom: 2rem;
}

/* Auth Form */
.auth-form {
    text-align: left;
}

/* Password Field */
.password-field {
    position: relative;
}

.password-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.password-input-wrapper input {
    padding-right: 3rem;
    width: 100%;
}

.password-toggle {
    position: absolute;
    right: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0.25rem;
    transition: color 0.2s ease;
    z-index: 10;
}

.password-toggle:hover {
    color: var(--text-primary);
}

/* Error Messages */
.form-group .error-message {
    display: block;
    color: #ef4444;
    font-size: 0.75rem;
    margin-top: 0.5rem;
    margin-bottom: 0;
    line-height: 1.4;
}

.form-group.has-error input,
.form-group.has-error .password-input-wrapper input {
    border-color: #ef4444;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1);
}

/* Password field specific error styling */
.password-field .error-message {
    margin-top: 0.5rem;
    clear: both;
}

/* Form group spacing */
.form-group {
    margin-bottom: 1.5rem;
}

.form-group:last-child {
    margin-bottom: 0;
}

/* Small text styling */
.form-group small {
    display: block;
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
    margin-bottom: 0;
}

/* Ensure error messages appear below small text */
.form-group small + .error-message {
    margin-top: 0.25rem;
}

/* Remember Me Checkbox */
.checkbox-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
}

.checkbox-group input[type="checkbox"] {
    width: auto;
    margin: 0;
}

.checkbox-group label {
    margin: 0;
    font-size: 0.875rem;
    color: var(--text-secondary);
    cursor: pointer;
}

/* Auth Buttons */
.auth-button {
    width: 100%;
    padding: 0.875rem 1rem;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-bottom: 1rem;
}

.auth-button:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
}

.auth-button:active {
    transform: translateY(0);
}

.auth-button:disabled {
    background: var(--text-tertiary);
    cursor: not-allowed;
    transform: none;
}

/* Loading State */
.auth-button.loading {
    position: relative;
    color: transparent;
}

.auth-button.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top: 2px solid white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Auth Links */
.auth-links {
    text-align: center;
    margin-top: 1.5rem;
}

.auth-links a {
    color: var(--primary-color);
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 500;
    transition: color 0.2s ease;
}

.auth-links a:hover {
    color: var(--primary-dark);
    text-decoration: underline;
}

.auth-divider {
    margin: 1.5rem 0;
    text-align: center;
    position: relative;
}

.auth-divider::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 1px;
    background: var(--border-color);
}

.auth-divider span {
    background: var(--bg-primary);
    padding: 0 1rem;
    color: var(--text-secondary);
    font-size: 0.875rem;
}

/* Social Login Buttons */
.social-login {
    margin-bottom: 1.5rem;
}

.social-button {
    width: 100%;
    padding: 0.875rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.social-button:hover {
    border-color: var(--primary-color);
    background: var(--bg-secondary);
}

.social-button:last-child {
    margin-bottom: 0;
}

/* Alert Messages */
.alert {
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1.5rem;
    font-size: 0.875rem;
    font-weight: 500;
}

.alert-success {
    background: var(--success-light);
    color: var(--success-color);
    border: 1px solid var(--success-color);
}

.alert-error {
    background: var(--error-light);
    color: var(--error-color);
    border: 1px solid var(--error-color);
}

.alert-warning {
    background: var(--warning-light);
    color: var(--warning-color);
    border: 1px solid var(--warning-color);
}

.alert-info {
    background: var(--info-light);
    color: var(--info-color);
    border: 1px solid var(--info-color);
}

/* Password Strength Indicator */
.password-strength {
    margin-top: 0.5rem;
}

.strength-bar {
    height: 4px;
    background: var(--border-light);
    border-radius: 2px;
    overflow: hidden;
    margin-bottom: 0.5rem;
}

.strength-fill {
    height: 100%;
    transition: all 0.3s ease;
    border-radius: 2px;
}

.strength-weak .strength-fill {
    width: 25%;
    background: var(--error-color);
}

.strength-fair .strength-fill {
    width: 50%;
    background: var(--warning-color);
}

.strength-good .strength-fill {
    width: 75%;
    background: var(--info-color);
}

.strength-strong .strength-fill {
    width: 100%;
    background: var(--success-color);
}

.strength-text {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

/* Terms and Privacy */
.terms-text {
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-align: center;
    line-height: 1.4;
    margin-top: 1rem;
}

.terms-text a {
    color: var(--primary-color);
    text-decoration: none;
}

.terms-text a:hover {
    text-decoration: underline;
}

/* Responsive Design */
@media (max-width: 480px) {
    .auth-page {
        padding: 1rem 0;
    }
    
    .auth-card {
        padding: 2rem 1.5rem;
        margin: 0 1rem;
    }
    
    .auth-header h1 {
        font-size: 1.75rem;
    }
}

@media (min-width: 768px) {
    .auth-form--2col {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        column-gap: 1.25rem;
        row-gap: 1rem;
    }

    .auth-form--2col > .form-group:last-of-type,
    .auth-form--2col > .cta-button {
        grid-column: 1 / -1;
    }

    .auth-form--2col > .form-group--full {
        grid-column: 1 / -1;
    }
}

/* ==========================================================================
   Tarjeta de autenticación (login / registro / recuperación)
   ========================================================================== */
.auth-container {
    position: relative;
    width: 100%;
    max-width: 440px;
    margin: 0 auto;
    padding: 2.75rem 2.5rem;
    background: rgba(255, 255, 255, 0.035);
    border: 1px solid rgba(148, 163, 184, 0.14);
    border-radius: 20px;
    backdrop-filter: blur(14px);
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.35);
}

/* Resplandor superior de la tarjeta */
.auth-container::before {
    content: "";
    position: absolute;
    inset: -1px -1px auto -1px;
    height: 120px;
    border-radius: 20px 20px 0 0;
    background: radial-gradient(60% 100% at 50% 0%, rgba(102, 126, 234, 0.18) 0%, rgba(102, 126, 234, 0) 100%);
    pointer-events: none;
}

.auth-container--wide {
    max-width: 760px;
}

.auth-container > * {
    position: relative;
    z-index: 1;
}

.auth-header .main-title {
    font-size: clamp(2rem, 4vw, 2.75rem);
    margin-bottom: 0.5rem;
}

.auth-header .subtitle {
    color: var(--text-muted);
    font-size: 1rem;
    margin: 0 auto 0;
}

/* Espaciado del formulario */
.auth-form .form-group {
    margin-bottom: 1.35rem;
}

.auth-form .cta-button.full-width {
    margin-top: 0.5rem;
    padding: 0.9rem 1rem;
    font-size: 1rem;
}

/* Evita el fondo amarillo del autocompletado del navegador en tema oscuro */
.auth-form input:-webkit-autofill,
.auth-form input:-webkit-autofill:hover,
.auth-form input:-webkit-autofill:focus,
.auth-form input:-webkit-autofill:active {
    -webkit-text-fill-color: var(--text-light);
    caret-color: var(--text-light);
    -webkit-box-shadow: 0 0 0 1000px rgba(20, 28, 46, 0.96) inset;
    box-shadow: 0 0 0 1000px rgba(20, 28, 46, 0.96) inset;
    border-color: rgba(255, 255, 255, 0.2);
    transition: background-color 9999s ease-in-out 0s;
}

/* Checkbox "Recordarme" personalizado */
.checkbox-label {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 400;
    color: var(--text-muted);
    user-select: none;
}

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

.checkbox-label .checkmark {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 19px;
    height: 19px;
    border: 1px solid rgba(148, 163, 184, 0.4);
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.04);
    transition: background 0.2s ease, border-color 0.2s ease;
}

.checkbox-label .checkmark::after {
    content: "";
    width: 5px;
    height: 9px;
    border: solid #fff;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg) scale(0);
    transition: transform 0.15s ease;
}

.checkbox-label input[type="checkbox"]:checked + .checkmark {
    background: var(--gradient-primary);
    border-color: transparent;
}

.checkbox-label input[type="checkbox"]:checked + .checkmark::after {
    transform: rotate(45deg) scale(1);
}

.checkbox-label input[type="checkbox"]:focus-visible + .checkmark {
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.3);
}

/* Pie con enlaces */
.auth-footer p {
    margin: 0.5rem 0;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.auth-footer a {
    color: var(--primary-color);
    font-weight: 500;
    transition: color 0.2s ease;
}

.auth-footer a:hover {
    color: #7dd3fc;
    text-decoration: none;
}

@media (max-width: 480px) {
    .auth-container {
        padding: 2rem 1.5rem;
        border-radius: 16px;
    }
}
