/* ============================================================
   AUTH PAGES (Login & Signup)
   Google Sign-In + Email/Password
   Uses cardboard.css as base
   ============================================================ */

/* ── Lock the auth page to the viewport — no scrolling ── */
html, body.cardboard {
    height: 100%;
    overflow: hidden;
}

/* ── Page layout ── */
.auth-page {
    height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 24px;
    position: relative;
    overflow: hidden;
    box-sizing: border-box;
}

.auth-page::before {
    content: '';
    position: absolute;
    top: 15%;
    left: 50%;
    transform: translateX(-50%);
    width: 700px;
    height: 500px;
    background: radial-gradient(ellipse, rgba(255, 255, 255, 0.025), transparent 70%);
    pointer-events: none;
}

/* ── Holographic ambient glow (mirrors index .lp-holo-glow) ── */
.auth-holo-glow {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
}

.auth-holo-blob {
    position: absolute;
    border-radius: 50%;
    filter: blur(120px);
    will-change: transform;
}

.auth-holo-blob--1 {
    width: 500px;
    height: 500px;
    background: rgba(79, 195, 247, 0.07);
    animation: auth-holo-drift1 25s ease-in-out infinite;
}

.auth-holo-blob--2 {
    width: 400px;
    height: 400px;
    background: rgba(167, 139, 250, 0.05);
    animation: auth-holo-drift2 30s ease-in-out infinite;
}

/* Blob 1: clockwise orbit along viewport edges */
@keyframes auth-holo-drift1 {
    0%, 100% { transform: translate(-10%, -10%); }
    25%      { transform: translate(calc(100vw - 450px), -5%); }
    50%      { transform: translate(calc(100vw - 400px), calc(100vh - 450px)); }
    75%      { transform: translate(-5%, calc(100vh - 400px)); }
}

/* Blob 2: counter-clockwise for organic overlap */
@keyframes auth-holo-drift2 {
    0%, 100% { transform: translate(calc(100vw - 350px), -5%); }
    25%      { transform: translate(calc(100vw - 300px), calc(100vh - 350px)); }
    50%      { transform: translate(-5%, calc(100vh - 300px)); }
    75%      { transform: translate(-10%, -10%); }
}

@media (prefers-reduced-motion: reduce) {
    .auth-holo-blob {
        animation: none;
        opacity: 0.5;
    }
    .auth-holo-blob--1 { transform: translate(10%, 20%); }
    .auth-holo-blob--2 { transform: translate(60%, 50%); }
}

/* ── Card container ── */
.auth-card {
    width: 100%;
    max-width: 380px;
    position: relative;
    z-index: 1;
}

/* ── Brand pill (sits just above the header inside the card) ── */
.auth-brand-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 20px;
}

.auth-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    padding: 10px 20px 10px 16px;
    border-radius: 100px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(24px) saturate(1.4);
    -webkit-backdrop-filter: blur(24px) saturate(1.4);
    box-shadow:
        0 4px 24px rgba(0, 0, 0, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.05);
    pointer-events: auto;
}

.auth-brand .pulsating-circle {
    width: 18px;
    height: 18px;
}

.auth-brand .pulsating-circle::before {
    top: -5px;
    left: -5px;
    right: -5px;
    bottom: -5px;
    border-width: 1px;
}

.auth-brand-name {
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--cb-text-primary);
    text-transform: lowercase;
    letter-spacing: -0.01em;
}

/* ── Header ── */
.auth-header {
    text-align: center;
    margin-bottom: 32px;
    margin-top: 0;
}

body.cardboard .auth-header h1 {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--cb-text-primary);
    text-transform: lowercase;
    letter-spacing: -0.02em;
    margin-bottom: 8px;
}

body.cardboard .auth-subtitle {
    font-size: 0.84rem;
    color: var(--cb-text-muted);
    line-height: 1.5;
}

/* ── Google button ── */
.auth-google-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    padding: 13px 20px;
    border-radius: 10px;
    background: var(--cb-text-primary);
    color: var(--cb-bg-page);
    font-family: var(--cb-font);
    font-size: 0.88rem;
    font-weight: 600;
    border: none;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.25s var(--cb-ease);
}

.auth-google-btn:hover {
    opacity: 0.9;
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(255, 255, 255, 0.12);
}

