/* Life OS Auth Pages — Login / Register (Light Theme + Glassmorphism)
   ============================================================================ */

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

:root {
    --auth-bg: #FAFBFC;
    --auth-surface: rgba(255, 255, 255, 0.55);
    --auth-surface-solid: #FFFFFF;
    --auth-text: #1A1A2E;
    --auth-text-secondary: #64647C;
    --auth-text-tertiary: #9494A8;
    --auth-accent: #6366F1;
    --auth-accent-hover: #4F46E5;
    --auth-accent-subtle: rgba(99, 102, 241, 0.12);
    --auth-border: rgba(255, 255, 255, 0.45);
    --auth-border-hover: rgba(255, 255, 255, 0.65);
    --auth-danger: #EF4444;
    --auth-font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --auth-ease: cubic-bezier(0.16, 1, 0.3, 1);
}

/* Skip Link */
.skip-link {
    position: absolute;
    top: -40px;
    left: 0;
    background: var(--auth-accent);
    color: #fff;
    padding: 8px 16px;
    z-index: 100;
    font-size: 14px;
    transition: top 0.2s;
}
.skip-link:focus {
    top: 0;
}

body.auth-page {
    font-family: var(--auth-font);
    background: var(--auth-bg);
    color: var(--auth-text);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    -webkit-font-smoothing: antialiased;
    position: relative;
    overflow-x: hidden;
    overflow-y: auto;
}

/* ── Background: ambient gradient blobs ── */
.auth-bg {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
}

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

.auth-blob--indigo {
    width: 480px; height: 480px;
    top: -12%; left: -8%;
    background: radial-gradient(circle, rgba(99, 102, 241, 0.14) 0%, transparent 70%);
    animation: authBlobDrift1 35s ease-in-out infinite alternate;
}

.auth-blob--violet {
    width: 400px; height: 400px;
    bottom: -10%; right: -6%;
    background: radial-gradient(circle, rgba(139, 92, 246, 0.12) 0%, transparent 70%);
    animation: authBlobDrift2 28s ease-in-out infinite alternate;
}

.auth-blob--rose {
    width: 350px; height: 350px;
    top: 50%; left: 55%;
    transform: translate(-50%, -50%);
    background: radial-gradient(circle, rgba(236, 72, 153, 0.08) 0%, transparent 70%);
    animation: authBlobDrift3 32s ease-in-out infinite alternate;
}

.auth-blob--sky {
    width: 300px; height: 300px;
    top: 15%; right: 15%;
    background: radial-gradient(circle, rgba(56, 189, 248, 0.07) 0%, transparent 70%);
    animation: authBlobDrift4 38s ease-in-out infinite alternate;
}

@keyframes authBlobDrift1 {
    0% { transform: translate(0, 0) scale(1); }
    100% { transform: translate(80px, 60px) scale(1.08); }
}

@keyframes authBlobDrift2 {
    0% { transform: translate(0, 0) scale(1); }
    100% { transform: translate(-60px, -50px) scale(1.05); }
}

@keyframes authBlobDrift3 {
    0% { transform: translate(-50%, -50%) scale(1); }
    100% { transform: translate(calc(-50% + 40px), calc(-50% - 30px)) scale(1.1); }
}

@keyframes authBlobDrift4 {
    0% { transform: translate(0, 0) scale(1); }
    100% { transform: translate(-30px, 40px) scale(0.95); }
}

/* Floating particles */
.auth-particle {
    position: absolute;
    left: var(--x, 50%);
    top: var(--y, 50%);
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: rgba(99, 102, 241, 0.15);
    animation: authParticleFloat var(--dur, 20s) ease-in-out var(--delay, 0s) infinite alternate;
    pointer-events: none;
}

.auth-particle:nth-child(even) {
    background: rgba(139, 92, 246, 0.2);
    width: 3px;
    height: 3px;
}

.auth-particle:nth-child(3n) {
    background: rgba(236, 72, 153, 0.15);
    width: 5px;
    height: 5px;
}

