/* Bravelis auth screens (login + register), shared glass design system */

:root {
    --bg-0: #05070c;
    --bg-1: #0b0f18;
    --panel: rgba(255, 255, 255, 0.055);
    --panel-strong: rgba(255, 255, 255, 0.09);
    --panel-input: rgba(255, 255, 255, 0.06);
    --panel-input-focus: rgba(255, 255, 255, 0.1);
    --text: #f3f6fa;
    --text-dim: #9aa7b8;
    --text-faint: #6b7686;
    --accent-a: #38bdf8;
    --accent-b: #34d399;
    --accent-grad: linear-gradient(135deg, #38bdf8 0%, #34d399 100%);
    --danger: #f87171;
    --danger-bg: rgba(248, 113, 113, 0.12);
    --success: #34d399;
    --success-bg: rgba(52, 211, 153, 0.12);
    --radius-lg: 28px;
    --radius-md: 16px;
    --radius-sm: 12px;
    --ease: cubic-bezier(0.16, 1, 0.3, 1);
}

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

html, body {
    height: 100%;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    color: var(--text);
    background: var(--bg-0);
    min-height: 100vh;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

/* ---------- animated backdrop ---------- */

.backdrop {
    position: fixed;
    inset: 0;
    z-index: 0;
    background: radial-gradient(circle at 15% 20%, rgba(56, 189, 248, 0.16), transparent 45%),
                radial-gradient(circle at 85% 80%, rgba(52, 211, 153, 0.14), transparent 45%),
                linear-gradient(160deg, var(--bg-1) 0%, var(--bg-0) 100%);
}

.backdrop span {
    position: absolute;
    border-radius: 50%;
    filter: blur(60px);
    opacity: 0.35;
    animation: float 22s var(--ease) infinite alternate;
}

.backdrop span:nth-child(1) {
    width: 420px;
    height: 420px;
    top: -120px;
    left: -100px;
    background: var(--accent-a);
}

.backdrop span:nth-child(2) {
    width: 380px;
    height: 380px;
    bottom: -140px;
    right: -80px;
    background: var(--accent-b);
    animation-delay: -8s;
}

.backdrop span:nth-child(3) {
    width: 260px;
    height: 260px;
    top: 40%;
    left: 60%;
    background: var(--accent-a);
    opacity: 0.18;
    animation-delay: -14s;
}

@keyframes float {
    from { transform: translate(0, 0) scale(1); }
    to { transform: translate(40px, 30px) scale(1.08); }
}

@media (prefers-reduced-motion: reduce) {
    .backdrop span { animation: none; }
}

/* ---------- shell layout ---------- */

.shell {
    position: relative;
    z-index: 1;
    min-height: 100vh;
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
}

.brand-pane {
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 64px 72px;
    overflow: hidden;
    background: linear-gradient(150deg, rgba(56, 189, 248, 0.16), rgba(52, 211, 153, 0.1) 60%, transparent 100%);
}

.brand-pane .glow {
    position: absolute;
    inset: 0;
    background:
        radial-gradient(600px circle at 20% 15%, rgba(56, 189, 248, 0.22), transparent 60%),
        radial-gradient(500px circle at 90% 90%, rgba(52, 211, 153, 0.18), transparent 60%);
    pointer-events: none;
}

.brand-mark {
    display: flex;
    align-items: center;
    gap: 12px;
    position: relative;
    z-index: 1;
}

.brand-mark .logo-icon {
    width: 42px;
    height: 42px;
    flex-shrink: 0;
}

.brand-mark .logo-text {
    font-size: 22px;
    font-weight: 700;
    letter-spacing: 0.2px;
}

.brand-copy {
    position: relative;
    z-index: 1;
    margin-top: 56px;
    max-width: 420px;
}

.brand-copy h1 {
    font-size: 34px;
    line-height: 1.25;
    font-weight: 700;
    background: linear-gradient(135deg, #ffffff, #c7d2df);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.brand-copy p {
    margin-top: 16px;
    color: var(--text-dim);
    font-size: 15.5px;
    line-height: 1.6;
}

.brand-features {
    position: relative;
    z-index: 1;
    margin-top: 40px;
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.brand-features li {
    list-style: none;
    display: flex;
    align-items: center;
    gap: 14px;
    color: var(--text-dim);
    font-size: 14.5px;
}

.brand-features .check {
    width: 26px;
    height: 26px;
    flex-shrink: 0;
    border-radius: 50%;
    background: var(--panel-strong);
    display: flex;
    align-items: center;
    justify-content: center;
}

.brand-features .check svg {
    width: 13px;
    height: 13px;
}

/* ---------- form pane ---------- */

.form-pane {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 48px 32px;
}

.card {
    view-transition-name: auth-card;
    width: 100%;
    min-width: 0;
    max-width: 440px;
    background: var(--panel);
    backdrop-filter: blur(28px);
    -webkit-backdrop-filter: blur(28px);
    border-radius: var(--radius-lg);
    padding: 44px 40px;
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.35);
}

.card-mobile-mark {
    display: none;
    align-items: center;
    gap: 10px;
    margin-bottom: 28px;
}

.card-mobile-mark .logo-icon {
    width: 32px;
    height: 32px;
}

.card-mobile-mark .logo-text {
    font-size: 18px;
    font-weight: 700;
}

.card-head h2 {
    font-size: 26px;
    font-weight: 700;
}

.card-head p {
    margin-top: 8px;
    color: var(--text-dim);
    font-size: 14.5px;
}

/* ---------- step progress ---------- */

.steps {
    display: flex;
    gap: 8px;
    margin: 26px 0 4px;
}

.steps .seg {
    flex: 1;
    height: 4px;
    border-radius: 4px;
    background: var(--panel-strong);
    overflow: hidden;
}

.steps .seg i {
    display: block;
    height: 100%;
    width: 0%;
    background: var(--accent-grad);
    border-radius: 4px;
    transition: width 0.5s var(--ease);
}

.steps .seg.done i,
.steps .seg.active i {
    width: 100%;
}

/* ---------- step viewport (slide transitions) ---------- */

.step-viewport {
    position: relative;
    margin-top: 24px;
    overflow: hidden;
}

.step-track {
    display: flex;
    width: 300%;
    transition: transform 0.5s var(--ease);
    will-change: transform;
}

.step-track[data-step="1"] { transform: translateX(0%); }
.step-track[data-step="2"] { transform: translateX(-33.3333%); }
.step-track[data-step="3"] { transform: translateX(-66.6667%); }

.step-panel {
    width: 33.3333%;
    flex-shrink: 0;
    padding-right: 2px;
}

/* ---------- form fields ---------- */

.field {
    position: relative;
    margin-bottom: 18px;
    margin: 8px;
}

.field-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 14px;
}

.field label {
    display: block;
    font-size: 12.5px;
    font-weight: 600;
    color: var(--text-dim);
    margin-bottom: 8px;
    letter-spacing: 0.2px;
}

.input-wrap {
    position: relative;
    display: flex;
    align-items: center;
    background: var(--panel-input);
    border-radius: 24px;
    transition: background 0.25s var(--ease), box-shadow 0.25s var(--ease);
    box-shadow: 0 0 0 1.5px transparent;
    padding: 10px;
}

.input-wrap:focus-within {
    background: var(--panel-input-focus);
    box-shadow: 0 0 0 1.5px rgba(56, 189, 248, 0.55), 0 0 24px rgba(56, 189, 248, 0.12);
}

.input-wrap .icon {
    width: 18px;
    height: 18px;
    margin-left: 8px;
    margin-right: 8px;
    flex-shrink: 0;
    color: #b8ffcb;
    transition: color 0.25s var(--ease);
}

.input-wrap:focus-within .icon {
    color: var(--accent-a);
}

.input-wrap input,
.input-wrap select,
.input-wrap textarea {
    width: 100%;
    min-width: 0;
    background: transparent;
    color: #a6b8cf;
    font-size: 14.5px;
    padding: 8px 8px;
    outline: none;
    font-family: inherit;
    resize: none;
    border-radius: inherit;
    border: none;
    box-shadow: none;
}

.input-wrap textarea {
    min-height: 32px;
    padding-top: 12px;
}

.input-wrap select {
    appearance: none;
    padding-right: 36px;
}

.input-wrap.has-select::after {
    content: "";
    position: absolute;
    right: 16px;
    width: 9px;
    height: 9px;
    border-radius: 10px;
    background: var(--text-faint);
    clip-path: polygon(0 0, 100% 0, 50% 100%);
    pointer-events: none;
}

.input-wrap input::placeholder,
.input-wrap textarea::placeholder {
    color: var(--text-faint);
}

.input-wrap input:-webkit-autofill,
.input-wrap input:-webkit-autofill:focus {
    -webkit-text-fill-color: var(--text);
    transition: background-color 9999s ease-in-out 0s;
}

/* ---------- phone field: country code + national number ---------- */

.phone-wrap .phone-country {
    appearance: none;
    background: transparent;
    color: var(--text);
    font-family: inherit;
    font-size: 13px;
    padding: 14px 4px 14px 10px;
    width: 108px;
    min-width: 0;
    flex-shrink: 0;
    outline: none;
    cursor: pointer;
    text-overflow: ellipsis;
}

.phone-wrap .phone-country option {
    color: #0b0f18;
}

.phone-wrap .phone-dial {
    flex-shrink: 0;
    font-size: 14px;
    color: var(--text-dim);
    padding: 0 8px 0 4px;
}

.phone-wrap .phone-national {
    flex: 1;
    min-width: 0;
    padding-left: 10px;
}

/* ---------- date of birth: day / month / year ---------- */

.dob-field {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr) minmax(0, 1fr);
    gap: 10px;
}

.dob-field select {
    appearance: none;
    width: 100%;
    min-width: 0;
    background: var(--panel-input);
    color: var(--text);
    font-family: inherit;
    font-size: 14px;
    padding: 14px 12px;
    border-radius: var(--radius-sm);
    outline: none;
    cursor: pointer;
    box-shadow: 0 0 0 1.5px transparent;
    transition: box-shadow 0.2s var(--ease), background 0.2s var(--ease);
}

.dob-field select:focus {
    background: var(--panel-input-focus);
    box-shadow: 0 0 0 1.5px rgba(56, 189, 248, 0.55);
}

.dob-field select option { color: #0b0f18; }

/* ---------- document upload tiles ---------- */

.id-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}

.upload-tile {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 104px;
    padding: 14px;
    border-radius: var(--radius-sm);
    background: var(--panel-input);
    box-shadow: inset 0 0 0 1.5px rgba(255, 255, 255, 0.09);
    cursor: pointer;
    overflow: hidden;
    transition: box-shadow 0.2s var(--ease), background 0.2s var(--ease);
}

.upload-tile:hover { background: var(--panel-input-focus); }

.upload-tile.filled {
    box-shadow: inset 0 0 0 1.5px rgba(52, 211, 153, 0.6);
}

.upload-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    color: var(--text-faint);
    text-align: center;
    position: relative;
    z-index: 1;
}