.auth-google-btn:active {
    transform: scale(0.98);
}

.auth-google-icon {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

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

.auth-divider::before,
.auth-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--cb-border);
}

.auth-divider span {
    font-size: 0.68rem;
    color: var(--cb-text-muted);
    text-transform: lowercase;
    letter-spacing: 0.02em;
}

/* ── Form fields ── */
.auth-form {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.auth-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.auth-label {
    font-size: 0.7rem;
    font-weight: 500;
    color: var(--cb-text-muted);
    text-transform: lowercase;
    letter-spacing: 0.02em;
}

.auth-input {
    width: 100%;
    padding: 12px 14px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    color: var(--cb-text-primary);
    font-family: var(--cb-font);
    font-size: 0.88rem;
    outline: none;
    transition: all 0.2s ease;
    box-sizing: border-box;
}

.auth-input::placeholder {
    color: var(--cb-text-muted);
    opacity: 0.6;
}

.auth-input:focus {
    border-color: rgba(255, 255, 255, 0.2);
    background: rgba(255, 255, 255, 0.07);
}

.auth-input:hover {
    border-color: rgba(255, 255, 255, 0.12);
}

/* ── Submit button ── */
.auth-submit {
    width: 100%;
    padding: 13px 20px;
    margin-top: 4px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.08);
    color: var(--cb-text-primary);
    font-family: var(--cb-font);
    font-size: 0.88rem;
    font-weight: 600;
    border: 1px solid rgba(255, 255, 255, 0.1);
    cursor: pointer;
    transition: all 0.25s var(--cb-ease);
}

.auth-submit:hover {
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(255, 255, 255, 0.16);
}

.auth-submit:active {
    transform: scale(0.98);
}

/* ── Forgot password ── */
.auth-forgot {
    display: flex;
    justify-content: flex-end;
    margin-top: -6px;
}

.auth-forgot a {
    font-size: 0.72rem;
    color: var(--cb-text-muted);
    text-decoration: none;
    transition: color 0.2s ease;
}

.auth-forgot a:hover {
    color: var(--cb-text-secondary);
}

/* ── Error state ── */
.auth-error {
    display: none;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    background: rgba(239, 68, 68, 0.08);
    border: 1px solid rgba(239, 68, 68, 0.15);
    border-radius: 10px;
    margin-bottom: 16px;
    font-size: 0.8rem;
    color: #ef4444;
}

.auth-error.show {
    display: flex;
}

/* ── Footer ── */
.auth-footer {
    text-align: center;
    margin-top: 32px;
    padding-top: 24px;
    border-top: 1px solid var(--cb-border);
}

body.cardboard .auth-footer-text {
    font-size: 0.8rem;
    color: var(--cb-text-muted);
}

.auth-footer-link {
    color: var(--cb-text-primary);
    text-decoration: none;
    font-weight: 500;
    transition: opacity 0.2s ease;
}

.auth-footer-link:hover {
    opacity: 0.8;
}

/* ── Back to home ── */
.auth-home-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 16px;
    font-size: 0.75rem;
    color: var(--cb-text-muted);
    text-decoration: none;
    transition: color 0.2s ease;
}

.auth-home-link:hover {
    color: var(--cb-text-secondary);
}

/* ── Broker picker (broker-only login) ── */
.auth-broker-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.auth-broker-btn {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    width: 100%;
    padding: 13px 18px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: var(--cb-text-primary);
    font-family: var(--cb-font);
    font-size: 0.88rem;
    font-weight: 600;
    text-align: left;
    cursor: pointer;
    transition: all 0.25s var(--cb-ease);
    text-transform: lowercase;
    letter-spacing: -0.01em;
}

.auth-broker-btn:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.16);
}

.auth-broker-btn:active:not(:disabled) {
    transform: scale(0.98);
}

.auth-broker-btn:disabled {
    cursor: not-allowed;
    opacity: 0.5;
}

.auth-broker-btn--primary {
    background: var(--cb-text-primary);
    color: var(--cb-bg-page);
    border-color: var(--cb-text-primary);
}

.auth-broker-btn--primary:hover:not(:disabled) {
    background: var(--cb-text-primary);
    border-color: var(--cb-text-primary);
    opacity: 0.9;
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(255, 255, 255, 0.12);
}

