/* Auth experience - Updated to match the High-End Lavender Academic theme */

/*
 * style.css locks body to height:100dvh + overflow:hidden for the chat page.
 * Auth pages need normal scrolling, so we reset those rules here.
 * auth.css loads after style.css so these take precedence.
 */
html {
    background-color: #FDFEFE;
    height: auto !important;
}

.auth-body {
    --auth-bg: #FDFEFE;
    --auth-card: #FFFFFF;
    --auth-accent: #8B5CF6;
    /* Lavender 600 */
    --auth-accent-strong: #7C3AED;
    /* Violet 600 */
    --auth-text: #1F1635;
    /* Deep Violet */
    --auth-muted: #6D6875;
    /* Muted Plum */
    --auth-placeholder: #B4B0BE;
    --auth-pill: 14px;
    --auth-card-radius: 28px;
    --auth-shadow: 0 20px 50px -12px rgba(139, 92, 246, 0.15);

    /* Reset chat-page viewport lock */
    height: auto !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;

    background-color: var(--auth-bg);
    background-image:
        radial-gradient(at 0% 0%, hsla(262, 83%, 94%, 1) 0, transparent 50%),
        radial-gradient(at 100% 100%, hsla(262, 83%, 96%, 1) 0, transparent 50%);
    background-attachment: fixed;
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    color: var(--auth-text);
    overscroll-behavior-y: none;
}

.auth-card {
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(12px);
    width: 100%;
    max-width: 440px;
    padding: 56px 48px;
    border-radius: var(--auth-card-radius);
    box-shadow: var(--auth-shadow);
    border: 1px solid rgba(255, 255, 255, 0.5);
    position: relative;
    overflow: hidden;
}

.auth-header {
    text-align: center;
    margin-bottom: 44px;
}

.auth-logo-container {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 68px;
    height: 68px;
    border-radius: 20px;
    background: linear-gradient(135deg, #8B5CF6 0%, #7C3AED 100%);
    color: #ffffff;
    margin-bottom: 28px;
    box-shadow: 0 10px 20px -5px rgba(139, 92, 246, 0.4);
}

.auth-header h1 {
    font-size: 1.85rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    color: var(--auth-text);
    margin-bottom: 8px;
}

.auth-header p {
    color: var(--auth-muted);
    font-size: 0.98rem;
    line-height: 1.5;
    font-weight: 500;
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 22px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.form-group label {
    font-weight: 700;
    font-size: 0.82rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--auth-text);
    padding-left: 4px;
}

.label-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.forgot-link {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--auth-accent);
    text-decoration: none;
    transition: color 0.2s;
}

.forgot-link:hover {
    color: var(--auth-accent-strong);
}

.input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    background: #FFFFFF;
    border: 1px solid #E2E8F0;
    border-radius: var(--auth-pill);
    min-height: 54px; /* Matches input height */
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.02);
}

.input-wrapper i:not(.eye-icon),
.input-wrapper svg:not(.eye-icon) {
    position: absolute;
    left: 18px;
    top: 50%;
    transform: translateY(-50%) !important;
    color: var(--auth-muted);
    transition: color 0.2s ease;
    pointer-events: none;
    z-index: 5;
}

.auth-input {
    width: 100%;
    height: 54px;
    padding: 0 52px 0 52px;
    border: 0;
    border-radius: var(--auth-pill);
    background: transparent;
    color: var(--auth-text);
    font-size: 1rem;
    font-weight: 500;
    line-height: 54px; /* Matches height for perfect vertical centering */
    display: block;
}

/* Base style for non-password fields (no eye icon) */
.auth-input:not([type="password"]):not(.password-input) {
    padding-right: 18px;
}

.eye-btn {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: transparent;
    border: none;
    color: var(--auth-muted);
    cursor: pointer;
    padding: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    transition: all 0.2s ease;
    z-index: 10;
}

.eye-btn:hover {
    color: var(--auth-accent);
    background-color: rgba(139, 92, 246, 0.05);
}

.auth-input:focus {
    outline: none;
}

