/* Widget: Authentication System */

html:has(.auth-page-container),
body:has(.auth-page-container) {
    overflow: hidden !important;
    height: 100vh !important;
    height: 100dvh !important;
    scrollbar-gutter: auto !important;
}

.auth-page-container {
    position: relative;
    width: 100%;
    height: 100vh;
    height: 100dvh;
    background: transparent;
    overflow: hidden;
}

/* Hide global scrollbar for auth pages */
.auth-page-container::-webkit-scrollbar {
    display: none;
}

.auth-page-container {
    scrollbar-width: none;
    -ms-overflow-style: none;
}


/* Split Layout Adjustments */
.auth-branding-col {
    background: rgba(0, 0, 0, 0.2);
    border-right: 1px solid color-mix(in srgb, var(--c-text), transparent 95%);
    height: 100vh;
    height: 100dvh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: sticky;
    top: 0;
    gap: 2rem;
}

.auth-form-col {
    background: transparent;
    height: 100vh;
    height: 100dvh;
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: none;
    -ms-overflow-style: none;
    display: flex;
    flex-direction: column;
    padding: 4rem 2rem !important;
    /* Ensure enough breathing room for scroll */
}

.auth-form-col::-webkit-scrollbar {
    display: none;
}

/* Elegant Input Overrides */
.elegant-input .input-glass-premium {
    background: color-mix(in srgb, var(--c-text), transparent 98%);
    border-color: color-mix(in srgb, var(--c-text), transparent 95%);
    padding: 0 1.5rem;
    height: 4rem;
    border-radius: var(--r-xl);
}

.elegant-input .e-input-icon {
    margin-right: 1.25rem;
    font-size: 1.1rem;
}

/* Back Button Positioning */
.auth-back-btn-container {
    position: absolute;
    top: var(--s-12);
    z-index: var(--z-elevated);
}

/* Back Button Positioning - Fixed on Branding Column */
.auth-branding-col .auth-back-btn-container {
    position: absolute;
    top: 3rem;
    left: 3rem;
    /* Aligned to left as requested */
    z-index: var(--z-elevated);
}

/* Mobile Back Button Styling (inside form col) */
.auth-back-btn-mobile {
    display: none;
    /* Hidden on desktop */
}

@media (max-width: 1024px) {
    .auth-back-btn-container {
        display: none !important;
        /* Hide the fixed/branding one on mobile */
    }

    .auth-back-btn-mobile {
        display: block;
        margin-bottom: 2.5rem;
        align-self: center;
        /* Center horizontally on mobile */
    }
}

.mb-1 {
    margin-bottom: 0.25rem;
}

.mb-3 {
    margin-bottom: 0.75rem;
}

.mb-4 {
    margin-bottom: 1rem;
}

.mb-6 {
    margin-bottom: 1.5rem;
}

.mb-8 {
    margin-bottom: 2rem;
}

.mb-10 {
    margin-bottom: 2.5rem;
}

.mb-12 {
    margin-bottom: 3rem;
}

.mt-6 {
    margin-top: 1.5rem;
}

.mt-8 {
    margin-top: 2rem;
}

.mt-16 {
    margin-top: 4rem;
}

.pt-10 {
    padding-top: 2.5rem;
}

.pr-1 {
    padding-right: 0.25rem;
}

/* Responsive Utilities (Since we avoid Tailwind but need these for the split) */
@media (min-width: 1025px) {
    .auth-branding-col {
        display: flex !important;
    }
}

@media (max-width: 1024px) {
    .auth-branding-col {
        display: none !important;
    }

    .auth-form-col {
        flex: 0 0 100% !important;
        max-width: 100% !important;
        padding: var(--s-8) !important;
    }
}

/* General Utilities (If not present elsewhere) */
.cursor-pointer {
    cursor: pointer !important;
}

.min-vh-100 {
    min-height: 100vh;
    min-height: 100dvh;
}

.z-50 {
    z-index: var(--z-above);
}

.z-100 {
    z-index: var(--z-elevated);
}

.no-select {
    user-select: none !important;
    -webkit-user-select: none !important;
    -moz-user-select: none !important;
    -ms-user-select: none !important;
}

.no-select * {
    user-select: none !important;
    -webkit-user-select: none !important;
}

.my-8 {
    margin-top: 2rem;
    margin-bottom: 2rem;
}

/* Google Login Button */
.google-login-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    padding: 1.125rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--r-lg);
    color: var(--c-text);
    font-weight: 500;
    text-decoration: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    margin-bottom: 2rem;
}

.google-login-btn:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: var(--c-primary);
    box-shadow: 0 10px 20px -10px rgba(0, 0, 0, 0.5);
}

/* Centralized Auth Button */
.btn-auth {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    width: 100%;
    padding: 1.25rem;
    background: var(--c-primary);
    color: var(--c-bg);
    border: 1px solid color-mix(in srgb, var(--c-primary), white 20%);
    border-radius: var(--r-xl);
    font-size: 1.1rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 8px 25px rgba(var(--c-primary-rgb), 0.2);
    text-decoration: none;
}

