/* Shared styles for the full-screen application questionnaires.
 *
 * Used by join-beta.html (consumer beta access) and join-coach-apply.html (founding coach
 * beta). Both are standalone public pages outside the SPA, so they carry their own tokens
 * rather than importing the app design system.
 *
 * Anything specific to one questionnaire belongs in that page, not here. */

:root {
    --primary:        #405C85;
    --primary-dark:   #2d4361;
    --primary-bg:     rgba(64, 92, 133, 0.08);
    --primary-border: rgba(64, 92, 133, 0.30);

    --text-primary:   #1d1d1f;
    --text-secondary: #4a4a4f;
    --text-muted:     #86868b;

    --bg-page:        #ffffff;
    --bg-surface:     #ffffff;
    --bg-alt:         #f5f5f7;

    --border:         #d2d2d7;
    --border-subtle:  #e5e5ea;

    --success:        #34c759;
    --danger:         #ff3b30;

    --font: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Helvetica Neue', Arial, sans-serif;

    --r-sm:   8px;
    --r-md:   14px;
    --r-lg:   20px;
    --r-pill: 999px;

    --ease: 0.2s ease;
}

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

html, body {
    height: 100%;
    font-family: var(--font);
    background: var(--bg-page);
    color: var(--text-primary);
    overflow: hidden;
}

/* ── Shell ────────────────────────────────────────────────────── */
.shell {
    position: fixed;
    inset: 0;
    display: flex;
    flex-direction: column;
    background: var(--bg-page);
}

/* ── Header ───────────────────────────────────────────────────── */
.shell-header {
    flex-shrink: 0;
    padding: 16px 20px 0;
    background: var(--bg-page);
    border-bottom: 1px solid var(--border-subtle);
}
.header-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}
.header-logo {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-primary);
    text-decoration: none;
    letter-spacing: -0.01em;
}
.header-logo > span { color: var(--brand-accent); }
.header-section {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    letter-spacing: 0.02em;
}
@media (max-width: 640px) {
    .header-section { display: none; }
}
.header-close {
    font-size: 18px;
    color: var(--text-muted);
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: var(--r-sm);
    line-height: 1;
    transition: color var(--ease), background var(--ease);
    text-decoration: none;
}
.header-close:hover {
    color: var(--text-primary);
    background: var(--bg-alt);
}

.progress-track {
    height: 3px;
    background: var(--border-subtle);
    border-radius: var(--r-pill);
    margin-bottom: 10px;
    overflow: hidden;
}
.progress-fill {
    height: 100%;
    background: var(--primary);
    border-radius: var(--r-pill);
    transition: width 0.35s ease;
}
.step-counter {
    font-size: 11px;
    color: var(--text-muted);
    padding-bottom: 10px;
}

/* ── Main content area ────────────────────────────────────────── */
.shell-main {
    flex: 1;
    overflow-y: auto;
    padding: 28px 20px 16px;
    display: flex;
    justify-content: center;
}
.step-content {
    width: 100%;
    max-width: 520px;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.step-q {
    font-size: 22px;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.3;
}
.step-sub {
    font-size: 14px;
    color: var(--text-muted);
    line-height: 1.6;
    margin-top: -14px;
}

/* ── Chips ────────────────────────────────────────────────────── */
.chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.chip {
    padding: 9px 16px;
    border-radius: var(--r-pill);
    border: 1.5px solid var(--border);
    background: var(--bg-surface);
    color: var(--text-primary);
    font-size: 13px;
    font-family: var(--font);
    font-weight: 400;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s, color 0.15s;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}
.chip.is-selected {
    border-color: var(--primary);
    background: var(--primary-bg);
    color: var(--primary);
    font-weight: 600;
}

/* ── "Other" free-text chip ──────────────────────────────────── */
.chip-other-input {
    display: none;
    padding: 9px 16px;
    font-size: 13px;
    font-family: var(--font);
    color: var(--text-primary);
    background: var(--bg-surface);
    border: 1.5px solid var(--border);
    border-radius: var(--r-pill);
    outline: none;
    min-width: 90px;
    max-width: 100%;
    transition: border-color 0.15s, background 0.15s, color 0.15s, width 0.15s ease;
}
.chip-other-input.is-visible { display: inline-block; }
.chip-other-input:focus { border-color: var(--primary); }
.chip-other-input::placeholder { color: var(--text-muted); }
.chip-other-input.has-value {
    border-color: var(--primary);
    background: var(--primary-bg);
    color: var(--primary);
    font-weight: 600;
}

/* ── Required field marker (specificity must beat ".field-label span") ── */
.field-label .required-mark {
    color: var(--danger);
    font-weight: 700;
    margin-left: 2px;
}

/* ── Feature chips (icon in front + info tooltip) ──────────────── */
.feature-chip {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 34px 10px 12px;
}
.feature-chip-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--primary);
    flex-shrink: 0;
}
.feature-chip-icon svg { width: 18px; height: 18px; display: block; }
.feature-chip-label { line-height: 1; }
.feature-chip-info {
    position: absolute;
    top: 5px;
    right: 6px;
    width: 16px;
    height: 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    cursor: pointer;
    border-radius: 50%;
    transition: color var(--ease);
}
.feature-chip-info svg { width: 14px; height: 14px; display: block; }
.feature-chip-info:hover { color: var(--primary); }
.feature-tooltip {
    position: absolute;
    bottom: calc(100% + 8px);
    right: 0;
    width: 230px;
    max-width: 72vw;
    background: var(--text-primary);
    color: #fff;
    font-size: 12px;
    font-weight: 400;
    line-height: 1.45;
    text-align: left;
    padding: 9px 11px;
    border-radius: var(--r-sm);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.18);
    opacity: 0;
    visibility: hidden;
    transform: translateY(4px);
    transition: opacity 0.15s, transform 0.15s, visibility 0.15s;
    z-index: 20;
    pointer-events: none;
}
.feature-tooltip.is-open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