/* Remove Autofill background blue color */
.auth-input:-webkit-autofill,
.auth-input:-webkit-autofill:hover,
.auth-input:-webkit-autofill:focus,
.auth-input:-webkit-autofill:active {
    -webkit-box-shadow: 0 0 0 40px white inset !important;
    -webkit-text-fill-color: var(--auth-text) !important;
    transition: background-color 5000s ease-in-out 0s;
}

.input-wrapper:focus-within {
    border-color: var(--auth-accent);
    box-shadow: 0 0 0 4px rgba(139, 92, 246, 0.12), 0 8px 20px -8px rgba(139, 92, 246, 0.2);
    transform: translateY(-1px);
}

.auth-btn {
    width: 100%;
    padding: 16px;
    border: none;
    border-radius: var(--auth-pill);
    background: linear-gradient(135deg, #8B5CF6 0%, #7C3AED 100%);
    color: #ffffff;
    font-weight: 700;
    font-size: 1.05rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    margin-top: 12px;
    box-shadow: 0 10px 20px -5px rgba(139, 92, 246, 0.3);
}

.auth-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 15px 30px -10px rgba(139, 92, 246, 0.4);
    opacity: 0.95;
}

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

.auth-footer {
    margin-top: 36px;
    text-align: center;
    font-size: 0.95rem;
    color: var(--auth-muted);
    font-weight: 500;
}

.auth-link {
    color: var(--auth-accent);
    font-weight: 700;
    text-decoration: none;
    transition: color 0.2s ease;
}

.auth-link:hover {
    text-decoration: underline;
    color: var(--auth-accent-strong);
}

.form-error {
    background: #FEF2F2;
    border: 1px solid rgba(220, 38, 38, 0.2);
    color: #DC2626;
    padding: 14px;
    border-radius: 12px;
    font-size: 0.9rem;
    font-weight: 600;
    text-align: center;
    margin-bottom: 24px;
    animation: shake 0.4s cubic-bezier(.36, .07, .19, .97) both;
}

.form-success {
    background: #F0FDF4;
    border: 1px solid rgba(22, 163, 74, 0.2);
    color: #16A34A;
    padding: 14px;
    border-radius: 12px;
    font-size: 0.9rem;
    font-weight: 600;
    text-align: center;
    margin-bottom: 24px;
}

@keyframes shake {

    10%,
    90% {
        transform: translate3d(-1px, 0, 0);
    }

    20%,
    80% {
        transform: translate3d(2px, 0, 0);
    }

    30%,
    50%,
    70% {
        transform: translate3d(-4px, 0, 0);
    }

    40%,
    60% {
        transform: translate3d(4px, 0, 0);
    }
}

@media (max-width: 640px) {
    .auth-body {
        padding: 16px;
        align-items: flex-start; /* Start from top on mobile to avoid cut-off */
        padding-top: max(24px, env(safe-area-inset-top));
    }

    .auth-card {
        padding: 40px 24px;
        box-shadow: none;
        border: none;
        background: rgba(255, 255, 255, 0.5); /* Semi-transparent instead of pure transparent */
        backdrop-filter: blur(10px);
        margin-bottom: 40px;
    }

    .auth-header {
        margin-bottom: 32px;
    }
}

/* Google Sign-In Button */
.google-btn {
    width: 100%;
    padding: 14px 18px;
    border: 1px solid #E2E8F0;
    border-radius: var(--auth-pill);
    background: #ffffff;
    color: var(--auth-text);
    font-weight: 600;
    font-size: 0.98rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.google-btn:hover {
    background: #FAFAFA;
    border-color: #D1D5DB;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.google-btn:active {
    transform: translateY(0);
}

.google-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

.google-btn svg {
    flex-shrink: 0;
}

/* Auth Divider */
.auth-divider {
    display: flex;
    align-items: center;
    margin: 28px 0;
    gap: 16px;
}

.auth-divider::before,
.auth-divider::after {
    content: "";
    flex: 1;
    height: 1px;
    background: linear-gradient(90deg, transparent, #E2E8F0, transparent);
}

.auth-divider span {
    color: var(--auth-muted);
    font-size: 0.85rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    white-space: nowrap;
}