@keyframes authParticleFloat {
    0% { transform: translate(0, 0) scale(1); opacity: 0.2; }
    50% { opacity: 0.4; }
    100% { transform: translate(30px, -40px) scale(1.5); opacity: 0.1; }
}

/* ── Card: glassmorphism ── */
.auth-card {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 420px;
    padding: 36px 40px 40px;
    background: var(--auth-surface);
    backdrop-filter: blur(24px) saturate(1.4);
    -webkit-backdrop-filter: blur(24px) saturate(1.4);
    border: 1px solid var(--auth-border);
    border-radius: 24px;
    box-shadow:
        0 8px 40px rgba(0, 0, 0, 0.06),
        0 1px 3px rgba(0, 0, 0, 0.04),
        inset 0 1px 0 rgba(255, 255, 255, 0.6);
    animation: authCardIn 0.6s var(--auth-ease);
}

@keyframes authCardIn {
    from { opacity: 0; transform: translateY(20px) scale(0.98); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

/* Card shimmer border on hover */
.auth-card::before {
    content: '';
    position: absolute;
    inset: -1px;
    border-radius: 25px;
    background: linear-gradient(135deg, transparent 40%, rgba(99, 102, 241, 0.1) 50%, transparent 60%);
    background-size: 300% 300%;
    z-index: -1;
    opacity: 0;
    transition: opacity 0.4s ease;
}

.auth-card:hover::before {
    opacity: 1;
    animation: authShimmer 3s ease infinite;
}

@keyframes authShimmer {
    0% { background-position: 100% 0%; }
    100% { background-position: -100% 0%; }
}

/* Stagger animation for card children */
.auth-stagger {
    opacity: 0;
    transform: translateY(12px);
    animation: authStaggerIn 0.5s var(--auth-ease) forwards;
    animation-delay: calc(0.15s + var(--i, 0) * 0.08s);
}

@keyframes authStaggerIn {
    to { opacity: 1; transform: translateY(0); }
}

/* ── Logo ── */
.auth-logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-bottom: 20px;
    text-decoration: none;
    color: var(--auth-text);
}

.auth-logo-icon {
    width: 40px; height: 40px;
    background: linear-gradient(135deg, var(--auth-accent), #8b5cf6);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 16px rgba(99, 102, 241, 0.25);
    animation: authLogoPulse 3s ease-in-out infinite;
}

@keyframes authLogoPulse {
    0%, 100% { box-shadow: 0 2px 16px rgba(99, 102, 241, 0.25); }
    50% { box-shadow: 0 4px 24px rgba(99, 102, 241, 0.3); }
}

.auth-logo-text {
    font-size: 22px;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.auth-logo-text span { color: var(--auth-accent); }

/* ── Heading ── */
.auth-heading {
    text-align: center;
    margin-bottom: 28px;
}

.auth-heading h1 {
    font-size: 24px;
    font-weight: 700;
    letter-spacing: -0.02em;
    margin-bottom: 6px;
    color: var(--auth-text);
}

.auth-heading p {
    font-size: 14px;
    color: var(--auth-text-secondary);
}

/* ── Google button ── */
.auth-google-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    width: 100%;
    padding: 14px 24px;
    background: var(--auth-surface-solid);
    color: var(--auth-text);
    border: 1.5px solid rgba(0, 0, 0, 0.08);
    border-radius: 12px;
    font-size: 15px;
    font-weight: 600;
    font-family: var(--auth-font);
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s var(--auth-ease);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.auth-google-btn:hover {
    background: #F9FAFB;
    border-color: rgba(0, 0, 0, 0.15);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

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

.auth-google-icon {
    width: 20px; height: 20px;
    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: rgba(0, 0, 0, 0.08);
}

.auth-divider span {
    font-size: 13px;
    color: var(--auth-text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 500;
}

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

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

.auth-field label {
    font-size: 13px;
    font-weight: 600;
    color: var(--auth-text-secondary);
}

.auth-field input {
    width: 100%;
    padding: 13px 16px;
    background: rgba(255, 255, 255, 0.7);
    border: 1.5px solid rgba(0, 0, 0, 0.08);
    border-radius: 10px;
    color: var(--auth-text);
    font-size: 15px;
    font-family: var(--auth-font);
    transition: all 0.2s var(--auth-ease);
    outline: none;
}

.auth-field input::placeholder { color: var(--auth-text-tertiary); }

.auth-field input:focus {
    border-color: var(--auth-accent);
    box-shadow: 0 0 0 3px rgba(124, 92, 252, 0.15);
    background: var(--auth-surface-solid);
    animation: authFocusRing 0.3s var(--auth-ease);
}

@keyframes authFocusRing {
    from { box-shadow: 0 0 0 0 rgba(124, 92, 252, 0.15); }
    to { box-shadow: 0 0 0 3px rgba(124, 92, 252, 0.15); }
}

/* ── Forgot password (inline, right-aligned under password) ── */
.auth-forgot-inline {
    align-self: flex-end;
    font-size: 12px;
    color: var(--auth-text-tertiary);
    text-decoration: none;
    transition: color 0.2s;
    margin-top: 2px;
}

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

/* ── Submit button ── */
.auth-submit {
    position: relative;
    overflow: hidden;
    width: 100%;
    padding: 14px 24px;
    background: linear-gradient(135deg, var(--auth-accent), #8b5cf6);
    color: #fff;
    border: none;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 600;
    font-family: var(--auth-font);
    cursor: pointer;
    transition: all 0.2s var(--auth-ease);
    box-shadow: 0 4px 16px rgba(99, 102, 241, 0.25);
    margin-top: 4px;
}

.auth-submit:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 24px rgba(99, 102, 241, 0.35);
}

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

.auth-submit:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* Submit button loading state with shimmer */
.auth-submit:disabled::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 12px;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.15), transparent);
    background-size: 200% 100%;
    animation: authBtnShimmer 1.5s ease infinite;
}

@keyframes authBtnShimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ── Error ── */
.auth-error {
    display: none;
    padding: 12px 16px;
    background: rgba(239, 68, 68, 0.06);
    border: 1px solid rgba(239, 68, 68, 0.15);
    border-radius: 10px;
    color: #DC2626;
    font-size: 14px;
    text-align: center;
    animation: authErrorIn 0.3s var(--auth-ease);
}

.auth-error.visible { display: block; }

@keyframes authErrorIn {
    from { opacity: 0; transform: translateY(-8px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Success message */
.auth-success {
    display: none;
    padding: 12px 16px;
    background: rgba(16, 185, 129, 0.06);
    border: 1px solid rgba(16, 185, 129, 0.15);
    border-radius: 10px;
    color: #059669;
    font-size: 14px;
    text-align: center;
    animation: authErrorIn 0.3s var(--auth-ease);
}

.auth-success.visible { display: block; }

/* ── Footer link ── */
.auth-footer {
    text-align: center;
    margin-top: 24px;
    font-size: 14px;
    color: var(--auth-text-tertiary);
}

.auth-footer a {
    color: var(--auth-accent);
    text-decoration: none;
    font-weight: 600;
    transition: color 0.2s;
}

.auth-footer a:hover { color: var(--auth-accent-hover); }

/* ── Back to landing ── */
.auth-back {
    position: absolute;
    top: 24px; left: 24px;
    z-index: 10;
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--auth-text-tertiary);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: color 0.2s;
}

.auth-back:hover { color: var(--auth-text); }

/* Password hint */
.auth-hint {
    font-size: 12px;
    color: var(--auth-text-tertiary);
    margin-top: -4px;
}

/* Legacy forgot password (centered block) — kept for register page compat */
.auth-forgot {
    text-align: center;
    margin-top: 4px;
}

.auth-forgot a {
    font-size: 13px;
    color: var(--auth-text-tertiary);
    text-decoration: none;
    transition: color 0.2s;
}

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

/* Optional field label */
.auth-optional {
    font-weight: 400;
    color: var(--auth-text-tertiary);
    font-size: 11px;
}

/* ── Google Hero Button (primary CTA) ── */
.auth-google-hero {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    width: 100%;
    padding: 18px 24px;
    background: var(--auth-surface-solid);
    color: var(--auth-text);
    border: 1.5px solid rgba(0, 0, 0, 0.08);
    border-radius: 14px;
    font-size: 16px;
    font-weight: 600;
    font-family: var(--auth-font);
    cursor: pointer;
    text-decoration: none;
    transition: all 0.25s var(--auth-ease);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

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

.auth-google-hero:hover {
    transform: translateY(-1px);
    border-color: rgba(0, 0, 0, 0.15);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
}

.auth-google-hero:hover .auth-google-icon {
    transform: scale(1.1);
    transition: transform 0.25s var(--auth-ease);
}

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

/* ── Trust Signals ── */
.auth-trust-signals {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    margin-top: 16px;
    font-size: 11px;
    color: var(--auth-text-tertiary);
}

.auth-trust-signals span {
    display: flex;
    align-items: center;
    gap: 4px;
}

.auth-trust-signals svg {
    opacity: 0.7;
}

/* ── Email Toggle Link ── */
.auth-email-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    width: 100%;
    margin-top: 20px;
    padding: 0;
    background: none;
    border: none;
    color: var(--auth-text-tertiary);
    font-size: 13px;
    font-family: var(--auth-font);
    cursor: pointer;
    transition: color 0.2s;
}

.auth-email-toggle:hover {
    color: var(--auth-text-secondary);
    text-decoration: underline;
}

.auth-email-toggle-chevron {
    transition: transform 0.3s var(--auth-ease);
}

.auth-email-toggle.expanded .auth-email-toggle-chevron {
    transform: rotate(180deg);
}

/* Collapsible Email Form */
.auth-email-form {
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    transition: max-height 0.4s ease, opacity 0.3s ease, margin 0.3s ease;
    margin-top: 0;
}

.auth-email-form.visible {
    max-height: 400px;
    opacity: 1;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid rgba(0, 0, 0, 0.06);
}

/* ── Responsive ── */
@media (max-width: 480px) {
    .auth-card {
        padding: 28px 20px 32px;
        margin: 12px;
        border-radius: 18px;
        max-width: 100%;
    }

    .auth-heading h1 { font-size: 22px; }
    .auth-heading p { font-size: 13px; }
    .auth-heading { margin-bottom: 24px; }

    .auth-logo { margin-bottom: 16px; }
    .auth-logo-icon { width: 36px; height: 36px; }
    .auth-logo-text { font-size: 20px; }

    .auth-google-hero {
        padding: 14px 20px;
        font-size: 15px;
    }

    .auth-trust-signals {
        gap: 10px;
        font-size: 10px;
        flex-wrap: wrap;
        justify-content: center;
    }

    .auth-field input {
        padding: 14px 16px;
        font-size: 16px; /* Prevents iOS zoom on focus */
    }

    .auth-submit {
        padding: 14px 20px;
        min-height: 48px;
    }

    .auth-back {
        top: 16px;
        left: 16px;
        padding: 8px;
        min-width: 44px;
        min-height: 44px;
    }

    .auth-footer { font-size: 13px; }
}

@media (max-width: 360px) {
    .auth-card {
        padding: 24px 16px 28px;
        margin: 8px;
        border-radius: 16px;
    }

    .auth-heading h1 { font-size: 20px; }
    .auth-google-hero { padding: 12px 16px; font-size: 14px; }
}

/* Landscape mode */
@media (max-height: 600px) and (orientation: landscape) {
    body.auth-page {
        align-items: flex-start;
        padding: 16px 0;
    }
    .auth-card { margin-top: 12px; }
    .auth-heading { margin-bottom: 16px; }
    .auth-logo { margin-bottom: 12px; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
    .auth-stagger { opacity: 1; transform: none; }
    .auth-particle { display: none; }
    .auth-blob { display: none; }
    .auth-card::before { display: none; }
}
