@import url('https://fonts.googleapis.com/css2?family=Sora:wght@400;500;600;700;800&family=Plus+Jakarta+Sans:wght@400;500;600;700;800&display=swap');

/* =========================================================
   VARIABLES
========================================================= */
:root {
    --primary: #5b48d4;
    --primary-dark: #2e1f8c;
    --primary-light: #efedff;
    --accent: #a893ff;
    --text: #0d1a3d;
    --text-light: #2f3a5c;
    --muted: #6a7290;
    --border: #e0e2f0;
    --white: #ffffff;
    --background: #f6f7fe;
    --danger: #d94a5e;
    --success: #1f9c6a;
    --shadow-sm: 0 4px 12px rgba(65, 60, 135, 0.06);
    --shadow-md: 0 10px 30px rgba(65, 60, 135, 0.10);
    --shadow-lg: 0 24px 60px rgba(46, 31, 140, 0.18);
    --radius-sm: 10px;
    --radius-md: 14px;
    --radius-lg: 20px;
}

.form-alert {
    margin-bottom: 14px;
    padding: 11px 14px;
    font-size: 11.5px;
    font-weight: 600;
    color: #b3324a;
    background: #fff2f4;
    border: 1px solid #f4c6ce;
    border-left: 3px solid #d94a5e;
    border-radius: 10px;
    line-height: 1.5;
}
.field.has-error input {
    border-color: #d94a5e;
    background: #fff7f8;
}
.field-error {
    display: block;
    min-height: 14px;
    font-size: 10.5px;
    font-weight: 600;
    color: #d94a5e;
    line-height: 1.4;
}
.check.has-error span { color: #d94a5e; }
.terms-error { margin-top: -6px; margin-bottom: 4px; }

/* =========================================================
   RESET
========================================================= */
* { margin: 0; padding: 0; box-sizing: border-box; }

html, body { height: 100%; }

body {
    font-family: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
    color: var(--text);
    background: var(--background);
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
    line-height: 1.55;
}

img { max-width: 100%; display: block; }
a { text-decoration: none; color: inherit; }
button { font-family: inherit; cursor: pointer; }

/* =========================================================
   LAYOUT
========================================================= */
.auth-page {
    display: grid;
    grid-template-columns: 1.05fr 1fr;
    min-height: 100vh;
}

/* =========================================================
   SHOWCASE PANEL (left)
========================================================= */
.auth-showcase {
    position: relative;
    overflow: hidden;
    color: #fff;
    padding: 48px 56px;
    display: flex;
    flex-direction: column;
    justify-content: center;

    /* MBTI-themed layered background:
       1) soft radial highlight  (top-right)
       2) deep purple gradient   (main)
    */
    background:
        radial-gradient(circle at 85% 15%, rgba(168, 147, 255, 0.45), transparent 55%),
        radial-gradient(circle at 15% 85%, rgba(90, 70, 200, 0.55), transparent 55%),
        linear-gradient(140deg, #2a1b7a 0%, #3d28a0 45%, #1e1359 100%);
}

/* subtle dot grid pattern */
.showcase-grid {
    position: absolute;
    inset: 0;
    opacity: 0.35;
    background-image:
        radial-gradient(circle, rgba(255, 255, 255, 0.15) 1px, transparent 1.5px);
    background-size: 26px 26px;
    mask-image: radial-gradient(ellipse at center, #000 40%, transparent 85%);
    -webkit-mask-image: radial-gradient(ellipse at center, #000 40%, transparent 85%);
    pointer-events: none;
}

/* faint MBTI character illustration backdrop */
.showcase-figure {
    position: absolute;
    right: -8%;
    bottom: -10%;
    width: 70%;
    height: 100%;
    background-image: url("https://commons.wikimedia.org/wiki/Special:FilePath/13_ENTJ_Illustration.png");
    background-repeat: no-repeat;
    background-position: right bottom;
    background-size: contain;
    opacity: 0.14;
    filter: brightness(1.4) saturate(1.2);
    pointer-events: none;
    z-index: 1;
}

/* soft purple glow behind the content */
.showcase-glow {
    position: absolute;
    top: -20%;
    left: -20%;
    width: 60%;
    height: 60%;
    background: radial-gradient(circle, rgba(168, 147, 255, 0.5), transparent 65%);
    filter: blur(60px);
    pointer-events: none;
}

/* ----- content ----- */
.showcase-content {
    position: relative;
    z-index: 3;
    max-width: 480px;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 11px;
    margin-bottom: 46px;
    color: #fff;
    font-family: 'Sora', sans-serif;
    font-weight: 800;
    font-size: 15px;
    letter-spacing: 0.12em;
    padding: 8px 14px 8px 10px;
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.06);
    backdrop-filter: blur(6px);
}
.brand img {
    width: 26px;
    height: 26px;
    padding: 3px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.9);
    object-fit: contain;
}

.auth-showcase h1 {
    font-family: 'Sora', sans-serif;
    font-size: clamp(28px, 3.4vw, 42px);
    line-height: 1.15;
    letter-spacing: -0.02em;
    font-weight: 800;
    margin-bottom: 16px;
    color: #fff;
}

.auth-showcase p {
    font-size: 13.5px;
    line-height: 1.7;
    color: rgba(255, 255, 255, 0.82);
    margin-bottom: 30px;
    max-width: 420px;
}

.showcase-points {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.showcase-points li {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 12.5px;
    color: rgba(255, 255, 255, 0.9);
    font-weight: 500;
}
.showcase-points .dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: linear-gradient(135deg, #c7b6ff, #8a71ff);
    box-shadow: 0 0 12px rgba(168, 147, 255, 0.9);
    flex-shrink: 0;
}

/* ----- floating type chips ----- */
.type-cloud {
    position: absolute;
    inset: 0;
    z-index: 2;
    pointer-events: none;
}
.type-cloud span {
    position: absolute;
    left: var(--x);
    top: var(--y);
    padding: 4px 10px;
    font-family: 'Sora', sans-serif;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.1em;
    color: rgba(255, 255, 255, 0.55);
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: 999px;
    backdrop-filter: blur(4px);
    animation: floatChip 6s ease-in-out infinite;
    animation-delay: var(--d);
}
@keyframes floatChip {
    0%, 100% { transform: translateY(0); }
    50%      { transform: translateY(-9px); }
}

/* =========================================================
   FORM PANEL (right)
========================================================= */
.auth-panel {
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 40px 32px;
    background:
        radial-gradient(circle at 20% 10%, rgba(221, 217, 255, 0.5), transparent 40%),
        radial-gradient(circle at 90% 90%, rgba(220, 235, 255, 0.45), transparent 40%),
        var(--background);
}

.auth-card {
    position: relative;
    width: min(460px, 100%);
    padding: 36px 34px 34px;
    background: rgba(255, 255, 255, 0.96);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    backdrop-filter: blur(10px);
}

.auth-header {
    text-align: center;
    margin-bottom: 22px;
}
.auth-header h2 {
    font-family: 'Sora', sans-serif;
    font-size: 22px;
    font-weight: 800;
    letter-spacing: -0.02em;
    color: var(--text);
    margin-bottom: 4px;
}
.auth-header p {
    font-size: 12px;
    color: var(--muted);
    font-weight: 500;
}

/* =========================================================
   TABS
========================================================= */
.auth-tabs {
    position: relative;
    display: grid;
    grid-template-columns: 1fr 1fr;
    padding: 4px;
    margin-bottom: 22px;
    background: #f3f2fb;
    border: 1px solid #e6e3f7;
    border-radius: 12px;
}
.auth-tabs button {
    position: relative;
    z-index: 2;
    padding: 9px 12px;
    border: none;
    background: transparent;
    font-family: 'Sora', sans-serif;
    font-size: 12px;
    font-weight: 700;
    color: var(--muted);
    border-radius: 9px;
    transition: color 0.3s ease;
}
.auth-tabs button.active { color: var(--primary-dark); }

.tab-slider {
    position: absolute;
    top: 4px;
    left: 4px;
    width: calc(50% - 4px);
    height: calc(100% - 8px);
    border-radius: 9px;
    background: #fff;
    box-shadow: 0 3px 10px rgba(65, 60, 135, 0.08);
    transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1;
}
.auth-tabs[data-active="register"] .tab-slider {
    transform: translateX(100%);
}

/* =========================================================
   FORMS
========================================================= */
.auth-form {
    display: none;
    flex-direction: column;
    gap: 14px;
    animation: formIn 0.4s cubic-bezier(0.2, 0.7, 0.2, 1) both;
}
.auth-form.is-active { display: flex; }

@keyframes formIn {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}

.field { display: flex; flex-direction: column; gap: 5px; }
.field-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.field label {
    font-size: 11px;
    font-weight: 700;
    color: var(--text);
    letter-spacing: 0.01em;
}

.field input[type="text"],
.field input[type="email"],
.field input[type="password"] {
    width: 100%;
    padding: 11px 14px;
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-size: 12.5px;
    color: var(--text);
    background: #fbfaff;
    border: 1px solid #e5e2f5;
    border-radius: var(--radius-sm);
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}
.field input::placeholder { color: #a0a6bd; }
.field input:hover { border-color: #d4d0eb; }
.field input:focus {
    background: #fff;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(91, 72, 212, 0.14);
}

/* error state */
.field.has-error input { border-color: var(--danger); background: #fff5f6; }
.field.has-error input:focus { box-shadow: 0 0 0 3px rgba(217, 74, 94, 0.16); }
.field-error {
    min-height: 14px;
    font-size: 10.5px;
    color: var(--danger);
    font-weight: 600;
}
.field-hint {
    font-size: 10.5px;
    color: var(--muted);
    line-height: 1.5;
}

/* ---------- password wrapper ---------- */
.password-wrap { position: relative; }
.password-wrap input { padding-right: 42px !important; }

.toggle-password {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    width: 30px;
    height: 30px;
    display: grid;
    place-items: center;
    padding: 0;
    background: transparent;
    border: none;
    color: var(--muted);
    border-radius: 8px;
    transition: background 0.2s ease, color 0.2s ease;
}
.toggle-password:hover {
    background: rgba(91, 72, 212, 0.08);
    color: var(--primary);
}
.toggle-password svg { width: 16px; height: 16px; }
.toggle-password .eye-closed { display: none; }
.toggle-password.is-visible .eye-open { display: none; }
.toggle-password.is-visible .eye-closed { display: block; }

/* ---------- password strength ---------- */
.strength {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 4px;
    margin-top: 3px;
}
.strength span {
    height: 3px;
    background: #e8e5f5;
    border-radius: 999px;
    transition: background 0.3s ease;
}
.strength[data-level="1"] span:nth-child(-n+1) { background: #d94a5e; }
.strength[data-level="2"] span:nth-child(-n+2) { background: #e8a03a; }
.strength[data-level="3"] span:nth-child(-n+3) { background: #46b47e; }
.strength[data-level="4"] span                { background: #1f9c6a; }

/* ---------- remember / forgot row ---------- */
.row-between {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: 2px;
}

.check {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 11.5px;
    color: var(--text-light);
    font-weight: 500;
    cursor: pointer;
    user-select: none;
}
.check input {
    appearance: none;
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    border: 1.5px solid #cdc8e8;
    border-radius: 5px;
    background: #fff;
    display: grid;
    place-items: center;
    cursor: pointer;
    transition: border-color 0.2s ease, background 0.2s ease;
    flex-shrink: 0;
}
.check input:hover { border-color: var(--primary); }
.check input:checked {
    background: linear-gradient(135deg, #7662e9, #5944ce);
    border-color: transparent;
}
.check input:checked::after {
    content: "";
    width: 9px;
    height: 5px;
    border-left: 2px solid #fff;
    border-bottom: 2px solid #fff;
    transform: rotate(-45deg) translateY(-1px);
}
.check a { color: var(--primary); font-weight: 700; }
.check a:hover { text-decoration: underline; }

.link {
    font-size: 11.5px;
    font-weight: 700;
    color: var(--primary);
    transition: color 0.2s ease;
}
.link:hover { color: var(--primary-dark); }

/* ---------- primary button ---------- */
.btn-primary {
    position: relative;
    width: 100%;
    margin-top: 6px;
    padding: 13px 20px;
    color: #fff;
    background: linear-gradient(135deg, #7662e9, #5944ce);
    border: none;
    border-radius: var(--radius-sm);
    font-family: 'Sora', sans-serif;
    font-size: 12.5px;
    font-weight: 700;
    letter-spacing: 0.02em;
    box-shadow: 0 10px 22px rgba(98, 82, 220, 0.28);
    overflow: hidden;
    transition: transform 0.25s ease, box-shadow 0.25s ease;
}
.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 14px 28px rgba(98, 82, 220, 0.36);
}
.btn-primary:active { transform: translateY(0); }
.btn-primary.is-loading { opacity: 0.85; pointer-events: none; }
.btn-primary.is-loading span { opacity: 0; }
.btn-primary.is-loading::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 18px;
    height: 18px;
    margin: -9px 0 0 -9px;
    border: 2px solid rgba(255, 255, 255, 0.4);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- swap text ---------- */
.swap-text {
    margin-top: 6px;
    text-align: center;
    font-size: 11.5px;
    color: var(--muted);
    font-weight: 500;
}
.link-btn {
    background: none;
    border: none;
    padding: 0;
    color: var(--primary);
    font-family: inherit;
    font-size: inherit;
    font-weight: 700;
    cursor: pointer;
}
.link-btn:hover { text-decoration: underline; }

/* ---------- footer ---------- */
.auth-footer {
    margin-top: 22px;
    font-size: 11px;
}
.auth-footer a {
    color: var(--muted);
    font-weight: 600;
    transition: color 0.2s ease;
}
.auth-footer a:hover { color: var(--primary); }

/* ---------- toast ---------- */
.toast {
    position: absolute;
    left: 50%;
    bottom: -18px;
    transform: translate(-50%, 20px);
    padding: 10px 18px;
    font-size: 11.5px;
    font-weight: 700;
    color: #fff;
    background: linear-gradient(135deg, #46b47e, #1f9c6a);
    border-radius: 999px;
    box-shadow: 0 10px 22px rgba(31, 156, 106, 0.32);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease, transform 0.3s ease;
    white-space: nowrap;
}
.toast.is-visible {
    opacity: 1;
    transform: translate(-50%, 0);
}

/* =========================================================
   RESPONSIVE
========================================================= */
@media (max-width: 980px) {
    .auth-page { grid-template-columns: 1fr; }

    .auth-showcase {
        padding: 46px 32px 40px;
        min-height: 320px;
        text-align: left;
    }
    .auth-showcase h1 { font-size: 26px; }
    .auth-showcase p { font-size: 12.5px; }

    .showcase-figure { width: 55%; right: -12%; opacity: 0.10; }
    .type-cloud span:nth-child(n+9) { display: none; }

    .auth-panel { padding: 32px 20px 40px; }
}

@media (max-width: 560px) {
    .auth-showcase { padding: 34px 22px 30px; }
    .brand { margin-bottom: 28px; font-size: 13px; }
    .auth-showcase h1 { font-size: 22px; margin-bottom: 12px; }
    .auth-showcase p { font-size: 12px; margin-bottom: 22px; }
    .showcase-points li { font-size: 11.5px; }
    .type-cloud span:nth-child(n+5) { display: none; }

    .auth-panel { padding: 24px 14px 32px; }

    .auth-card {
        padding: 26px 20px 24px;
        border-radius: 16px;
    }
    .auth-header h2 { font-size: 19px; }
    .auth-header p { font-size: 11.5px; }

    .field-row { grid-template-columns: 1fr; }
    .auth-tabs button { font-size: 11.5px; padding: 8px 10px; }
    .btn-primary { padding: 12px 18px; font-size: 12px; }

    .auth-footer { margin-top: 16px; }
}

/* =========================================================
   REDUCED MOTION
========================================================= */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}