/* ==========================================================================
   MBTI flow UI v1 — result panel, account popup, sign-in, progress steps.
   Brand: The Private Clinic greens (matches the typeform test + account app).
   Every rule is scoped to .mbti-flow so nothing leaks into the theme.
   ========================================================================== */

.mbti-flow,
.mbti-flow * { box-sizing: border-box; }

.mbti-flow {
    --mf-ink: #1f2937;
    --mf-muted: #6b7280;
    --mf-green: #2d6a4f;
    --mf-green-2: #3d7050;
    --mf-green-3: #549263;
    --mf-deep: #1b4332;
    --mf-mint: #d8f3dc;
    --mf-soft: #f4f7f5;
    --mf-line: #e2ece6;
    --mf-red: #b42318;
    font-family: inherit;
    color: var(--mf-ink);
    line-height: 1.55;
    text-align: start;
}

/* ── Card ───────────────────────────────────────────────────────────────────────── */
.mbti-flow-card {
    background: #fff;
    border: 1px solid var(--mf-line);
    border-radius: 22px;
    box-shadow: 0 18px 50px rgba(27, 67, 50, .12);
    overflow: hidden;
    max-width: 560px;
    margin: 28px auto;
    animation: mf-in .35s ease both;
}
@keyframes mf-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

.mbti-flow-head {
    background: linear-gradient(135deg, var(--mf-deep) 0%, var(--mf-green) 100%);
    color: #fff;
    padding: 22px 24px 20px;
    position: relative;
}
.mbti-flow-kicker {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(255, 255, 255, .16);
    color: var(--mf-mint);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: .06em;
    text-transform: uppercase;
    padding: 4px 10px;
    border-radius: 999px;
}
.mbti-flow-title {
    margin: 10px 0 4px !important;
    font-size: 20px !important;
    font-weight: 800 !important;
    line-height: 1.3 !important;
    color: #fff !important;
}
.mbti-flow-sub {
    margin: 0 !important;
    font-size: 14px;
    color: rgba(255, 255, 255, .86);
}
.mbti-flow-body { padding: 20px 24px 24px; }
.mbti-flow-body > p { margin: 0 0 12px; font-size: 14px; color: #374151; }

/* Status icon in the header */
.mbti-flow-badge {
    width: 46px; height: 46px;
    border-radius: 50%;
    background: rgba(255, 255, 255, .14);
    display: flex; align-items: center; justify-content: center;
    font-size: 22px;
    margin-bottom: 10px;
}
.mbti-flow-spin {
    width: 22px; height: 22px;
    border: 3px solid rgba(255, 255, 255, .3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: mf-spin .8s linear infinite;
}
@keyframes mf-spin { to { transform: rotate(360deg); } }

/* ── Progress steps ───────────────────────────────────────────────────────────────── */
.mbti-flow-steps {
    display: flex;
    align-items: flex-start;
    gap: 4px;
    margin: 4px 0 16px;
}
.mbti-flow-step { flex: 1 1 0; min-width: 0; text-align: center; }
.mbti-flow-step i {
    display: inline-flex; align-items: center; justify-content: center;
    width: 24px; height: 24px;
    border-radius: 50%;
    font-style: normal; font-size: 12px; font-weight: 800;
}
.mbti-flow-step b { display: block; margin-top: 6px; font-size: 12px; font-weight: 700; color: var(--mf-deep); line-height: 1.3; }
.mbti-flow-step small { display: block; font-size: 11px; color: var(--mf-muted); line-height: 1.3; }
.mbti-flow-step.is-done i { background: var(--mf-green); color: #fff; }
.mbti-flow-step.is-now i { background: #fff; border: 2px solid var(--mf-green); box-shadow: 0 0 0 4px var(--mf-mint); }
.mbti-flow-step.is-now i::after { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--mf-green); animation: mf-pulse 1.4s ease-in-out infinite; }
.mbti-flow-step.is-next i { background: #fff; border: 2px dashed #a7c4b5; }
.mbti-flow-step.is-next b { color: var(--mf-muted); }
.mbti-flow-bar { flex: 0 0 16px; height: 2px; background: #cfe3d6; margin-top: 11px; }
@keyframes mf-pulse { 50% { opacity: .35; } }

/* ── Fields ───────────────────────────────────────────────────────────────────────── */
.mbti-flow-field { margin: 0 0 14px; }
.mbti-flow-field label {
    display: block;
    font-size: 13px; font-weight: 700; color: #374151;
    margin: 0 0 6px;
}
.mbti-flow-input,
.mbti-flow select {
    width: 100%;
    height: 48px;
    padding: 0 14px;
    border: 1.5px solid #d1d9d4;
    border-radius: 12px;
    background: #fff;
    font: inherit; font-size: 15px; color: var(--mf-ink);
    transition: border-color .15s, box-shadow .15s;
}
.mbti-flow-input:focus,
.mbti-flow select:focus { outline: none; border-color: var(--mf-green-3); box-shadow: 0 0 0 4px rgba(84, 146, 99, .18); }
.mbti-flow-dob { display: flex; gap: 8px; }
.mbti-flow-dob select { flex: 1; min-width: 0; padding: 0 8px; }
.mbti-flow-pw { position: relative; }
.mbti-flow-pw .mbti-flow-input { padding-inline-end: 64px; }
.mbti-flow-pw button {
    position: absolute; top: 50%; inset-inline-end: 8px; transform: translateY(-50%);
    background: none; border: 0; padding: 6px 8px;
    font: inherit; font-size: 12px; font-weight: 700; color: var(--mf-green);
    cursor: pointer;
}

.mbti-flow-email {
    display: flex; align-items: center; justify-content: space-between; gap: 10px;
    background: var(--mf-soft);
    border: 1px solid var(--mf-line);
    border-radius: 12px;
    padding: 10px 14px;
    margin: 0 0 14px;
    font-size: 14px;
}
.mbti-flow-email strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; direction: ltr; }

/* ── Buttons ──────────────────────────────────────────────────────────────────────── */
.mbti-flow-btn {
    display: flex; align-items: center; justify-content: center; gap: 8px;
    width: 100%;
    min-height: 50px;
    padding: 12px 18px;
    border: 0;
    border-radius: 14px;
    background: linear-gradient(135deg, var(--mf-green-3), var(--mf-green-2));
    color: #fff !important;
    font: inherit; font-size: 15px; font-weight: 700;
    text-decoration: none !important;
    cursor: pointer;
    box-shadow: 0 6px 18px rgba(61, 112, 80, .3);
    transition: transform .15s, box-shadow .15s, opacity .15s;
}
.mbti-flow-btn:hover { transform: translateY(-1px); box-shadow: 0 10px 24px rgba(61, 112, 80, .38); }
.mbti-flow-btn:disabled { opacity: .6; cursor: wait; transform: none; }
.mbti-flow-btn .mbti-flow-spin { width: 16px; height: 16px; border-width: 2px; }
.mbti-flow-btn--ghost {
    background: #fff;
    color: var(--mf-deep) !important;
    border: 1.5px solid #cfdcd4;
    box-shadow: none;
}
.mbti-flow-btn--ghost:hover { border-color: var(--mf-green-3); box-shadow: none; }
.mbti-flow-btn + .mbti-flow-btn { margin-top: 10px; }

.mbti-flow-links {
    display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 18px;
    margin: 14px 0 0;
    font-size: 13px;
}
.mbti-flow-link {
    background: none; border: 0; padding: 0;
    font: inherit; font-size: 13px; font-weight: 700;
    color: var(--mf-green) !important;
    text-decoration: underline; text-underline-offset: 3px;
    cursor: pointer;
}
.mbti-flow-or {
    display: flex; align-items: center; gap: 10px;
    margin: 14px 0; color: var(--mf-muted); font-size: 12px;
}
.mbti-flow-or::before, .mbti-flow-or::after { content: ""; flex: 1; height: 1px; background: var(--mf-line); }

/* ── Notices ──────────────────────────────────────────────────────────────────────── */
.mbti-flow-alert {
    border-radius: 12px;
    padding: 11px 14px;
    margin: 0 0 14px;
    font-size: 14px; font-weight: 600;
    background: #fef3f2; border: 1px solid #fecdca; color: var(--mf-red);
}
.mbti-flow-alert--ok { background: var(--mf-soft); border-color: var(--mf-line); color: var(--mf-deep); }
.mbti-flow-ref { display: block; margin-top: 4px; font-size: 11px; font-weight: 500; opacity: .7; }
.mbti-flow-foot {
    margin: 14px 0 0 !important;
    font-size: 12px !important; color: var(--mf-muted) !important;
    text-align: center;
}
.mbti-flow-list { list-style: none; margin: 0 0 16px; padding: 0; }
.mbti-flow-list li {
    display: flex; gap: 10px; align-items: flex-start;
    padding: 9px 0; font-size: 14px; color: #374151;
    border-bottom: 1px solid var(--mf-line);
}
.mbti-flow-list li:last-child { border-bottom: 0; }
.mbti-flow-list span { flex: 0 0 22px; text-align: center; }

/* ── Popup ────────────────────────────────────────────────────────────────────────── */
#mbt-account-modal.mbti-flow {
    display: none;
    position: fixed; inset: 0;
    z-index: 999999;
    background: rgba(10, 26, 18, .72);
    -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
    align-items: center; justify-content: center;
    padding: 16px;
}
#mbt-account-modal .mbti-flow-card {
    width: 100%; max-width: 460px;
    max-height: calc(100vh - 32px);
    overflow-y: auto;
    margin: 0;
}
.mbti-flow-close {
    position: absolute; top: 12px; inset-inline-end: 12px;
    width: 34px; height: 34px;
    border: 0; border-radius: 50%;
    background: rgba(255, 255, 255, .14);
    color: #fff; font-size: 16px; line-height: 1;
    cursor: pointer;
}
.mbti-flow-close:hover { background: rgba(255, 255, 255, .24); }
.mbti-flow-type {
    display: inline-block;
    margin-top: 10px;
    font-size: 30px; font-weight: 900; letter-spacing: 5px; line-height: 1;
}

/* ── Page bits (status hint, field errors, privacy line, link notice) ───── */
.mbti-app #mbti-account-status {
    border-radius: 12px !important;
    border: 1px solid #d6e9dd;
}
.mbti-flow-fielderr { margin: 6px 0 0; font-size: 13px; font-weight: 600; color: #b42318; }
.mbti-flow-privacy { margin: 12px auto 0; max-width: 520px; font-size: 12px; color: #6b7280; line-height: 1.6; text-align: center; }
.mbti-flow-privacy a { color: #2d6a4f; text-decoration: underline; }
.mbti-flow-notice { max-width: 560px; margin: 0 auto 18px; }

/* ── RTL + small screens ──────────────────────────────────────────────────────────────── */
.mbti-flow[dir="rtl"], [dir="rtl"] .mbti-flow { text-align: right; }
.mbti-flow[dir="rtl"] .mbti-flow-email strong { text-align: left; }
@media (max-width: 480px) {
    .mbti-flow-card { margin: 18px 0; border-radius: 18px; }
    .mbti-flow-head { padding: 20px 18px 18px; }
    .mbti-flow-body { padding: 18px 18px 20px; }
    .mbti-flow-title { font-size: 18px !important; }
    #mbt-account-modal.mbti-flow { padding: 10px; align-items: flex-end; }
    #mbt-account-modal .mbti-flow-card { max-height: calc(100vh - 20px); }
}
@media (prefers-reduced-motion: reduce) {
    .mbti-flow-card, .mbti-flow-step.is-now i::after, .mbti-flow-spin { animation: none; }
}

/* ── Results stay hidden while they go to the account ───────────────────── */
body.mbti-report-mode .mbti-app #results,
body.mbti-report-mode .mbti-app #scroll-down { display: none !important; }

/* ── Birth details box on the test page: brand colours, stack on phones ─── */
.mbti-app .mbti-birth-info { background: #f4f7f5 !important; border-color: #d6e9dd !important; border-radius: 18px !important; padding: 22px !important; }
.mbti-app .mbti-birth-info h3 { color: #1b4332 !important; }
.mbti-app .mbti-birth-info > div[style*="border-top"] { border-top-color: #d6e9dd !important; }
.mbti-app #mbti_want_account { accent-color: #2d6a4f !important; }
.mbti-app #mbti-account-checkbox-label strong { color: #1b4332 !important; }
@media (max-width: 760px) { .mbti-app .mbti-birth-info > div[style*="grid-template-columns"] { grid-template-columns: 1fr 1fr !important; } }
@media (max-width: 480px) { .mbti-app .mbti-birth-info > div[style*="grid-template-columns"] { grid-template-columns: 1fr !important; } }
.mbti-app .mbti-birth-info select,
.mbti-app .mbti-birth-info input[type="text"] { min-height: 42px; border-radius: 10px !important; }
