

@import url('https://api.fontshare.com/v2/css?f[]=general-sans@300,400,500,600,700&display=swap');

/* ── Tokens ──────────────────────────────────────────────── */
:root {
    --brand: #ff4c51;
    --brand-hover: #e04347;
    --brand-active: #c73b3f;
    --brand-light: #ffecee;
    --brand-muted: rgba(255,76,81,0.08);
    --color-bg: #f5f4f0;
    --color-surface: #ffffff;
    --color-surface-2: #fafaf8;
    --color-border: rgba(0,0,0,0.10);
    --color-text: #1a1714;
    --color-text-muted: #6b6966;
    --color-text-faint: #b0aeaa;
    --color-error: #c0392b;
    --color-success: #27ae60;
    --font-body: 'General Sans', 'Inter', sans-serif;
    --text-xs: clamp(0.75rem, 0.7rem + 0.25vw, 0.875rem);
    --text-sm: clamp(0.875rem, 0.8rem + 0.35vw, 1rem);
    --text-base: clamp(1rem, 0.95rem + 0.25vw, 1.125rem);
    --text-lg: clamp(1.125rem, 1rem + 0.75vw, 1.5rem);
    --text-xl: clamp(1.5rem, 1.2rem + 1.25vw, 2rem);
    --space-1: 0.25rem;
    --space-2: 0.5rem;
    --space-3: 0.75rem;
    --space-4: 1rem;
    --space-5: 1.25rem;
    --space-6: 1.5rem;
    --space-8: 2rem;
    --space-10: 2.5rem;
    --space-12: 3rem;
    --space-16: 4rem;
    --radius-sm: 0.375rem;
    --radius-md: 0.625rem;
    --radius-lg: 1rem;
    --radius-xl: 1.25rem;
    --radius-full: 9999px;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
    --shadow-md: 0 4px 16px rgba(0,0,0,0.08), 0 2px 4px rgba(0,0,0,0.04);
    --shadow-lg: 0 16px 48px rgba(0,0,0,0.12), 0 4px 12px rgba(0,0,0,0.06);
    --ease-out-expo: cubic-bezier(0.16, 1, 0.3, 1);
    --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* ── Base Reset ──────────────────────────────────────────── */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-body);
    font-size: var(--text-base);
    color: var(--color-text);
    background: var(--color-bg);
    min-height: 100dvh;
    line-height: 1.6;
    overflow-x: hidden;
}

img {
    display: block;
    max-width: 100%;
}

input, button {
    font: inherit;
    color: inherit;
}

button {
    cursor: pointer;
    background: none;
    border: none;
}

:focus-visible {
    outline: 2px solid var(--brand);
    outline-offset: 3px;
    border-radius: var(--radius-sm);
}

::selection {
    background: rgba(255,76,81,0.15);
}

/* ── Splash Screen ───────────────────────────────────────── */
#splash {
    position: fixed;
    inset: 0;
    z-index: 1000;
    background: var(--brand);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: var(--space-6);
    transition: opacity 0.5s var(--ease-out-expo), transform 0.5s var(--ease-out-expo);
}

    #splash.hidden {
        opacity: 0;
        transform: scale(1.04);
        pointer-events: none;
    }

.splash-logo {
    width: clamp(120px, 30vw, 180px);
    animation: splashLogoIn 0.8s var(--ease-spring) both;
}

.splash-tagline {
    color: rgba(255,255,255,0.85);
    font-size: var(--text-sm);
    font-weight: 400;
    letter-spacing: 0.02em;
    text-align: center;
    animation: fadeUp 0.6s 0.3s var(--ease-out-expo) both;
}

.splash-loader {
    width: 40px;
    height: 3px;
    background: rgba(255,255,255,0.2);
    border-radius: var(--radius-full);
    overflow: hidden;
    animation: fadeUp 0.4s 0.5s var(--ease-out-expo) both;
}

.splash-loader-bar {
    height: 100%;
    background: #fff;
    border-radius: var(--radius-full);
    animation: loaderFill 1.4s 0.6s var(--ease-out-expo) both;
}

