* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-sans);
    background: var(--color-bg);
    color: var(--color-text-primary);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Main Container */
.login-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    width: 100%;
    max-width: 1200px;
    height: 100vh;
    background: var(--color-bg-elevated);
    backdrop-filter: blur(20px);
}

/* Left Side - Branding */
.login-brand {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: var(--space-12);
    background: linear-gradient(135deg, rgba(47, 111, 237, 0.1), rgba(124, 58, 237, 0.1));
    border-right: 1px solid var(--color-surface-border);
    position: relative;
    overflow: hidden;
}

.brand-logo {
    margin-bottom: var(--space-4);
}

    .brand-logo img {
        height: 48px;
        width: auto;
        display: block;
        margin: 0 auto;
    }

.brand-tagline {
    font-size: var(--text-2xl);
    text-align: center;
    margin-bottom: var(--space-8);
    color: var(--color-text-secondary);
}

/* AI "brain" orb — the same motif shown on the dashboard while a PreTrade
   analysis runs. The gradient circle holds steady; the brain inside it turns
   in 3D (past 180°) to show every aspect. */
.brand-visual {
    width: 240px;
    height: 240px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.brand-brain-orb {
    width: 152px;
    height: 152px;
    border-radius: var(--radius-full);
    background: var(--color-brand-gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    box-shadow: 0 0 50px rgba(47, 111, 237, 0.45);
    perspective: 480px; /* gives the brain's rotateY depth while the circle stays still */
    /* The circle holds steady and only breathes (box-shadow); the brain inside
       is the one that turns — see .brand-brain-icon below. */
    animation: brandBrainGlow 2.4s ease-in-out infinite;
}

.brand-brain-icon {
    width: 72px;
    height: 72px;
    backface-visibility: visible; /* show the mirrored "back" of the brain past 90° */
    animation: brandBrainSpin 7s linear infinite;
}

@keyframes brandBrainSpin {
    from { transform: rotateY(0deg); }
    to   { transform: rotateY(360deg); }
}

@keyframes brandBrainGlow {
    0%, 100% { box-shadow: 0 0 50px rgba(47, 111, 237, 0.45); }
    50%      { box-shadow: 0 0 80px rgba(124, 58, 237, 0.6); }
}

/* Two counter-orbiting rings frame the orb with ambient motion. They sit on
   the stage (not the orb) and orbit in 2D. */
.brand-visual::before,
.brand-visual::after {
    content: '';
    position: absolute;
    inset: 0;
    margin: auto; /* centers within the stage, leaving `transform` free to spin */
    border-radius: var(--radius-full);
    pointer-events: none;
}

.brand-visual::before {
    width: 186px;
    height: 186px;
    border: 2px solid rgba(76, 139, 255, 0.30);
    border-top-color: transparent;
    animation: brandRing 3s linear infinite;
}

.brand-visual::after {
    width: 222px;
    height: 222px;
    border: 1px solid rgba(124, 58, 237, 0.25);
    border-bottom-color: transparent;
    animation: brandRing 5s linear infinite reverse;
}

@keyframes brandRing {
    from { transform: rotate(0deg); }
    to   { transform: rotate(360deg); }
}

/* Respect users who ask for less motion: stop the brain + rings, keep the glow. */
@media (prefers-reduced-motion: reduce) {
    .brand-brain-icon,
    .brand-visual::before,
    .brand-visual::after {
        animation: none;
    }
}

.brand-features {
    margin-top: var(--space-8);
    text-align: center;
}

.feature-item {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: var(--space-4);
    color: var(--color-text-muted);
}

.feature-icon {
    margin-right: var(--space-2);
    color: var(--color-brand-300);
}

/* Right Side - Login Form */
.login-form-container {
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: var(--space-12);
    background: var(--color-bg-elevated);
}

.form-header {
    text-align: center;
    margin-bottom: var(--space-8);
}

.form-title {
    font-size: var(--text-4xl);
    font-weight: 700;
    margin-bottom: var(--space-2);
    background: linear-gradient(45deg, var(--color-text-primary), var(--color-brand-300));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.form-subtitle {
    color: var(--color-text-secondary);
    font-size: var(--text-lg);
}

.login-form {
    max-width: 400px;
    margin: 0 auto;
    width: 100%;
}

.form-group {
    margin-bottom: var(--space-6);
}

.form-label {
    display: block;
    margin-bottom: var(--space-2);
    font-weight: 500;
    color: var(--color-text-secondary);
}

.form-input {
    width: 100%;
    padding: var(--space-4);
    background: var(--color-surface);
    border: 1px solid var(--color-surface-border-strong);
    border-radius: var(--radius-md);
    color: var(--color-text-primary);
    font-size: var(--text-base);
    transition: all var(--duration-base) var(--ease-standard);
}

    .form-input:focus {
        outline: none;
        border-color: var(--color-brand-400);
        background: var(--color-surface-hover);
        box-shadow: 0 0 0 3px rgba(47, 111, 237, 0.15);
    }

    .form-input::placeholder {
        color: var(--color-text-muted);
    }

/* Password reveal toggle */
.password-field {
    position: relative;
    display: block;
}

    .password-field .form-input {
        /* room for the toggle button so long values never run under it */
        padding-right: calc(var(--space-3) * 2 + 36px);
    }

        /* Edge paints its own reveal button in the same spot, which would sit
           under ours and read as the icon swapping or vanishing on hover.
           Kept in a rule of its own: an unknown selector invalidates the whole
           selector list, so grouping this with another -ms- pseudo would drop
           it in the one browser that actually implements it. */
        .password-field .form-input::-ms-reveal {
            display: none;
        }

.password-toggle {
    position: absolute;
    top: 50%;
    right: var(--space-3);
    transform: translateY(-50%);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    padding: 0;
    background: transparent;
    border: none;
    border-radius: var(--radius-sm);
    color: var(--color-text-secondary);
    cursor: pointer;
    transition: color var(--duration-base) var(--ease-standard), background var(--duration-base) var(--ease-standard);
}

    /* A filled chip on hover/focus: the pointer covers a 20px glyph almost
       entirely, so the control needs to stay legible underneath it. */
    .password-toggle:hover {
        background: rgba(255, 255, 255, 0.10);
        color: var(--color-text-primary);
    }

    .password-toggle:focus-visible {
        outline: none;
        background: rgba(255, 255, 255, 0.10);
        color: var(--color-text-primary);
        box-shadow: 0 0 0 2px var(--color-brand-400);
    }

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

/* Eye = "click to show" (password hidden), crossed eye = "click to hide" */
.password-toggle .icon-eye-off,
.password-toggle[aria-pressed="true"] .icon-eye {
    display: none;
}

.password-toggle[aria-pressed="true"] .icon-eye-off {
    display: block;
}

.form-options {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-8);
    font-size: var(--text-sm);
}

.remember-me {
    display: flex;
    align-items: center;
    color: var(--color-text-secondary);
}

    .remember-me input {
        margin-right: var(--space-2);
        accent-color: var(--color-brand-400);
    }

.forgot-password {
    color: var(--color-brand-300);
    text-decoration: none;
    transition: color var(--duration-base) var(--ease-standard);
}

    .forgot-password:hover {
        color: var(--color-brand-400);
    }

.btn {
    width: 100%;
    padding: var(--space-4);
    border: none;
    border-radius: var(--radius-md);
    font-size: var(--text-lg);
    font-weight: 600;
    cursor: pointer;
    transition: all var(--duration-base) var(--ease-standard);
    margin-bottom: var(--space-4);
}

.btn-primary {
    background: var(--color-brand-gradient);
    color: var(--color-text-on-brand);
}

    .btn-primary:hover {
        transform: translateY(-2px);
        box-shadow: var(--shadow-brand);
    }

.btn-google {
    background: var(--color-surface);
    color: var(--color-text-primary);
    border: 1px solid var(--color-surface-border-strong);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
}

    .btn-google:hover {
        background: var(--color-surface-hover);
    }

.divider {
    text-align: center;
    margin: var(--space-6) 0;
    position: relative;
    color: var(--color-text-muted);
}

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

    .divider span {
        background: var(--color-bg-elevated);
        padding: 0 var(--space-4);
        position: relative;
    }

.signup-link {
    text-align: center;
    margin-top: var(--space-8);
    color: var(--color-text-secondary);
}

    .signup-link a {
        color: var(--color-brand-300);
        text-decoration: none;
        font-weight: 600;
    }

        .signup-link a:hover {
            color: var(--color-brand-400);
        }

/* Mobile Responsive */
@media (max-width: 768px) {
    .login-container {
        grid-template-columns: 1fr;
        height: auto;
        min-height: 100vh;
    }

    .login-brand {
        display: none;
    }

    .login-form-container {
        padding: var(--space-8) var(--space-4);
    }

    .form-title {
        font-size: 2rem;
    }
}

.signin-error-message {
    background-color: var(--color-danger-bg);
    border: 1px solid var(--color-danger);
    color: var(--color-danger);
    padding: var(--space-3);
    border-radius: var(--radius-sm);
    margin-bottom: var(--space-4);
    font-size: var(--text-sm);
    font-weight: 500;
}

/* Forgot / Reset Password (shared card styling for both flows) */
.forgot-password-container,
.forgot-password-reset-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-8);
    background-color: transparent;
}