.upload-inner svg { width: 22px; height: 22px; }
.upload-text { font-size: 12.5px; }

.upload-preview {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.upload-tile.filled .upload-inner {
    color: #bbf7d0;
    background: rgba(6, 37, 29, 0.55);
    padding: 6px 10px;
    border-radius: 8px;
    backdrop-filter: blur(2px);
}

.eye-toggle {
    background: transparent;
    border: none;
    padding: 0 16px;
    display: flex;
    align-items: center;
    color: var(--text-faint);
    cursor: pointer;
}

.eye-toggle svg {
    width: 18px;
    height: 18px;
}

.eye-toggle:hover {
    color: var(--text-dim);
}

.field-hint {
    margin-top: 7px;
    font-size: 12px;
    color: var(--text-faint);
}

.field-error {
    margin-top: 7px;
    font-size: 12px;
    color: var(--danger);
    display: none;
}

.field.invalid .input-wrap {
    box-shadow: 0 0 0 1.5px rgba(248, 113, 113, 0.6);
}

.field.invalid .field-error {
    display: block;
}

/* ---------- terms row ---------- */

.terms-row {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin: 20px 0 6px;
}

.terms-row input[type="checkbox"] {
    appearance: none;
    width: 19px;
    height: 19px;
    border-radius: 6px;
    background: var(--panel-input);
    flex-shrink: 0;
    margin-top: 1px;
    cursor: pointer;
    position: relative;
    transition: background 0.2s var(--ease), box-shadow 0.2s var(--ease);
}

.terms-row input[type="checkbox"]:checked {
    background: var(--accent-grad);
}

.terms-row input[type="checkbox"]:checked::after {
    content: "";
    position: absolute;
    inset: 0;
    background-color: #06251d;
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='20 6 9 17 4 12'/%3E%3C/svg%3E") center / 60% no-repeat;
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='20 6 9 17 4 12'/%3E%3C/svg%3E") center / 60% no-repeat;
}

.terms-row label {
    font-size: 13px;
    color: var(--text-dim);
    line-height: 1.5;
}

.terms-row a {
    color: var(--accent-a);
    text-decoration: none;
}

.terms-row a:hover {
    color: var(--accent-b);
}

/* ---------- buttons ---------- */

.btn-row {
    display: flex;
    gap: 12px;
    margin-top: 26px;
}

.btn {
    flex: 1;
    border: none;
    border-radius: var(--radius-sm);
    padding: 15px 20px;
    font-size: 14.5px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: transform 0.2s var(--ease), box-shadow 0.2s var(--ease), opacity 0.2s var(--ease);
}

.btn-primary {
    background: #ffffff;
    color: #06251d;
    box-shadow: 0 12px 30px rgba(52, 211, 153, 0.22);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 16px 36px rgba(52, 211, 153, 0.3);
}

.btn-primary:disabled {
    opacity: 0.55;
    cursor: not-allowed;
    transform: none;
}

.btn-ghost {
    background: var(--panel-strong);
    color: var(--text);
    flex: 0 0 auto;
    padding-left: 22px;
    padding-right: 22px;
}

.btn-ghost:hover {
    background: rgba(255, 255, 255, 0.14);
}

.btn svg {
    width: 16px;
    height: 16px;
}

.spinner {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: conic-gradient(from 0deg, rgba(6, 37, 29, 0) 0%, #06251d 92%);
    -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 2px), #000 calc(100% - 2px));
    mask: radial-gradient(farthest-side, transparent calc(100% - 2px), #000 calc(100% - 2px));
    animation: spin 0.7s linear infinite;
    display: none;
}

.is-loading .spinner { display: inline-block; }
.is-loading .btn-label { opacity: 0.75; }

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

/* ---------- switch link ---------- */

.switch-line {
    text-align: center;
    margin-top: 26px;
    font-size: 13.5px;
    color: var(--text-dim);
}

.switch-line a {
    color: var(--accent-a);
    font-weight: 600;
    text-decoration: none;
}

.switch-line a:hover {
    color: var(--accent-b);
}

/* ---------- alert ---------- */

.alert {
    display: none;
    align-items: center;
    gap: 10px;
    padding: 13px 16px;
    border-radius: var(--radius-sm);
    font-size: 13.5px;
    margin-bottom: 20px;
    animation: alertIn 0.3s var(--ease);
}

.alert svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.alert-error {
    background: var(--danger-bg);
    color: #fecaca;
}

.alert-success {
    background: var(--success-bg);
    color: #bbf7d0;
}

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

/* ---------- page-load entrance: left side slides in from the left, right side from the right ---------- */

.brand-mark,
.brand-copy,
.brand-features {
    animation: slideInLeft 1.1s var(--ease) both;
}

.brand-mark { animation-delay: 0.05s; }
.brand-copy { animation-delay: 0.18s; }
.brand-features { animation-delay: 0.32s; }

.card-mobile-mark {
    animation: slideInLeft 0.9s var(--ease) 0.05s both;
}

.card {
    animation: slideInRight 1.1s var(--ease) 0.15s both;
}

.card-head,
.steps,
.step-viewport,
.switch-line {
    animation: fadeUp 0.8s var(--ease) both;
}

.card-head { animation-delay: 0.32s; }
.steps { animation-delay: 0.4s; }
.step-viewport { animation-delay: 0.46s; }
.switch-line { animation-delay: 0.55s; }

@keyframes slideInLeft {
    from { opacity: 0; transform: translateX(-56px); }
    to { opacity: 1; transform: translateX(0); }
}

@keyframes slideInRight {
    from { opacity: 0; transform: translateX(56px); }
    to { opacity: 1; transform: translateX(0); }
}

@keyframes fadeUp {
    from { opacity: 0; transform: translateY(16px); }
    to { opacity: 1; transform: translateY(0); }
}

@media (prefers-reduced-motion: reduce) {
    .brand-mark,
    .brand-copy,
    .brand-features,
    .card-mobile-mark,
    .card,
    .card-head,
    .steps,
    .step-viewport,
    .switch-line {
        animation: none;
    }
}

/* ---------- responsive ---------- */

@media (max-width: 960px) {
    .shell {
        grid-template-columns: minmax(0, 1fr);
    }

    .brand-pane {
        display: none;
    }

    .form-pane {
        padding: 28px 18px 40px;
        min-width: 0;
    }

    .card-mobile-mark {
        display: flex;
    }

    .card {
        padding: 34px 26px;
        max-width: 480px;
    }
}

@media (max-width: 480px) {
    .field-row {
        grid-template-columns: 1fr;
    }

    .card {
        padding: 28px 20px;
        border-radius: var(--radius-md);
    }
}

::view-transition-old(auth-card),
::view-transition-new(auth-card) {
    animation-duration: 0.4s;
    animation-timing-function: cubic-bezier(0.16, 1, 0.3, 1);
}