@keyframes splashLogoIn {
    from {
        opacity: 0;
        transform: scale(0.7) translateY(20px);
    }

    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

@keyframes fadeUp {
    from {
        opacity: 0;
        transform: translateY(12px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes loaderFill {
    from {
        width: 0%;
    }

    to {
        width: 100%;
    }
}

/* ── Auth Layout ─────────────────────────────────────────── */
.auth-wrapper {
    min-height: 100dvh;
    display: grid;
    grid-template-columns: 1fr;
    opacity: 0;
    transform: translateY(16px);
    transition: opacity 0.6s var(--ease-out-expo), transform 0.6s var(--ease-out-expo);
}

    .auth-wrapper.visible {
        opacity: 1;
        transform: translateY(0);
    }

/* Desktop: two-column split */
@media (min-width: 1024px) {
    .auth-wrapper {
        grid-template-columns: 1fr 1fr;
    }
}

/* ── Brand Panel (left on desktop / top hero on mobile) ──── */
.auth-brand {
    background: var(--brand);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: clamp(var(--space-10), 6vw, var(--space-16));
    position: relative;
    overflow: hidden;
    min-height: 260px;
}

@media (min-width: 1024px) {
    .auth-brand {
        min-height: 100dvh;
        align-items: flex-start;
        justify-content: center;
        padding: var(--space-16);
        position: sticky;
        top: 0;
    }
}

/* Subtle geometric pattern overlay */
.auth-brand::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image: radial-gradient(circle at 80% 20%, rgba(255,255,255,0.06) 0%, transparent 50%), radial-gradient(circle at 20% 80%, rgba(0,0,0,0.15) 0%, transparent 50%);
    pointer-events: none;
}

.auth-brand::after {
    content: '';
    position: absolute;
    bottom: -60px;
    right: -60px;
    width: 240px;
    height: 240px;
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 50%;
    pointer-events: none;
}

.brand-inner {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    gap: var(--space-8);
    max-width: 420px;
    width: 100%;
}

@media (max-width: 1023px) {
    .brand-inner {
        align-items: center;
        text-align: center;
    }
}

.brand-logo {
    width: clamp(100px, 20vw, 140px);
}

.brand-headline {
    color: #fff;
    font-size: var(--text-xl);
    font-weight: 700;
    line-height: 1.2;
    letter-spacing: -0.01em;
}

.brand-sub {
    color: rgba(255,255,255,0.70);
    font-size: var(--text-sm);
    font-weight: 400;
    line-height: 1.65;
    max-width: 34ch;
}

@media (max-width: 1023px) {
    .brand-headline {
        display: none;
    }

    .brand-sub {
        display: none;
    }
}

.brand-features {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
    margin-top: var(--space-4);
}

@media (max-width: 1023px) {
    .brand-features {
        display: none;
    }
}

.brand-feature {
    display: flex;
    align-items: flex-start;
    gap: var(--space-4);
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.10);
    border-radius: var(--radius-lg);
    padding: var(--space-4) var(--space-5);
    transition: background 200ms var(--ease-out-expo);
}

    .brand-feature:hover {
        background: rgba(255,255,255,0.13);
    }

.brand-feature-icon {
    width: 36px;
    height: 36px;
    flex-shrink: 0;
    color: rgba(255,255,255,0.9);
    margin-top: 2px;
}

.brand-feature-text strong {
    display: block;
    color: #fff;
    font-size: var(--text-sm);
    font-weight: 600;
    margin-bottom: 2px;
}

.brand-feature-text span {
    color: rgba(255,255,255,0.60);
    font-size: var(--text-xs);
}

/* ── Form Panel ──────────────────────────────────────────── */
.auth-form-panel {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: clamp(var(--space-8), 6vw, var(--space-16)) clamp(var(--space-6), 5vw, var(--space-12));
    background: var(--color-surface);
    min-height: 100dvh;
}

@media (max-width: 1023px) {
    .auth-form-panel {
        min-height: auto;
        padding-bottom: var(--space-12);
    }
}

.auth-card {
    width: 100%;
    max-width: 420px;
    display: flex;
    flex-direction: column;
    gap: var(--space-8);
}

/* Mobile logo (shown only on mobile, inside form panel) */
.mobile-logo {
    display: none;
    width: 100px;
    margin: 0 auto;
}

@media (max-width: 1023px) {
    .mobile-logo {
        display: block;
    }
}

/* ── Auth Header ─────────────────────────────────────────── */
.auth-header {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

.auth-title {
    font-size: var(--text-xl);
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--color-text);
    line-height: 1.15;
}

.auth-subtitle {
    font-size: var(--text-sm);
    color: var(--color-text-muted);
    font-weight: 400;
}

/* ── Form ────────────────────────────────────────────────── */
.auth-form {
    display: flex;
    flex-direction: column;
    gap: var(--space-5);
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

.form-label {
    font-size: var(--text-sm);
    font-weight: 500;
    color: var(--color-text);
}

.form-label-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.form-link {
    font-size: var(--text-xs);
    font-weight: 500;
    color: var(--brand);
    text-decoration: none;
    transition: color 180ms;
}

    .form-link:hover {
        color: var(--brand-hover);
    }

.input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.input-icon {
    position: absolute;
    left: var(--space-4);
    width: 18px;
    height: 18px;
    color: var(--color-text-faint);
    pointer-events: none;
    flex-shrink: 0;
    transition: color 200ms;
}

.input-action {
    position: absolute;
    right: var(--space-4);
    width: 18px;
    height: 18px;
    color: var(--color-text-faint);
    cursor: pointer;
    border: none;
    background: none;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 180ms;
}

    .input-action:hover {
        color: var(--color-text-muted);
    }

.form-input {
    width: 100%;
    height: 48px;
    padding: 0 var(--space-4) 0 var(--space-10);
    background: var(--color-surface-2);
    border: 1.5px solid var(--color-border);
    border-radius: var(--radius-md);
    font-size: var(--text-sm);
    color: var(--color-text);
    transition: border-color 180ms var(--ease-out-expo), background 180ms var(--ease-out-expo), box-shadow 180ms var(--ease-out-expo);
    -webkit-appearance: none;
    appearance: none;
}

    .form-input::placeholder {
        color: var(--color-text-faint);
    }

    .form-input:focus {
        outline: none;
        border-color: var(--brand);
        background: var(--color-surface);
        box-shadow: 0 0 0 3px rgba(255,76,81,0.10);
    }

        .form-input:focus + .input-icon,
        .input-wrapper:focus-within .input-icon {
            color: var(--brand);
        }

    .form-input.has-action {
        padding-right: var(--space-12);
    }

    .form-input.input-error {
        border-color: var(--color-error);
        background: #fff8f8;
    }

        .form-input.input-error:focus {
            box-shadow: 0 0 0 3px rgba(192,57,43,0.10);
        }

/* ── Validation Messages ─────────────────────────────────── */
.field-error {
    font-size: var(--text-xs);
    color: var(--color-error);
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: var(--space-1);
    margin-top: var(--space-1);
    animation: fadeUp 0.2s var(--ease-out-expo);
}

.form-error-banner {
    background: #fff0f0;
    border: 1px solid rgba(192,57,43,0.20);
    border-radius: var(--radius-md);
    padding: var(--space-4) var(--space-5);
    font-size: var(--text-sm);
    color: var(--color-error);
    display: flex;
    align-items: flex-start;
    gap: var(--space-3);
    animation: fadeUp 0.25s var(--ease-out-expo);
}

    .form-error-banner svg {
        flex-shrink: 0;
        margin-top: 2px;
    }

/* ── Password Strength ───────────────────────────────────── */
.password-strength {
    margin-top: var(--space-2);
}

.strength-bars {
    display: flex;
    gap: var(--space-1);
    margin-bottom: var(--space-1);
}

.strength-bar {
    height: 3px;
    flex: 1;
    border-radius: var(--radius-full);
    background: var(--color-border);
    transition: background 300ms var(--ease-out-expo);
}

    .strength-bar.weak {
        background: #e74c3c;
    }

    .strength-bar.medium {
        background: #f39c12;
    }

    .strength-bar.strong {
        background: var(--color-success);
    }

.strength-label {
    font-size: var(--text-xs);
    color: var(--color-text-muted);
    font-weight: 500;
}

/* ── Buttons ─────────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    height: 50px;
    border-radius: var(--radius-md);
    font-size: var(--text-sm);
    font-weight: 600;
    letter-spacing: 0.01em;
    text-decoration: none;
    border: none;
    cursor: pointer;
    transition: background 200ms var(--ease-out-expo), color 200ms var(--ease-out-expo), box-shadow 200ms var(--ease-out-expo), transform 150ms var(--ease-out-expo), border-color 200ms var(--ease-out-expo);
    position: relative;
    overflow: hidden;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
}

    .btn:active {
        transform: scale(0.98);
    }

.btn-primary {
    background: var(--brand);
    color: #fff;
    width: 100%;
}

    .btn-primary:hover {
        background: var(--brand-hover);
        box-shadow: 0 4px 16px rgba(255,76,81,0.30);
    }

    .btn-primary:active {
        background: var(--brand-active);
    }

.btn-secondary {
    background: var(--color-surface-2);
    color: var(--color-text);
    border: 1.5px solid var(--color-border);
    width: 100%;
}

    .btn-secondary:hover {
        background: var(--color-bg);
        border-color: rgba(0,0,0,0.18);
    }

/* Loading state */
.btn-primary.loading {
    pointer-events: none;
    color: transparent;
}

    .btn-primary.loading::after {
        content: '';
        position: absolute;
        width: 20px;
        height: 20px;
        border: 2px solid rgba(255,255,255,0.3);
        border-top-color: #fff;
        border-radius: 50%;
        animation: spin 0.7s linear infinite;
    }

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Ripple */
.btn .ripple {
    position: absolute;
    border-radius: 50%;
    background: rgba(255,255,255,0.25);
    transform: scale(0);
    animation: ripple-anim 0.5s linear;
    pointer-events: none;
}

@keyframes ripple-anim {
    to {
        transform: scale(4);
        opacity: 0;
    }
}

/* ── Divider ─────────────────────────────────────────────── */
.auth-divider {
    display: flex;
    align-items: center;
    gap: var(--space-4);
    font-size: var(--text-xs);
    color: var(--color-text-faint);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

    .auth-divider::before,
    .auth-divider::after {
        content: '';
        flex: 1;
        height: 1px;
        background: var(--color-border);
    }

/* ── Alt Login ───────────────────────────────────────────── */
.btn-alt {
    background: var(--color-surface-2);
    border: 1.5px solid var(--color-border);
    color: var(--color-text);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-3);
    width: 100%;
    height: 50px;
    border-radius: var(--radius-md);
    font-size: var(--text-sm);
    font-weight: 500;
    cursor: pointer;
    transition: all 180ms;
    text-decoration: none;
}

    .btn-alt:hover {
        background: var(--color-bg);
        border-color: rgba(0,0,0,0.18);
    }

    .btn-alt svg {
        flex-shrink: 0;
    }

/* ── Footer Link ─────────────────────────────────────────── */
.auth-footer {
    text-align: center;
    font-size: var(--text-sm);
    color: var(--color-text-muted);
}

    .auth-footer a {
        color: var(--brand);
        font-weight: 600;
        text-decoration: none;
        transition: color 180ms;
    }

        .auth-footer a:hover {
            color: var(--brand-hover);
        }

/* ── Remember Me ─────────────────────────────────────────── */
.form-check {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    cursor: pointer;
}

    .form-check input[type="checkbox"] {
        appearance: none;
        -webkit-appearance: none;
        width: 18px;
        height: 18px;
        border: 1.5px solid var(--color-border);
        border-radius: var(--radius-sm);
        background: var(--color-surface-2);
        cursor: pointer;
        flex-shrink: 0;
        transition: all 180ms;
        position: relative;
    }

        .form-check input[type="checkbox"]:checked {
            background: var(--brand);
            border-color: var(--brand);
        }

            .form-check input[type="checkbox"]:checked::after {
                content: '';
                position: absolute;
                top: 2px;
                left: 5px;
                width: 5px;
                height: 9px;
                border: 2px solid #fff;
                border-top: none;
                border-left: none;
                transform: rotate(45deg);
            }

.form-check-label {
    font-size: var(--text-sm);
    color: var(--color-text-muted);
    cursor: pointer;
    user-select: none;
}

/* ── Field row (two cols for name fields) ────────────────── */
.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-4);
}

@media (max-width: 480px) {
    .form-row {
        grid-template-columns: 1fr;
    }
}

/* ── Step progress (register) ────────────────────────────── */
.step-indicator {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    margin-bottom: var(--space-2);
}

.step-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--color-border);
    transition: all 300ms var(--ease-out-expo);
    flex-shrink: 0;
}

    .step-dot.active {
        background: var(--brand);
        transform: scale(1.3);
    }

    .step-dot.done {
        background: var(--color-success);
    }

