:root {
    --auth-bg: #eef2f7;
    --auth-surface: #ffffff;
    --auth-text: #0f172a;
    --auth-text-soft: #64748b;
    --auth-line: #dbe2ec;
    --auth-brand: #3f4dff;
    --auth-brand-dark: #2f3adf;
    --auth-brand-glow: rgba(63, 77, 255, 0.28);
}

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    min-height: 100%;
    background: radial-gradient(1200px 700px at 10% 10%, #d8e6ff 0%, #eef2f7 55%, #e9edf5 100%);
    color: var(--auth-text);
    font-family: Inter, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

.auth-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    opacity: 0;
    transform: translateY(12px) scale(0.992);
    transition: opacity 0.42s ease, transform 0.6s cubic-bezier(0.2, 0.8, 0.2, 1), filter 0.42s ease;
}

body.auth-ready .auth-page {
    opacity: 1;
    transform: translateY(0) scale(1);
}

body.auth-leaving .auth-page {
    opacity: 0;
    filter: blur(1.5px);
}

body.auth-leaving.auth-dir-left .auth-page {
    transform: translateX(-28px) scale(0.99);
}

body.auth-leaving.auth-dir-right .auth-page {
    transform: translateX(28px) scale(0.99);
}

.auth-shell {
    width: min(980px, 100%);
    min-height: min(680px, calc(100vh - 48px));
    background: var(--auth-surface);
    border: 1px solid rgba(148, 163, 184, 0.25);
    border-radius: 24px;
    overflow: hidden;
    box-shadow: 0 30px 70px rgba(15, 23, 42, 0.12);
    display: grid;
    grid-template-columns: 46% 54%;
}