.btn-auth:hover {
    background: var(--c-primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 12px 30px rgba(var(--c-primary-rgb), 0.3);
}

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

.btn-auth i {
    transition: transform 0.3s ease;
}

.btn-auth:hover i {
    transform: translateX(4px);
}

.google-login-btn img {
    height: 1.5rem;
    width: auto;
}

/* Social Connection Indicator */
.auth-social-indicator {
    background: linear-gradient(135deg, rgba(var(--c-primary-rgb), 0.1), rgba(255, 255, 255, 0.03));
    border: 1px solid rgba(var(--c-primary-rgb), 0.2);
    padding: 1.5rem;
    border-radius: var(--r-2xl);
    backdrop-filter: blur(10px);
    position: relative;
    overflow: hidden;
}

.auth-social-indicator::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at top right, rgba(var(--c-primary-rgb), 0.1), transparent);
    pointer-events: none;
}

/* Premium Error Card */
.auth-error-card {
    background: rgba(15, 15, 17, 0.6);
    backdrop-filter: blur(25px) saturate(180%);
    -webkit-backdrop-filter: blur(25px) saturate(180%);
    border: 1px solid rgba(var(--c-error-rgb), 0.2);
    border-radius: var(--r-xl);
    padding: 1.5rem;
    display: flex;
    gap: 1.25rem;
    align-items: center;
    box-shadow: 0 15px 35px -5px rgba(0, 0, 0, 0.5), inset 0 0 0 1px rgba(255, 255, 255, 0.03);
    position: relative;
    overflow: hidden;
}

.auth-error-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: linear-gradient(to bottom, var(--c-error), transparent);
}

.auth-error-icon {
    width: 45px;
    height: 45px;
    background: rgba(var(--c-error-rgb), 0.1);
    border-radius: var(--r-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--c-error);
    flex-shrink: 0;
}

.auth-error-list {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.auth-error-item {
    color: var(--c-text-secondary);
    font-size: 0.95rem;
    font-weight: 400;
    line-height: 1.5;
}

/* Branding subtitle fix */
.branding-subtitle {
    max-width: 450px;
    margin-left: auto;
    margin-right: auto;
    line-height: 1.8;
    color: var(--c-text-ghost);
    opacity: 0.8;
}

/* Premium Error Card */
.auth-error-card {
    background: rgba(var(--c-error-rgb), 0.05);
    border: 1px solid rgba(var(--c-error-rgb), 0.15);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-radius: var(--r-xl);
    padding: 1.25rem 1.5rem;
    display: flex;
    gap: 1.25rem;
    align-items: flex-start;
    box-shadow: 0 8px 32px rgba(var(--c-error-rgb), 0.1);
    position: relative;
    overflow: hidden;
}

.auth-error-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 3px;
    height: 100%;
    background: var(--c-error);
}

.auth-error-icon {
    color: var(--c-error);
    display: flex;
    margin-top: 0.2rem;
}

.auth-error-list {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.auth-error-item {
    color: var(--c-error);
    font-size: 0.9rem;
    font-weight: 500;
    line-height: 1.4;
}

/* Branding subtitle fix */
.max-w-400 {
    max-width: 400px;
    margin-left: auto;
    margin-right: auto;
}

/* Setup Hero Design */
.setup-hero {
    width: 100%;
    height: 200px;
    border-radius: var(--r-2xl);
    overflow: hidden;
    position: relative;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(255, 255, 255, 0.05);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
}

.setup-hero-banner {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0.6;
    filter: blur(2px) brightness(0.6) contrast(1.1);
    transition: transform 0.8s cubic-bezier(0.2, 0.8, 0.2, 1), opacity 0.5s ease;
}

.setup-hero-logo {
    z-index: var(--z-base);
    transform: translateY(0);
    filter: drop-shadow(0 15px 30px rgba(0, 0, 0, 0.5));
}

.setup-hero:hover .setup-hero-banner {
    transform: scale(1.1);
    opacity: 0.8;
}

.setup-hero.no-banner .setup-hero-banner {
    display: none;
}

.setup-hero.no-banner {
    height: 140px;
    background: linear-gradient(135deg, rgba(var(--c-primary-rgb), 1), rgba(255, 255, 255, 0.02));
}

.setup-hero::after {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at center, transparent 20%, rgba(0, 0, 0, 0.4) 100%);
    pointer-events: none;
    z-index: var(--z-negative);
}

/* Ensure top is never cut off even if centered, using margin auto on children */
.auth-form-col {
    justify-content: flex-start !important;
    /* Always start from top for scrolling */
}

.auth-form-col>div:first-child {
    margin-top: auto;
    margin-bottom: auto;
}

/* Auth Specific Grid Gap Fix (Mobile & Desktop) */
.auth-form-col .e-grid {
    row-gap: var(--s-4) !important;
    column-gap: var(--s-4) !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
}

.auth-form-col .e-grid .e-col {
    padding: 0 !important;
}