.step-label {
    font-size: var(--text-xs);
    color: var(--color-text-muted);
    font-weight: 500;
}

/* ── Animations ──────────────────────────────────────────── */
.form-step {
    display: flex;
    flex-direction: column;
    gap: var(--space-5);
    animation: stepIn 0.35s var(--ease-out-expo);
}

@keyframes stepIn {
    from {
        opacity: 0;
        transform: translateX(24px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.form-step.exit {
    animation: stepOut 0.25s var(--ease-out-expo) forwards;
}

@keyframes stepOut {
    to {
        opacity: 0;
        transform: translateX(-24px);
    }
}

/* ── Input float label animation ─────────────────────────── */
.float-group {
    position: relative;
}

.float-label {
    position: absolute;
    left: var(--space-10);
    top: 50%;
    transform: translateY(-50%);
    font-size: var(--text-sm);
    color: var(--color-text-faint);
    pointer-events: none;
    transition: all 200ms var(--ease-out-expo);
    background: transparent;
    padding: 0 var(--space-1);
}

.form-input:not(:placeholder-shown) ~ .float-label,
.form-input:focus ~ .float-label {
    top: 0;
    font-size: var(--text-xs);
    color: var(--brand);
    background: var(--color-surface);
    padding: 0 4px;
}

/* ── RTL support ─────────────────────────────────────────── */
[dir="rtl"] .input-icon {
    left: auto;
    right: var(--space-4);
}

[dir="rtl"] .form-input {
    padding: 0 var(--space-10) 0 var(--space-4);
}

[dir="rtl"] .input-action {
    right: auto;
    left: var(--space-4);
}

/* ── Reduce motion ───────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
}