.auth-shell.auth-shell-wide {
    width: min(1060px, 100%);
    min-height: min(700px, calc(100vh - 48px));
    grid-template-columns: 45% 55%;
    transition: grid-template-columns 0.62s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.auth-visual {
    position: relative;
    isolation: isolate;
    overflow: hidden;
    transition: opacity 0.58s ease, transform 0.62s cubic-bezier(0.2, 0.8, 0.2, 1), filter 0.58s ease;
    transform: translateX(0);
    opacity: 1;
}

.auth-visual video {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.auth-visual::before {
    content: "";
    position: absolute;
    inset: 0;
    background:
        linear-gradient(172deg, rgba(8, 17, 42, 0.14) 0%, rgba(11, 6, 32, 0.56) 70%, rgba(9, 5, 28, 0.8) 100%),
        radial-gradient(65% 58% at 66% 74%, rgba(96, 55, 255, 0.52) 0%, rgba(40, 24, 86, 0.08) 70%, transparent 100%);
    z-index: 1;
}

.visual-inner {
    position: relative;
    z-index: 2;
    min-height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 26px 26px 28px;
    color: #fff;
}

.visual-logo {
    width: min(170px, 54%);
    filter: drop-shadow(0 8px 20px rgba(10, 20, 48, 0.34));
}

.visual-copy h1 {
    margin: 0;
    font-size: clamp(20px, 2vw, 42px);
    line-height: 1.02;
    letter-spacing: 0.01em;
    font-weight: 800;
    text-transform: uppercase;
    max-width: 390px;
}

.visual-copy p {
    margin: 14px 0 0;
    max-width: 360px;
    font-size: clamp(13px, 0.92vw, 17px);
    line-height: 1.34;
    color: rgba(255, 255, 255, 0.93);
}

.visual-icons {
    margin-top: 20px;
    display: flex;
    gap: 12px;
}

.visual-icons i {
    width: 34px;
    height: 34px;
    border: 1px solid rgba(255, 255, 255, 0.28);
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    color: rgba(255, 255, 255, 0.94);
    backdrop-filter: blur(4px);
}

.auth-form-pane {
    padding: 30px 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(180deg, #ffffff 0%, #fbfcff 100%);
    transition: padding 0.5s cubic-bezier(0.2, 0.8, 0.2, 1), opacity 0.4s ease, transform 0.4s ease;
}

.auth-shell.auth-shell-wide.is-plan-step {
    grid-template-columns: 0 1fr;
}

.auth-shell.auth-shell-wide.is-plan-step .auth-visual {
    opacity: 0;
    transform: translateX(-42px);
    filter: blur(2px);
    pointer-events: none;
}

.auth-shell.auth-shell-wide.is-plan-step .auth-form-pane {
    padding-left: 34px;
    padding-right: 34px;
    transform: translateX(0);
}

.auth-shell.auth-shell-wide.is-plan-step .form-wrap.form-wrap-lg {
    width: min(880px, 100%);
}

.form-wrap {
    width: min(430px, 100%);
}

.form-wrap.form-wrap-lg {
    width: min(540px, 100%);
    max-height: calc(100vh - 84px);
    overflow: auto;
    padding-right: 8px;
}

.auth-shell.auth-shell-wide .form-wrap.form-wrap-lg {
    max-height: none;
    overflow: visible;
    padding-right: 0;
}

.brand-mark {
    width: 48px;
    height: 48px;
    border-radius: 14px;
    background: linear-gradient(135deg, #3f4dff 0%, #5756ff 100%);
    color: #fff;
    font-size: 22px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 12px;
    box-shadow: 0 6px 20px var(--auth-brand-glow);
}

/* Password strength meter */
.pwd-strength {
    margin-top: 6px;
    display: flex;
    gap: 4px;
    align-items: center;
}

.pwd-strength-bar {
    flex: 1;
    height: 4px;
    border-radius: 4px;
    background: #e2e8f0;
    transition: background 0.24s ease;
}

.pwd-strength-bar.filled { background: #ef4444; }
.pwd-strength[data-level="2"] .pwd-strength-bar.filled { background: #f59e0b; }
.pwd-strength[data-level="3"] .pwd-strength-bar.filled { background: #22c55e; }
.pwd-strength[data-level="4"] .pwd-strength-bar.filled { background: #16a34a; }

.pwd-strength-label {
    font-size: 11px;
    font-weight: 700;
    min-width: 48px;
    text-align: right;
    color: #94a3b8;
    transition: color 0.24s ease;
}

.form-title {
    margin: 0;
    font-size: clamp(27px, 1.9vw, 32px);
    line-height: 1.1;
    font-weight: 800;
    letter-spacing: -0.02em;
}

.form-subtitle {
    margin: 10px 0 0;
    color: var(--auth-text-soft);
    font-size: 15px;
    line-height: 1.5;
    max-width: 420px;
}

.auth-toast {
    margin-top: 16px;
    border-radius: 13px;
    border: 1px solid #e2e8f0;
    padding: 13px 16px;
    font-size: 13px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    animation: authFadeUp 0.2s ease both;
}

.toast-success {
    background: #f0fdf4;
    border-color: #bbf7d0;
    color: #166534;
}

.toast-warning {
    background: #fffbeb;
    border-color: #fde68a;
    color: #92400e;
}

.toast-danger {
    background: #fef2f2;
    border-color: #fecaca;
    color: #991b1b;
}

.toast-info {
    background: #eff6ff;
    border-color: #bfdbfe;
    color: #1e40af;
}

.toast-close {
    border: 0;
    background: transparent;
    color: inherit;
    cursor: pointer;
    font-size: 14px;
    opacity: 0.66;
}

.toast-close:hover {
    opacity: 1;
}

.affiliate-pill {
    margin-top: 14px;
    border-radius: 12px;
    border: 1px solid #bfdbfe;
    background: #eff6ff;
    color: #1e40af;
    padding: 10px 12px;
    font-size: 13px;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.auth-form {
    margin-top: 18px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-group label {
    font-weight: 800;
    font-size: 14px;
    color: #1f2937;
}

.input-wrap {
    position: relative;
}

.input-wrap i {
    position: absolute;
    left: 13px;
    top: 50%;
    transform: translateY(-50%);
    color: #94a3b8;
    font-size: 14px;
}

.auth-input,
.auth-select {
    width: 100%;
    height: 48px;
    border-radius: 12px;
    border: 1px solid var(--auth-line);
    background: #fff;
    color: #0f172a;
    font-size: 15px;
    font-weight: 600;
    padding: 0 14px 0 41px;
    outline: none;
    transition: border-color 0.16s, box-shadow 0.16s;
}

.auth-input:focus,
.auth-select:focus {
    border-color: #97abff;
    box-shadow: 0 0 0 4px rgba(63, 77, 255, 0.12);
}

.input-action {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    border: 0;
    background: transparent;
    cursor: pointer;
    color: #94a3b8;
    width: 30px;
    height: 30px;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.input-action:hover {
    background: #f1f5f9;
    color: #475569;
}

.input-help {
    margin-top: 4px;
    color: #94a3b8;
    font-size: 12px;
    font-weight: 600;
}

.form-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
}

.remember {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: #475569;
    font-weight: 700;
    user-select: none;
}

.remember input,
.auth-checkbox {
    width: 16px;
    height: 16px;
    accent-color: #4050ff;
}

.auth-link {
    color: var(--auth-brand);
    font-size: 14px;
    font-weight: 800;
    text-decoration: none;
}

.auth-link:hover {
    color: var(--auth-brand-dark);
}

.auth-submit,
.auth-btn-secondary {
    margin-top: 2px;
    width: 100%;
    height: 50px;
    border-radius: 12px;
    border: 0;
    font-size: 16px;
    font-weight: 800;
    letter-spacing: 0.01em;
    cursor: pointer;
    transition: transform 0.16s, box-shadow 0.16s, background 0.16s;
}

.auth-submit {
    background: linear-gradient(90deg, #3f4dff 0%, #5756ff 55%, #3e43e9 100%);
    color: #fff;
    box-shadow: 0 10px 24px var(--auth-brand-glow);
}

.auth-submit:hover {
    transform: translateY(-1px);
    box-shadow: 0 16px 32px rgba(63, 77, 255, 0.34);
}

.auth-submit.is-loading,
.auth-btn-secondary.is-loading {
    pointer-events: none;
    opacity: 0.88;
}

.auth-submit.is-loading::after,
.auth-btn-secondary.is-loading::after {
    content: "";
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.38);
    border-top-color: #ffffff;
    border-radius: 50%;
    display: inline-block;
    margin-left: 8px;
    animation: authSpin 0.8s linear infinite;
    vertical-align: middle;
}

.auth-btn-secondary.is-loading::after {
    border: 2px solid rgba(51, 65, 85, 0.25);
    border-top-color: #334155;
}

.auth-btn-secondary {
    background: #f1f5f9;
    color: #334155;
    border: 1px solid #cbd5e1;
}

.auth-btn-secondary:hover {
    background: #e2e8f0;
}

.auth-footer {
    margin-top: 16px;
    color: #64748b;
    font-size: 14px;
    font-weight: 600;
    text-align: center;
}

.auth-footer a {
    color: var(--auth-brand);
    text-decoration: none;
    font-weight: 800;
}

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

.copyright {
    margin-top: 18px;
    text-align: center;
    font-size: 12px;
    color: #94a3b8;
    font-weight: 600;
}

.auth-divider {
    margin: 8px 0 0;
    font-size: 13px;
    color: #94a3b8;
    font-weight: 700;
}

.auth-pay-summary {
    border: 1.5px solid #dbe2ec;
    border-radius: 14px;
    background: #f8fbff;
    padding: 14px 16px;
    display: flex;
    flex-direction: column;
    gap: 9px;
}

.auth-pay-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    font-size: 13px;
    line-height: 1.45;
    color: #64748b;
}

.auth-pay-row strong {
    color: #0f172a;
    font-size: 13px;
    text-align: right;
}

.auth-pay-total {
    margin-top: 4px;
    padding-top: 12px;
    border-top: 1px dashed #cbd5e1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.auth-pay-total span {
    font-size: 13px;
    color: #475569;
    font-weight: 700;
}

.auth-pay-total strong {
    font-size: 22px;
    line-height: 1;
    color: #4050ff;
    font-weight: 900;
}

.auth-pay-method {
    margin-top: 16px;
    border: 1.5px solid #dbe2ec;
    border-radius: 15px;
    padding: 14px;
    background: #fcfdff;
}

.auth-pay-method-title {
    font-size: 14px;
    font-weight: 800;
    color: #0f172a;
    display: flex;
    align-items: center;
    gap: 6px;
}

.auth-pay-method-sub {
    margin-top: 6px;
    font-size: 12px;
    line-height: 1.45;
    color: #64748b;
}

.auth-pay-method .auth-form {
    margin-top: 12px;
    gap: 12px;
}

.stripe-card-mount {
    margin-top: 12px;
    border: 1.5px solid #dbe2ec;
    border-radius: 12px;
    background: #ffffff;
    padding: 12px;
    min-height: 64px;
}

.stripe-card-error {
    margin-top: 12px;
    border-radius: 12px;
    border: 1px solid #fecaca;
    background: #fef2f2;
    color: #b91c1c;
    font-size: 12px;
    font-weight: 700;
    line-height: 1.45;
    padding: 12px 13px;
    display: flex;
    align-items: flex-start;
    gap: 7px;
}

.mp-pay-form {
    gap: 10px !important;
}

.mp-grid {
    display: grid;
    gap: 10px;
}

.mp-grid-1 {
    grid-template-columns: 1fr;
}

.mp-grid-2 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

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

.mp-label {
    font-size: 12px;
    font-weight: 700;
    color: #334155;
}

.mp-mount {
    width: 100%;
    min-height: 44px;
    border: 1.5px solid var(--auth-line);
    border-radius: 11px;
    background: #ffffff;
    padding: 11px 12px;
}

.mp-input,
.mp-select {
    height: 44px;
    border-radius: 11px;
    font-size: 14px;
    padding-left: 12px;
}

.plan-option-list {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
    margin-top: 12px !important;
}

.plan-option {
    border: 1.5px solid #e2e8f0;
    border-radius: 14px;
    padding: 10px 11px;
    transition: border-color 0.24s ease, box-shadow 0.24s ease, background-color 0.24s ease, transform 0.24s ease;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    min-height: 162px;
}

.plan-option.is-entering {
    opacity: 0;
    transform: translateX(22px);
    animation: planIn 0.62s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.plan-option:hover {
    border-color: #b7c5ff;
    transform: translateY(-1px);
}

.plan-option.is-selected {
    border-color: #5465ff;
    background: #eef2ff;
    box-shadow: 0 8px 20px rgba(84, 101, 255, 0.12);
}

.plan-option-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 8px;
    margin-bottom: 3px;
}

.plan-name {
    font-size: 13px;
    font-weight: 800;
    color: #0f172a;
    line-height: 1.1;
}

.plan-desc {
    margin-top: 3px;
    font-size: 10px;
    color: #64748b;
    line-height: 1.28;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    min-height: 26px;
}

.plan-price-wrap {
    text-align: right;
    min-width: 94px;
}

.plan-price {
    font-size: 21px;
    font-weight: 900;
    color: #4050ff;
    line-height: 1;
}

.plan-price-cycle {
    margin-top: 2px;
    font-size: 10px;
    color: #64748b;
}

.plan-base {
    margin-top: 4px;
    font-size: 10px;
    color: #64748b;
    min-height: 14px;
}

.plan-base s {
    color: #94a3b8;
}

.plan-base .badge {
    margin-left: 4px;
    color: #059669;
    font-weight: 800;
}

.plan-feature-grid {
    margin-top: 6px;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 4px 8px;
    margin-top: auto;
    padding-top: 5px;
}

.plan-feature-item {
    font-size: 10px;
    color: #475569;
    display: flex;
    align-items: flex-start;
    gap: 4px;
    min-height: 24px;
    line-height: 1.22;
}

.plan-feature-item i {
    margin-top: 2px;
    font-size: 9px;
}

.plan-feature-item i.enabled {
    color: #059669;
}

.plan-feature-item i.disabled {
    color: #cbd5e1;
}

.auth-step-pills {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 2px;
}

.auth-step-pill {
    padding: 6px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 800;
    background: #f1f5f9;
    color: #64748b;
}

.auth-step-pill.is-active {
    background: #e0e7ff;
    color: #3730a3;
}

.register-step {
    opacity: 1;
    transform: translateX(0);
    transition: opacity 0.34s ease, transform 0.46s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.register-step.is-entering-right {
    opacity: 0;
    transform: translateX(24px);
}

.register-step.is-entering-left {
    opacity: 0;
    transform: translateX(-24px);
}

.register-step.is-leaving-left {
    opacity: 0;
    transform: translateX(-24px);
}

.register-step.is-leaving-right {
    opacity: 0;
    transform: translateX(24px);
}

#registerStepAccount .form-group:last-of-type {
    margin-bottom: 18px;
}

.register-next-btn {
    margin-top: 14px;
}

.register-step-plan-terms {
    margin-top: 18px;
}

.register-step-plan-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-top: 20px;
    margin-bottom: 16px;
}

.hidden {
    display: none !important;
}

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

@keyframes authSpin {
    to {
        transform: rotate(360deg);
    }
}

@keyframes planIn {
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@media (max-width: 1320px) {
    .plan-option-list {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (max-width: 980px) {
    .auth-shell,
    .auth-shell.auth-shell-wide {
        min-height: auto;
        grid-template-columns: 1fr;
        transition: none;
    }

    .auth-visual {
        min-height: 320px;
    }

    .auth-form-pane {
        padding: 24px 20px 24px;
    }

    .auth-shell.auth-shell-wide.is-plan-step {
        grid-template-columns: 1fr;
    }

    .auth-shell.auth-shell-wide.is-plan-step .auth-visual {
        display: none;
    }

    .auth-shell.auth-shell-wide.is-plan-step .auth-form-pane {
        padding-left: 20px;
        padding-right: 20px;
    }

    .form-wrap.form-wrap-lg {
        max-height: none;
        overflow: visible;
        padding-right: 0;
    }

    .plan-option-list {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .mp-grid-2 {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 620px) {
    .auth-page {
        padding: 0;
    }

    .auth-shell,
    .auth-shell.auth-shell-wide {
        border-radius: 0;
        min-height: 100vh;
        border: 0;
    }

    .auth-visual {
        min-height: 48vh;
    }

    .visual-inner {
        padding: 24px 22px 24px;
    }

    .auth-form-pane {
        padding: 20px 16px 26px;
    }

    .plan-feature-grid {
        grid-template-columns: 1fr;
    }

    .plan-option-list {
        grid-template-columns: 1fr;
    }

    .register-step-plan-actions {
        grid-template-columns: 1fr;
    }
}