.forgot-password-form,
.forgot-password-reset-form {
    max-width: 400px;
    width: 100%;
    padding: var(--space-8);
    background: var(--color-surface);
    border: 1px solid var(--color-surface-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
}

    .forgot-password-form h2,
    .forgot-password-reset-form h2 {
        margin-bottom: var(--space-2);
        font-size: var(--text-2xl);
        font-weight: 600;
        color: var(--color-text-primary);
        text-align: center;
    }

    .forgot-password-form p,
    .forgot-password-reset-form p {
        margin-bottom: var(--space-8);
        color: var(--color-text-secondary);
        text-align: center;
        font-size: var(--text-sm);
        line-height: 1.5;
    }

.forgot-password-form-group {
    margin-bottom: var(--space-6);
}

.forgot-password-form-label {
    display: block;
    margin-bottom: var(--space-2);
    font-weight: 500;
    color: var(--color-text-secondary);
    font-size: var(--text-sm);
}

.forgot-password-form-input {
    width: 100%;
    padding: var(--space-3);
    border: 1px solid var(--color-surface-border-strong);
    border-radius: var(--radius-sm);
    font-size: var(--text-base);
    transition: border-color var(--duration-fast) var(--ease-standard), box-shadow var(--duration-fast) var(--ease-standard);
    background-color: var(--color-bg-elevated);
    color: var(--color-text-primary);
}

    .forgot-password-form-input:focus {
        outline: none;
        border-color: var(--color-brand-400);
        box-shadow: 0 0 0 3px rgba(47, 111, 237, 0.15);
    }

.forgot-password-form-hint {
    display: block;
    margin-top: var(--space-1);
    font-size: var(--text-xs);
    color: var(--color-text-muted);
}

.forgot-password-btn {
    width: 100%;
    padding: var(--space-3) var(--space-4);
    border: none;
    border-radius: var(--radius-sm);
    font-size: var(--text-base);
    font-weight: 500;
    cursor: pointer;
    transition: all var(--duration-fast) var(--ease-standard);
    margin-bottom: var(--space-6);
}

    .forgot-password-btn:disabled {
        opacity: 0.6;
        cursor: not-allowed;
    }

.forgot-password-btn-primary {
    background: var(--color-brand-gradient);
    color: var(--color-text-on-brand);
}

    .forgot-password-btn-primary:hover:not(:disabled) {
        transform: translateY(-1px);
        box-shadow: var(--shadow-brand);
    }

.forgot-password-form-footer {
    text-align: center;
}

.forgot-password-back-to-signin {
    color: var(--color-brand-300);
    text-decoration: none;
    font-size: var(--text-sm);
    transition: color var(--duration-fast) var(--ease-standard);
}

    .forgot-password-back-to-signin:hover {
        color: var(--color-brand-400);
        text-decoration: underline;
    }

.forgot-password-error-message,
.forgot-password-reset-error-message {
    background-color: var(--color-danger-bg);
    border: 1px solid var(--color-danger);
    color: var(--color-danger);
    padding: var(--space-3);
    border-radius: var(--radius-sm);
    margin-bottom: var(--space-4);
    font-size: var(--text-sm);
    font-weight: 500;
}

.forgot-password-success-message,
.forgot-password-reset-success-message {
    background-color: var(--color-success-bg);
    border: 1px solid var(--color-success);
    color: var(--color-success);
    padding: var(--space-3);
    border-radius: var(--radius-sm);
    margin-bottom: var(--space-4);
    font-size: var(--text-sm);
    font-weight: 500;
}