.auth-broker-name {
    display: inline-flex;
    align-items: center;
    gap: 10px;
}

.auth-broker-arrow {
    font-size: 0.95rem;
    opacity: 0.8;
}

.auth-broker-soon {
    font-size: 0.62rem;
    font-weight: 500;
    color: var(--cb-text-muted);
    background: rgba(255, 255, 255, 0.06);
    padding: 3px 8px;
    border-radius: var(--cb-radius-full);
    text-transform: lowercase;
    letter-spacing: 0.04em;
}

body.cardboard .auth-broker-help {
    margin: 12px 2px 0;
    font-size: 0.75rem;
    line-height: 1.5;
    color: var(--cb-text-muted);
    text-align: center;
    text-transform: lowercase;
    letter-spacing: -0.01em;
}

.auth-broker-help a {
    color: var(--cb-text-secondary);
    text-decoration: underline;
    text-underline-offset: 2px;
    font-weight: 500;
    transition: color 0.2s ease;
}

.auth-broker-help a:hover {
    color: var(--cb-text-primary);
}

/* ── Feature list (signup page) ── */
.auth-features-section {
    margin-top: 28px;
    padding-top: 24px;
    border-top: 1px solid var(--cb-border);
}

.auth-features-label {
    font-size: 0.68rem;
    font-weight: 500;
    color: var(--cb-text-muted);
    text-transform: lowercase;
    letter-spacing: 0.02em;
    margin-bottom: 12px;
    text-align: center;
}

.auth-features {
    list-style: none;
    padding: 0;
    margin: 0;
}

.auth-features li {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 5px 0;
    font-size: 0.8rem;
    color: var(--cb-text-secondary);
    text-transform: lowercase;
}

.auth-features li::before {
    content: '';
    width: 12px;
    height: 12px;
    flex-shrink: 0;
    background: var(--cb-success);
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='currentColor'%3E%3Cpath fill-rule='evenodd' d='M16.707 5.293a1 1 0 010 1.414l-8 8a1 1 0 01-1.414 0l-4-4a1 1 0 011.414-1.414L8 12.586l7.293-7.293a1 1 0 011.414 0z' clip-rule='evenodd'/%3E%3C/svg%3E") center/contain no-repeat;
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='currentColor'%3E%3Cpath fill-rule='evenodd' d='M16.707 5.293a1 1 0 010 1.414l-8 8a1 1 0 01-1.414 0l-4-4a1 1 0 011.414-1.414L8 12.586l7.293-7.293a1 1 0 011.414 0z' clip-rule='evenodd'/%3E%3C/svg%3E") center/contain no-repeat;
}

/* ── Responsive ── */
@media (max-width: 768px) {
    .auth-page {
        padding: 32px 20px;
    }

    .auth-card {
        max-width: 100%;
    }
}

@media (max-width: 480px) {
    /* Small screens stack taller than the viewport — allow scroll here */
    html, body.cardboard {
        height: auto;
        overflow: auto;
    }

    .auth-page {
        height: auto;
        min-height: 100vh;
        overflow: visible;
        padding: 24px 16px;
        justify-content: flex-start;
        padding-top: 60px;
    }

    .auth-brand {
        padding: 8px 16px 8px 12px;
        gap: 8px;
    }

    .auth-brand .pulsating-circle {
        width: 16px;
        height: 16px;
    }

    .auth-brand-name {
        font-size: 0.82rem;
    }

    .auth-header {
        margin-top: 0;
        margin-bottom: 28px;
    }

    body.cardboard .auth-header h1 {
        font-size: 1.3rem;
    }

    body.cardboard .auth-subtitle {
        font-size: 0.8rem;
    }

    .auth-google-btn {
        padding: 12px 16px;
        font-size: 0.85rem;
    }

    .auth-divider {
        margin: 20px 0;
    }

    .auth-input {
        padding: 11px 12px;
        font-size: 0.85rem;
    }

    .auth-submit {
        padding: 12px 16px;
        font-size: 0.85rem;
    }

    .auth-footer {
        margin-top: 28px;
        padding-top: 20px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .auth-google-btn,
    .auth-submit,
    .auth-input {
        transition: none;
    }
}
