:root {
    --brand-purple: var(--primary, #6c4cf5);
    --brand-purple-hover: var(--primary-dark, #5234cf);
    --brand-light: rgba(108, 76, 245, 0.1);
    --text-dark: var(--text-main, #2D3748);
    --text-gray: var(--text-muted, #718096);
    --border-color-auth: var(--border-color, #E2E8F0);
    --bg-color: var(--bg-main, #f5f6fc);
    --card-bg: var(--bg-card, #ffffff);
    
    /* Fluid Tokens */
    --auth-padding: clamp(1.5rem, 5vw, 4rem);
    --auth-gap: clamp(2rem, 8vw, 6rem);
    --title-size: clamp(1.8rem, 4vw, 2.6rem);
    --card-max-width: 460px;
}

body {
    margin: 0;
    background-color: var(--bg-color);
    overflow-x: hidden;
    color: var(--text-dark);
    font-family: 'Poppins', sans-serif;
}

/* Intelligent Vector Background */
.auth-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    z-index: -1;
    pointer-events: none;
}

.bg-wave {
    position: absolute;
    transition: all 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.bg-wave.shape-tr {
    top: -15%;
    right: -10%;
    width: clamp(500px, 70vw, 1000px);
    height: auto;
    opacity: 0.5;
    filter: blur(40px);
    animation: float-wave-1 25s infinite alternate ease-in-out;
}

.bg-wave.shape-br {
    bottom: -10%;
    left: 5%; /* Moved to left for balance */
    width: clamp(400px, 50vw, 800px);
    height: auto;
    opacity: 0.4;
    filter: blur(60px);
    animation: float-wave-2 30s infinite alternate-reverse ease-in-out;
}

.bg-wave.shape-l {
    top: 30%;
    right: 15%; /* Moved to center-right to frame the card subtly */
    width: clamp(300px, 40vw, 600px);
    height: auto;
    opacity: 0.3;
    filter: blur(50px);
    animation: float-wave-3 35s infinite alternate ease-in-out;
}

.bg-glow {
    position: absolute;
    bottom: -10%;
    right: 10%;
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, var(--brand-light) 0%, transparent 70%);
    opacity: 0.6;
    filter: blur(80px);
    z-index: -1;
}

.flow-divider {
    position: absolute;
    left: 0;
    width: 100%;
    line-height: 0;
    z-index: -1;
}

.flow-divider.top {
    top: 0;
}

.flow-divider.bottom {
    bottom: 0;
    transform: rotate(180deg);
}

.flow-divider svg {
    display: block;
    width: calc(100% + 1.3px);
    height: 120px;
}

@keyframes float-wave-1 {
    from { transform: translate(0, 0) rotate(0deg); }
    to { transform: translate(30px, 50px) rotate(5deg); }
}

@keyframes float-wave-2 {
    from { transform: translate(0, 0) rotate(0deg); }
    to { transform: translate(-40px, -20px) rotate(-8deg); }
}

@keyframes float-wave-3 {
    from { transform: translate(0, 0) rotate(0deg); }
    to { transform: translate(20px, -40px) rotate(10deg); }
}

/* Grid Layout Refactor */
.auth-layout {
    display: grid;
    grid-template-columns: 1.2fr 0.8fr; /* Adjusted for larger image */
    min-height: 100vh;
    width: 100%;
    max-width: 1440px;
    margin: 0 auto;
    padding: var(--auth-padding);
    gap: var(--auth-gap);
    align-items: center;
    position: relative;
    z-index: 10;
}

/* Left Branding Section */
.auth-branding {
    display: flex;
    flex-direction: column;
    gap: 24px;
    animation: slideInLeft 0.8s ease-out forwards;
}

@keyframes slideInLeft {
    from { opacity: 0; transform: translateX(-40px); }
    to { opacity: 1; transform: translateX(0); }
}

.branding-header {
    display: flex;
    align-items: center;
    gap: 16px;
}

.brand-logo {
    height: 36px;
    width: auto;
    object-fit: contain;
}

.branding-text h2 {
    font-size: var(--title-size);
    font-weight: 700;
    line-height: 1.2;
    margin: 0;
    color: var(--text-dark);
}

.branding-text p {
    font-size: 1.15rem;
    color: var(--text-gray);
    margin-top: 8px;
    max-width: 480px;
}

.auth-illustration {
    width: 100%;
    max-width: 680px; /* Increased from 500px */
    height: auto;
    filter: drop-shadow(0 30px 60px rgba(0,0,0,0.1));
    transition: filter 0.5s ease;
}

[data-theme="dark"] .auth-illustration {
    filter: brightness(0.8) contrast(1.1) drop-shadow(0 30px 60px rgba(0,0,0,0.3));
}

/* Float animation removed */

/* Badge styles removed */

/* Right Side: Login Card with Glassmorphism */
.auth-form-wrapper {
    display: flex;
    justify-content: center;
    animation: slideInRight 0.8s ease-out 0.2s forwards;
    opacity: 0;
}

@keyframes slideInRight {
    from { opacity: 0; transform: translateX(40px); }
    to { opacity: 1; transform: translateX(0); }
}

.auth-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color-auth);
    padding: clamp(2rem, 5vw, 3.5rem);
    border-radius: 28px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.1);
    width: 100%;
    max-width: var(--card-max-width);
}

[data-theme="dark"] .auth-card {
    background: var(--card-bg);
    border-color: rgba(255, 255, 255, 0.08);
}

.card-header {
    text-align: center;
    margin-bottom: 32px;
}

.header-icon {
    width: 64px;
    height: 64px;
    background: var(--brand-purple);
    color: white;
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px;
    box-shadow: 0 12px 24px rgba(108, 76, 245, 0.3);
}

.card-header h2 {
    font-size: 1.75rem;
    margin: 0 0 8px;
}

/* Form Styles */
.form-group {
    margin-bottom: 20px;
}

.form-group.with-icon {
    position: relative;
}

.form-group input {
    width: 100%;
    padding: 14px 48px 14px 48px; /* Increased right padding to 48px */
    background: var(--bg-color);
    border: 1.5px solid transparent;
    border-radius: 14px;
    font-size: 1rem;
    color: var(--text-dark);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Hide native password reveal button in Edge/IE */
.form-group input::-ms-reveal,
.form-group input::-ms-clear {
    display: none;
}

.form-group input:focus {
    background: var(--card-bg);
    border-color: var(--brand-purple);
    box-shadow: 0 0 0 4px rgba(108, 76, 245, 0.1);
    outline: none;
}

.form-group .input-icon {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-gray);
    width: 20px;
    height: 20px;
    pointer-events: none;
    transition: color 0.3s;
}

.form-group input:focus + .input-icon,
.form-group input:focus ~ .input-icon {
    color: var(--brand-purple);
}

.password-toggle-icon {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-gray);
    cursor: pointer;
    width: 32px; /* Container size */
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    transition: all 0.2s;
    z-index: 5;
}

.password-toggle-icon svg {
    width: 20px;
    height: 20px;
    stroke-width: 2px;
}

.password-toggle-icon:hover {
    color: var(--brand-purple);
    background: var(--brand-light);
}

.form-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 28px;
    font-size: 0.9rem;
}

.form-actions .spacer {
    flex: 1;
}

.forgot-pwd {
    color: var(--brand-purple);
    text-decoration: none;
    font-weight: 600;
}

.login-btn {
    width: 100%;
    padding: 14px;
    background: var(--brand-purple);
    color: white;
    border: none;
    border-radius: 14px;
    font-size: 1.05rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 8px 20px rgba(108, 76, 245, 0.2);
}

.login-btn:hover {
    background: var(--brand-purple-hover);
    transform: translateY(-2px);
    box-shadow: 0 12px 28px rgba(108, 76, 245, 0.3);
}

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

/* Social Login removed */

/* Responsive Adjustments */

@media (max-width: 1024px) {
    .auth-layout {
        gap: 3rem;
    }
}

@media (max-width: 968px) {
    .auth-layout {
        grid-template-columns: 1fr;
        padding-top: clamp(2rem, 8vw, 4rem);
        padding-bottom: clamp(2rem, 8vw, 4rem);
        text-align: center;
        gap: 32px;
        justify-items: center;
    }

    .auth-branding {
        order: 1;
        gap: 12px;
        max-width: 500px;
    }

    .branding-header {
        justify-content: center;
    }

    .brand-logo {
        height: 42px;
        margin-bottom: 4px;
    }

    .branding-text h2 {
        font-size: 1.8rem;
    }

    .branding-text p {
        font-size: 1rem;
        margin: 4px auto 0;
    }

    .auth-illustration,
    .auth-badge {
        display: none; /* Hide secondary elements on mobile for better focus */
    }

    .auth-form-wrapper {
        order: 2;
        width: 100%;
        max-width: var(--card-max-width);
    }
    
    .auth-bg .bg-wave.shape-tr { right: -20%; top: -5%; width: 400px; opacity: 0.3; }
    .auth-bg .bg-wave.shape-br { display: none; }
    .auth-bg .bg-wave.shape-l { left: -20%; top: 30%; width: 300px; opacity: 0.2; }
}

@media (max-width: 480px) {
    .auth-layout {
        padding: 16px;
        gap: 24px;
    }

    .auth-card {
        padding: 28px 20px;
        border-radius: 20px;
    }

    .header-icon {
        width: 52px;
        height: 52px;
        margin-bottom: 12px;
    }

    .header-icon svg {
        width: 22px;
        height: 22px;
    }

    .card-header h2 {
        font-size: 1.5rem;
    }

    .form-actions {
        flex-direction: row; /* Keep row if space permits, or stack if tiny */
        justify-content: space-between;
        gap: 8px;
    }

    .social-btn {
        height: 46px;
    }

    .branding-text h2 {
        font-size: 1.6rem;
    }
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
    .bg-wave, .auth-branding, .auth-form-wrapper, .auth-illustration {
        animation: none !important;
        transition: none !important;
        transform: none !important;
        opacity: 1 !important;
    }
}

.error-list {
    background: rgba(254, 242, 242, 0.9);
    border-left: 4px solid #ef4444;
    padding: 12px 16px;
    border-radius: 12px;
    margin-bottom: 24px;
    list-style: none;
}

.error-list li {
    color: #991b1b;
    font-size: 0.875rem;
    margin-bottom: 4px;
}

.error-list li:last-child {
    margin-bottom: 0;
}
