/*
 * /educator-survey and its steps.
 *   Step 1:            Figma Phase 1 Ideation, "Survey Page" (22570:1716)
 *   Step 2, 3a, 3b:    Figma Phase 2 Final Design, DEV File page (31532:61 … 31532:1726)
 * Uses the site's go-* fonts, :root colour variables and the btnWhite / btnBlack
 * pill buttons from components.css. Everything is scoped to .eduSurveyForm.
 */

.eduSurveyForm {
    --esf-gradient: linear-gradient(90deg, #39B6D8 0%, #F7D344 47%, #E38330 100%);
    /* Same as --edu-gradient on /school-of-education-survey (eduSurvey.css) */
    --esf-num-gradient: linear-gradient(-80deg, #F7D344 9.5%, #E38330 104.8%);
    --esf-red: #DF2935;
    --esf-brown: #914B02;

    min-height: 100vh;
    background: var(--white3);
    color: var(--black);
    font-family: 'go-regular';

    .arrowWrap {
        display: inline-block;
    }

    /* ---------- Header ---------- */
    .esfHeader {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 16px;
        padding: 18px 80px;
        background: var(--white);
        border-bottom: 1px solid var(--grey4);
    }

    .esfBrand {
        display: flex;
        align-items: center;
        gap: 20px;
        min-width: 0;

        img {
            display: block;
            width: 148px;
            height: 30px;
        }
    }

    .esfBrandDivider {
        width: 1px;
        height: 24px;
        background: var(--grey4);
        flex-shrink: 0;
    }

    .esfBrandText {
        font: 14px/1.2 'go-medium';
        color: var(--grey3);
        white-space: nowrap;
    }

    .esfHeaderActions {
        display: flex;
        align-items: center;
        gap: 24px;
    }

    .esfHeaderMeta {
        font: 13px/1.5 'go-regular';
        color: var(--grey);
        white-space: nowrap;
    }

    .esfHeaderMobile {
        display: none;
        font: 13px/1.2 'go-medium';
        color: var(--grey3);
        white-space: nowrap;
    }

    .esfSaveExit {
        border-color: var(--grey4);
    }

    /* ---------- Progress ---------- */
    /* Step 1: one unbroken bar, gradient fill then white track */
    .esfProgress {
        height: 4px;
        background: var(--white);
        overflow: hidden;

        span {
            display: block;
            height: 100%;
            background: var(--esf-gradient);
            transition: width 0.3s ease;
        }
    }

    /* Later steps: one bar */
    .esfProgressBar {
        height: 4px;
        background: var(--grey4);
        overflow: hidden;

        span {
            display: block;
            height: 100%;
            background: var(--esf-gradient);
        }
    }

    /* ---------- Body ---------- */
    .esfBody {
        display: flex;
        align-items: flex-start;
        justify-content: space-between;
        gap: 100px;
        max-width: 1440px;
        margin: 0 auto;
        padding: 64px 80px 0;
    }

    .esfLoading {
        min-height: 60vh;
    }

    /* Rail */
    .esfRail {
        position: sticky;
        top: 32px;
        width: 380px;
        flex-shrink: 0;
        display: flex;
        flex-direction: column;
        gap: 28px;
    }

    .esfEyebrow {
        font: 13px/1.2 'go-semibold';
        color: var(--esf-brown);
        text-transform: uppercase;
    }

    .esfRailTitle {
        font: 30px/1.2 'go-regular';
        color: var(--black);
    }

    .esfRailText {
        font: 16px/1.5 'go-regular';
        color: var(--grey3);
    }

    /* "Filling in as … · Not you?": lets another person on the same device use their own details. */
    .esfFillingAs {
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        justify-content: space-between;
        gap: 6px 16px;
        margin: 0;
        padding: 12px 16px;
        border: 1px solid #E4E4E4;
        border-radius: 8px;
        background: #F7F7F5;
        font: 14px/1.5 'go-regular';
        color: var(--grey3);
        overflow-wrap: anywhere;
    }

    .esfFillingAsWho {
        min-width: 0;
    }

    .esfFillingAs strong {
        font-family: 'go-semibold';
        font-weight: normal;
        color: var(--black);
    }

    .esfNotYou {
        padding: 0;
        border: 0;
        background: none;
        font: inherit;
        font-family: 'go-semibold';
        color: var(--black);
        text-decoration: underline;
        text-underline-offset: 3px;
        cursor: pointer;
    }

    /* Step list. Figma: Phase 1 Ideation, node 22721:311 ("Steps").
       Done: grey tile + white tick. Current: yellow tile on a cream row. Upcoming: outlined tile. */
    .esfSteps {
        list-style: none;
        background: var(--white);
        border: 1px solid var(--grey4);
        border-radius: 12px;
        padding: 12px;
        display: flex;
        flex-direction: column;

        li {
            display: flex;
            align-items: center;
            gap: 14px;
            padding: 16px;
            border-radius: 8px;
        }
    }

    .esfStepNum {
        width: 56px;
        height: 57px;
        flex-shrink: 0;
        border-radius: 8px;
        border: 1.5px solid var(--grey18);
        background: var(--white);
        display: flex;
        align-items: center;
        justify-content: center;
        font: 14px/1.2 'go-semibold';
        color: var(--grey);
    }

    .esfStepLabel {
        flex: 1;
        min-width: 0;
        display: flex;
        flex-direction: column;
        gap: 2px;
    }

    .esfStepTitle {
        font: 16px/1.2 'go-regular';
        color: var(--grey);
    }

    .esfStepText {
        font: 13px/1.5 'go-regular';
        color: var(--grey);
    }

    .esfSteps li.isCurrent {
        background: #FFFBED;

        .esfStepNum {
            background: #F7D344;
            border-color: #F7D344;
            color: var(--black);
        }

        .esfStepTitle {
            font-family: 'go-semibold';
            color: var(--black);
        }
    }

    .esfSteps li.isDone {
        .esfStepNum {
            background: #BCBCBC;
            border-color: #BCBCBC;
            color: var(--white);

            /* The done tick: always white on the black circle */
            svg {
                flex-shrink: 0;
            }

            svg path {
                stroke: var(--white);
            }
        }

        .esfStepTitle {
            color: var(--black);
        }
    }

    .esfMeta {
        list-style: none;
        display: flex;
        flex-direction: column;
        gap: 10px;

        li {
            display: flex;
            align-items: center;
            gap: 10px;
            font: 13px/1.5 'go-regular';
            color: var(--grey3);

            &::before {
                content: "";
                width: 6px;
                height: 6px;
                flex-shrink: 0;
                border-radius: 50%;
                background: #F7D344;
            }
        }
    }

    /* ---------- Questions ---------- */
    .esfQuestions {
        width: 800px;
        min-width: 0;
        display: flex;
        flex-direction: column;
        gap: 16px;
    }

    .esfSection {
        display: flex;
        flex-direction: column;
        gap: 4px;
        padding: 24px 0 4px;

        &.isFirst {
            padding-top: 0;
        }
    }

    .esfSectionLabel {
        font: 13px/1.2 'go-semibold';
        color: var(--grey);
    }

    .esfSectionTitle {
        font: 24px/1.2 'go-regular';
        color: var(--black);
    }

    .esfQuestion {
        display: flex;
        gap: 16px;
        align-items: flex-start;
        padding: 32px;
        background: var(--white);
        border: 1px solid var(--grey4);
        border-radius: 12px;
        scroll-margin-top: 24px;

        &.isInvalid {
            border-color: var(--esf-red);
        }
    }

    .esfQNum {
        width: 40px;
        flex-shrink: 0;
        font: 14px/1.2 'go-semibold';
        color: var(--esf-brown);
    }

    /* "01" on desktop and mobile: the landing page's .eduGradientNum, at 20px */
    .esfQNumDesk {
        font: 20px/1.2 'go-semibold';
        background: var(--esf-num-gradient);
        -webkit-background-clip: text;
        background-clip: text;
        -webkit-text-fill-color: transparent;
    }

    .esfQBody {
        flex: 1;
        min-width: 0;
        display: flex;
        flex-direction: column;
        gap: 20px;
    }

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

    .esfQTitle {
        font: 18px/1.2 'go-semibold';
        color: var(--black);
    }

    .esfQHelper {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 12px;
    }

    .esfQHint {
        font: 14px/1.5 'go-regular';
        color: var(--grey);
    }

    .esfCounter {
        flex-shrink: 0;
        padding: 4px 10px;
        border-radius: 999px;
        background: #FDF3C7;
        font: 13px/1.2 'go-semibold';
        color: var(--esf-brown);
        white-space: nowrap;
    }

    .esfError {
        font: 13px/1.5 'go-regular';
        color: var(--esf-red);
    }

    /* Native inputs stay in the DOM (keyboard + screen readers) but are hidden */
    .esfOption input,
    .esfChip input {
        position: absolute;
        width: 1px;
        height: 1px;
        opacity: 0;
        pointer-events: none;
    }

    /* Option rows: radio, checkbox and rank */
    .esfOptions {
        display: flex;
        flex-direction: column;
        gap: 10px;

        &.isGrid {
            flex-direction: row;
            flex-wrap: wrap;
            gap: 12px;

            .esfOption {
                width: calc(50% - 6px);
            }
        }
    }

    .esfOption {
        position: relative;
        display: flex;
        align-items: center;
        gap: 12px;
        padding: 15px 18px;
        background: var(--white);
        border: 1px solid var(--grey4);
        border-radius: 8px;
        font: 16px/1.5 'go-regular';
        color: var(--black);
        cursor: pointer;
        transition: border-color 0.2s ease, background 0.2s ease, opacity 0.2s ease;

        &:hover {
            border-color: var(--grey10);
        }

        &.isSelected {
            padding: 14.5px 17.5px;
            background: var(--grey16);
            border: 1.5px solid var(--black);
            font-family: 'go-semibold';
        }

        &.isDisabled {
            opacity: 0.5;
            cursor: not-allowed;

            &:hover {
                border-color: var(--grey4);
            }
        }

        &:has(input:focus-visible) {
            outline: 2px solid var(--black);
            outline-offset: 2px;
        }
    }

    .esfRadio,
    .esfCheckbox,
    .esfRank {
        position: relative;
        flex-shrink: 0;
        border: 1.5px solid var(--grey10);
        background: var(--white);
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .esfRadio {
        width: 20px;
        height: 20px;
        border-radius: 50%;
        align-self: center;
        box-sizing: border-box;
    }

    .esfCheckbox {
        width: 20px;
        height: 20px;
        border-radius: 4px;
    }

    .esfRank {
        width: 24px;
        height: 24px;
        border-radius: 12px;
        font: 14px/1 'go-semibold';
        color: var(--white);
        font-variant-numeric: tabular-nums;
        text-align: center;
        /* Trim the font's uneven space above/below the digits, so the flex centring
           centres the digit itself (cap height to baseline), not its line box */
        text-box: trim-both cap alphabetic;
    }

    .esfOption.isSelected {
        .esfRadio {
            border-color: var(--black);

            /* A flex child of .esfRadio (display:flex, centred both ways), so the dot
               sits dead centre regardless of the 1.5px border's sub-pixel rounding */
            &::after {
                content: "";
                /* 20px circle − 2 × 1.5px border = 17px inside; 9px dot leaves 4px all round */
                width: 10px;
                height: 10px;
                flex-shrink: 0;
                border-radius: 50%;
                background: var(--black);
            }
        }

        .esfCheckbox,
        .esfRank {
            background: var(--black);
            border-color: var(--black);
        }
    }

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

    .esfSpecify {
        width: 100%;
        padding: 12px 16px;
        background: var(--white);
        border: 1px solid var(--grey4);
        border-radius: 8px;
        font: 16px/1.5 'go-regular';
        color: var(--black);

        &:focus {
            outline: none;
            border-color: var(--black);
        }
    }

    /* Free text */
    .esfTextarea {
        display: flex;
        flex-direction: column;
        justify-content: space-between;
        gap: 8px;
        min-height: 100px;
        padding: 16px;
        background: var(--white);
        border: 1px solid var(--grey4);
        border-radius: 8px;
        cursor: text;

        &:focus-within {
            border-color: var(--black);
        }

        textarea {
            width: 100%;
            min-height: 24px;
            border: none;
            outline: none;
            resize: vertical;
            background: transparent;
            font: 16px/1.5 'go-regular';
            color: var(--black);

            &::placeholder {
                color: var(--grey);
            }
        }

        &.isOver .esfWordCount {
            color: var(--esf-red);
        }
    }

    .esfWordCount {
        align-self: flex-end;
        font: 13px/1.5 'go-regular';
        color: var(--grey);
    }

    /* Chips */
    .esfChips {
        display: flex;
        flex-wrap: wrap;
        gap: 10px;
    }

    .esfChip {
        position: relative;
        display: inline-flex;
        align-items: center;
        gap: 8px;
        padding: 10px 18px;
        background: var(--white);
        border: 1px solid var(--grey4);
        border-radius: 999px;
        font: 16px/1.5 'go-regular';
        color: var(--black);
        white-space: nowrap;
        cursor: pointer;
        transition: border-color 0.2s ease, background 0.2s ease;

        &:hover {
            border-color: var(--grey10);
        }

        &.isSelected {
            background: var(--black);
            border-color: var(--black);
            color: var(--white);
            font-family: 'go-semibold';
        }

        &:has(input:focus-visible) {
            outline: 2px solid var(--black);
            outline-offset: 2px;
        }
    }

    /* Dropdown */
    .esfDropdownWrap {
        display: flex;
        flex-direction: column;
        gap: 20px;
    }

    .esfDropdown {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 12px;
        width: 100%;
        padding: 15px 18px;
        background: var(--white);
        border: 1.5px solid var(--grey4);
        border-radius: 8px;
        font: 16px/1.5 'go-regular';
        color: var(--grey);
        text-align: left;
        cursor: pointer;

        &.hasValue {
            color: var(--black);
        }

        &.isOpen,
        &:focus-visible {
            border-color: var(--black);
            outline: none;
        }

        &.isOpen svg {
            transform: rotate(180deg);
        }

        svg {
            flex-shrink: 0;
            transition: transform 0.2s ease;
        }
    }

    .esfMenu {
        position: relative;
        list-style: none;
        display: flex;
        flex-direction: column;
        gap: 2px;
        max-height: 288px;
        overflow-y: auto;
        padding: 6px;
        background: var(--white);
        border: 1px solid var(--grey4);
        border-radius: 8px;
        box-shadow: 0 8px 12px rgba(0, 0, 0, 0.08);

        button {
            display: flex;
            align-items: center;
            justify-content: space-between;
            width: 100%;
            padding: 10px 12px;
            background: transparent;
            border-radius: 4px;
            font: 16px/1.5 'go-regular';
            color: var(--black);
            text-align: left;
            cursor: pointer;

            &:hover,
            &:focus-visible {
                background: var(--grey16);
                outline: none;
            }

            &.isSelected {
                background: var(--grey16);
                font-family: 'go-semibold';
            }
        }
    }

    /* ---------- Actions + footnote ---------- */
    .esfActions {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 16px;
        padding-top: 16px;
    }

    .esfActionButtons {
        display: flex;
        align-items: center;
        gap: 12px;
    }

    .esfBack {
        gap: 10px;
        border-color: var(--grey4);
    }

    .esfSaveNote {
        font: 13px/1.5 'go-regular';
        color: var(--grey);
    }

    .esfFootnote {
        padding: 24px 80px 48px;
        text-align: center;
        font: 13px/1.5 'go-regular';
        color: var(--grey);
    }

    /* ---------- End screens (3a thank you, 3b others exit) ---------- */
    .esfEnd {
        display: flex;
        align-items: center;
        gap: 96px;
        max-width: 1440px;
        margin: 0 auto;
        padding: 64px 80px 40px;
    }

    .esfEndPhoto {
        width: 620px;
        height: 720px;
        flex-shrink: 0;

        img {
            display: block;
            width: 100%;
            height: 100%;
            object-fit: cover;
            border-radius: 12px;
        }
    }

    .esfEndContent {
        width: 564px;
        min-width: 0;
        display: flex;
        flex-direction: column;
        align-items: flex-start;
        gap: 28px;
    }

    .esfEndTitle {
        font: 52px/1.2 'go-regular';
        color: var(--black);
    }

    .esfEndLead {
        font: 30px/1.2 'go-regular';
        color: var(--black);
    }

    .esfEndText {
        font: 16px/1.5 'go-regular';
        color: var(--grey3);
    }

    .esfNext {
        width: 100%;
        padding: 8px 24px;
        background: var(--white);
        border: 1px solid var(--grey4);
        border-radius: 12px;

        ol {
            list-style: none;
        }

        li {
            display: flex;
            align-items: center;
            gap: 16px;
            padding: 14px 0;
            border-bottom: 1px solid var(--grey4);
            font: 18px/1.2 'go-regular';
            color: var(--black);

            &:last-child {
                border-bottom: none;
            }
        }
    }

    .esfNextTitle {
        padding: 14px 0;
        border-bottom: 1px solid var(--grey4);
        font: 18px/1.2 'go-regular';
        color: var(--black);
    }

    /* Number style = .eduGradientNum on /school-of-education-survey (eduSurvey.css) */
    .esfNextNum {
        width: 36px;
        flex-shrink: 0;
        font: 24px/1.2 'go-semibold';
        background: linear-gradient(-80deg, #F7D344 9.5%, #E38330 104.8%);
        -webkit-background-clip: text;
        background-clip: text;
        -webkit-text-fill-color: transparent;
    }
}

/* ---------- Tablet ---------- */
@media (max-width: 1280px) {
    .eduSurveyForm {
        .esfHeader {
            padding: 16px 40px;
        }

        .esfBody {
            gap: 48px;
            padding: 48px 40px 0;
        }

        .esfRail {
            width: 300px;
        }

        .esfQuestions {
            width: auto;
            flex: 1;
        }

        .esfEnd {
            gap: 48px;
            padding: 48px 40px 32px;
        }

        .esfEndPhoto {
            width: auto;
            flex: 1;
            height: 600px;
        }

        .esfEndContent {
            flex: 1;
            width: auto;
        }

        .esfEndTitle {
            font-size: 44px;
        }
    }
}

@media (max-width: 900px) {
    .eduSurveyForm {
        .esfBody,
        .esfEnd {
            flex-direction: column;
            align-items: stretch;
            gap: 32px;
        }

        .esfRail {
            position: static;
            width: 100%;
        }

        .esfQuestions {
            width: 100%;
        }

        .esfEndPhoto {
            flex: none;
            width: 100%;
            height: 420px;
        }
    }
}

/* ---------- Mobile (Figma Mobile 390 frames) ---------- */
@media (max-width: 768px) {
    .eduSurveyForm {
        /* Header: logo + a short status instead of the buttons */
        .esfHeader {
            padding: 14px 20px;
        }

        .esfBrand img {
            width: 109px;
            height: 22px;
        }

        .esfBrandDivider,
        .esfBrandText,
        .esfHeaderMeta,
        .esfSaveExit {
            display: none;
        }

        .esfHeaderMobile {
            display: inline;
        }

        /* Rail becomes the intro: eyebrow, title, text and the step list */
        .esfBody {
            padding: 0;
            gap: 0;
        }

        .esfRail {
            gap: 10px;
            padding: 28px 20px 12px;
        }

        .esfMeta {
            display: none;
        }

        .esfSteps {
            margin-top: 8px;
            padding: 8px;

            li {
                gap: 12px;
                padding: 12px;
            }
        }

        .esfStepNum {
            width: 44px;
            height: 44px;
        }

        .esfStepTitle {
            font-size: 14px;
        }

        .esfStepText {
            font-size: 12px;
        }

        .esfEyebrow {
            font-size: 12px;
        }

        .esfRailTitle {
            font-size: 22px;
        }

        .esfRailText {
            font-size: 14px;
        }

        /* Questions */
        .esfQuestions {
            gap: 12px;
            padding: 12px 16px 0;
        }

        .esfSection {
            padding: 16px 4px 4px;

            &.isFirst {
                padding-top: 16px;
            }
        }

        .esfSectionLabel {
            font-size: 12px;
        }

        .esfSectionTitle {
            font-size: 18px;
        }

        .esfQuestion {
            flex-direction: column;
            gap: 14px;
            padding: 20px;
        }

        .esfQNum {
            width: auto;
            font-size: 13px;
        }

        .esfQNumDesk {
            font-size: 18px;
        }

        .esfQBody {
            width: 100%;
            gap: 14px;
        }

        .esfQTitle {
            font-size: 16px;
        }

        .esfQHint {
            font-size: 13px;
        }

        .esfCounter {
            font-size: 12px;
        }

        .esfOptions {
            gap: 8px;

            &.isGrid {
                flex-direction: column;
                gap: 8px;

                .esfOption {
                    width: 100%;
                }
            }
        }

        .esfOption {
            padding: 13px 14px;
            font-size: 14px;

            &.isSelected {
                padding: 12.5px 13.5px;
            }
        }

        .esfRank {
            font-size: 13px;
        }

        .esfChips {
            gap: 8px;
        }

        .esfChip {
            padding: 9px 14px;
            font-size: 14px;
            white-space: normal;
        }

        .esfDropdown,
        .esfMenu button,
        .esfSpecify,
        .esfTextarea textarea {
            font-size: 14px;
        }

        .esfWordCount {
            font-size: 12px;
        }

        /* Actions: sticky bottom bar */
        .esfActions {
            position: sticky;
            bottom: 0;
            z-index: 5;
            margin: 16px -16px 0;
            padding: 12px 16px 28px;
            background: var(--white);
            border-top: 1px solid var(--grey4);
        }

        .esfSaveNote {
            display: none;
        }

        .esfActionButtons {
            width: 100%;
            gap: 10px;
        }

        .esfBack {
            padding: 14px 20px;
            font-size: 15px;
        }

        .esfPrimary {
            flex: 1;
            padding: 14px 20px;
            font-size: 15px;
        }

        .esfFootnote {
            padding: 24px 20px;
            font-size: 12px;
        }

        /* End screens: full-width photo on top */
        .esfEnd {
            padding: 0;
            gap: 0;
        }

        .esfEndPhoto {
            height: 280px;

            img {
                border-radius: 0;
            }
        }

        .esfEndContent {
            gap: 20px;
            padding: 32px 20px 24px;
        }

        .esfEndTitle {
            font-size: 30px;
        }

        .esfEndLead {
            font-size: 22px;
        }

        .esfEndText {
            font-size: 14px;
        }

        .esfNext {
            padding: 8px 16px;

            li {
                font-size: 18px;
            }
        }

        .esfNextNum {
            width: 30px;
            font-size: 20px;
        }

        .esfEndCta {
            width: 100%;
            padding: 14px 20px;
            font-size: 15px;
        }

        .esfEnd + .esfFootnote {
            padding: 8px 20px 32px;
        }
    }
}

/* ---------- Already submitted: read-only answers (_survey/ResponsesView.jsx) ---------- */
.eduSurveyForm {
    .esfAnswerCard {
        padding: 24px 32px;

        .esfQBody {
            gap: 12px;
        }
    }

    .esfAnswerList,
    .esfAnswerRank {
        display: flex;
        flex-wrap: wrap;
        gap: 8px;
        margin: 0;
        padding: 0;
        list-style: none;

        li {
            padding: 8px 14px;
            border: 1px solid var(--grey4);
            border-radius: 999px;
            background: #F7F7F5;
            font: 14px/1.4 'go-medium';
            color: var(--black);
            overflow-wrap: anywhere;
        }
    }

    .esfAnswerList .esfAnswerOther {
        border-radius: 8px;
        background: var(--white);
        font-family: 'go-regular';
        color: var(--grey3);
    }

    .esfAnswerRank {
        flex-direction: column;
        align-items: flex-start;
        counter-reset: esfRank;

        li::before {
            counter-increment: esfRank;
            content: counter(esfRank) ". ";
            font-family: 'go-semibold';
            color: var(--esf-brown);
        }
    }

    .esfAnswerEmpty {
        font: 14px/1.5 'go-regular';
        color: var(--grey);
    }

    a.esfBack {
        text-decoration: none;
    }
}

@media (max-width: 768px) {
    .eduSurveyForm .esfAnswerCard {
        padding: 20px;
    }
}