/* ── Textarea ─────────────────────────────────────────────────── */
.field-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 6px;
}
.field-label span {
    font-weight: 400;
    color: var(--text-muted);
}
.textarea-wrap { position: relative; }
.step-textarea {
    width: 100%;
    min-height: 100px;
    padding: 12px 14px;
    font-size: 14px;
    font-family: var(--font);
    line-height: 1.6;
    color: var(--text-primary);
    background: var(--bg-surface);
    border: 1.5px solid var(--border);
    border-radius: var(--r-md);
    resize: vertical;
    outline: none;
    transition: border-color var(--ease);
    /* Fixed width, only height (resize: vertical above) can change. overflow-x is
       belt-and-suspenders: Safari has a long-standing bug where a textarea's
       *placeholder* text ignores wrapping and forces a horizontal scrollbar even
       though typed content wraps normally, so both wrapping and clipping are set
       explicitly on the box itself and repeated on ::placeholder below. */
    overflow-x: hidden;
    white-space: pre-wrap;
    word-wrap: break-word;
    overflow-wrap: break-word;
}
.step-textarea:focus { border-color: var(--primary); }
.step-textarea::placeholder {
    color: var(--text-muted);
    white-space: pre-wrap;
    overflow-wrap: break-word;
}
.step-textarea::-webkit-input-placeholder {
    white-space: pre-wrap;
    overflow-wrap: break-word;
}
.step-textarea.is-error { border-color: var(--danger); }
.char-count {
    font-size: 11px;
    color: var(--text-muted);
    text-align: right;
    margin-top: 4px;
}
.char-count.is-ok { color: var(--success); }

/* ── Contact fields ───────────────────────────────────────────── */
.field-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.field-input {
    width: 100%;
    padding: 11px 14px;
    font-size: 14px;
    font-family: var(--font);
    color: var(--text-primary);
    background: var(--bg-surface);
    border: 1.5px solid var(--border);
    border-radius: var(--r-md);
    outline: none;
    transition: border-color var(--ease);
}
.field-input:focus { border-color: var(--primary); }
.field-input::placeholder { color: var(--text-muted); }
.field-input.is-error { border-color: var(--danger); }

.whatsapp-row {
    display: flex;
    gap: 8px;
}
.country-select {
    flex-shrink: 0;
    width: 130px;
    padding: 11px 10px;
    font-size: 14px;
    font-family: var(--font);
    color: var(--text-primary);
    background: var(--bg-surface);
    border: 1.5px solid var(--border);
    border-radius: var(--r-md);
    outline: none;
    transition: border-color var(--ease);
    cursor: pointer;
}
.country-select:focus { border-color: var(--primary); }
.optional-label {
    font-size: 12px;
    color: var(--text-muted);
    font-style: italic;
}

/* ── Validation error message ─────────────────────────────────── */
.step-error {
    font-size: 13px;
    color: var(--danger);
    background: rgba(255, 59, 48, 0.07);
    border: 1px solid rgba(255, 59, 48, 0.2);
    border-radius: var(--r-sm);
    padding: 10px 12px;
    display: none;
}
.step-error.is-visible {
    display: block;
    margin-bottom: 20px;
}
/* ── Intro cover screen (shown before step 1) ───────────────────── */
.intro-screen {
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    gap: 20px;
    padding: 40px 20px;
    flex: 1;
}
.intro-screen.is-visible { display: flex; }

/* ── Success screen ───────────────────────────────────────────── */
.success-screen {
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    gap: 20px;
    padding: 40px 20px;
    flex: 1;
}
.success-screen.is-visible { display: flex; }
.success-icon {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background: rgba(52, 199, 89, 0.12);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 36px;
}
.success-title {
    font-size: 26px;
    font-weight: 700;
    color: var(--text-primary);
}
.success-sub {
    font-size: 15px;
    color: var(--text-muted);
    line-height: 1.6;
    max-width: 380px;
}
.success-screen .success-sub {
    color: var(--text-primary);
}
.btn-home {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    font-weight: 600;
    font-family: var(--font);
    color: #fff;
    background: var(--primary);
    border: none;
    border-radius: var(--r-pill);
    padding: 13px 28px;
    cursor: pointer;
    text-decoration: none;
    transition: background var(--ease);
}
.btn-home:hover { background: var(--primary-dark); }

/* ── Footer ───────────────────────────────────────────────────── */
.shell-footer {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 20px;
    border-top: 1px solid var(--border-subtle);
    background: var(--bg-page);
}
.footer-left { display: flex; gap: 8px; }
.footer-right { display: flex; gap: 8px; align-items: center; }

.btn-back {
    font-size: 14px;
    font-weight: 500;
    font-family: var(--font);
    color: var(--text-muted);
    background: none;
    border: none;
    cursor: pointer;
    padding: 10px 14px;
    border-radius: var(--r-pill);
    transition: color var(--ease), background var(--ease);
    display: none;
}
.btn-back.is-visible { display: block; }
.btn-back:hover {
    color: var(--text-primary);
    background: var(--bg-alt);
}

.btn-continue {
    font-size: 14px;
    font-weight: 600;
    font-family: var(--font);
    color: #fff;
    background: var(--primary);
    border: none;
    border-radius: var(--r-pill);
    padding: 12px 24px;
    cursor: pointer;
    transition: background var(--ease), opacity var(--ease);
}
.btn-continue:hover { background: var(--primary-dark); }
.btn-continue:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Submitting spinner state */
.btn-continue.is-loading {
    opacity: 0.7;
    cursor: not-allowed;
}
