/* ── Single: Ankieta (CPT ankieta) ────────────────────────────────────────
   Krokowy kreator (slajd startowy → dane kontaktowe → pytania → koniec),
   ten sam mechanizm przesuwania co stary questionnaire-form z ey-theme,
   ale na tokenach kolorów tego motywu i w dwóch wariantach: ciemnym (domyślny,
   spójny z gutenberg/form-diagnosis i innymi .fd-/.ff- formularzami) oraz
   jasnym (spójny z resztą - biało/czarnych - stron motywu). Wybór trybu:
   pole ACF "color_scheme" na CPT ankieta. ─────────────────────────────── */

.ank-survey {
    --ank-bg: var(--wp--preset--color--dark, #2E2E39);
    --ank-fg: var(--wp--preset--color--white, #fff);
    --ank-fg-muted: rgba(255, 255, 255, 0.6);
    --ank-card-bg: var(--wp--preset--color--black, #1A1A25);
    --ank-border: rgba(255, 255, 255, 0.12);
    --ank-border-strong: rgba(255, 255, 255, 0.3);
    --ank-accent: var(--wp--preset--color--pink-500, #DF006E);
    --ank-btn-fg-hover: var(--wp--preset--color--black, #1A1A25);

    position: relative;
    min-height: 420px;
    padding: 56px 0;
    overflow: hidden;
    background: var(--ank-bg);
    color: var(--ank-fg);
}

.ank-survey--jasny {
    --ank-bg: var(--wp--preset--color--neutral-50, #FCFCFF);
    --ank-fg: var(--wp--preset--color--black, #1A1A25);
    --ank-fg-muted: var(--wp--preset--color--neutral-300, #747481);
    --ank-card-bg: var(--wp--preset--color--white, #fff);
    --ank-border: var(--wp--preset--color--neutral-200, #C5C5CD);
    --ank-border-strong: var(--wp--preset--color--neutral-300, #747481);
    --ank-btn-fg-hover: var(--wp--preset--color--white, #fff);
}

/* ── Pasek postępu - przypięty pod nawigacją, zawsze widoczny ────────────── */

.ank-progress {
    position: fixed;
    top: var(--nav-height, 0px);
    left: 0;
    right: 0;
    height: 3px;
    background: rgba(127, 127, 127, 0.25);
    z-index: 200;
}

.ank-progress-bar {
    height: 100%;
    width: 0%;
    background: var(--ank-accent, #DF006E);
    transition: width 0.4s ease;
}

/* ── Steps track ──────────────────────────────────────────────────────────── */

.ank-steps {
    display: flex;
    align-items: stretch;
    width: 100%;
    transition: transform 0.5s cubic-bezier(0.65, 0, 0.35, 1);
}

.ank-step {
    position: relative;
    flex: 0 0 100%;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ── Cover slides (start / koniec) ───────────────────────────────────────── */

.ank-step--cover {
    text-align: center;
}

.ank-step--has-bg {
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    border-radius: 8px;
}

.ank-step-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(20, 20, 28, 0.5) 0%, rgba(20, 20, 28, 0.82) 100%);
}

.ank-cover-inner {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    max-width: 520px;
    padding: 24px;
}

.ank-cover-icon {
    display: flex;
    color: var(--ank-accent);
}

.ank-cover-icon svg {
    width: 30px;
    height: 30px;
}

.ank-cover-title {
    margin: 0;
    /* Kolor idzie za trybem (ciemny/jasny) - tylko na tle zdjęcia (.ank-step--has-bg)
       jest na sztywno biały, bo tam zawsze leży pod ciemną nakładką .ank-step-overlay. */
    color: var(--ank-fg);
    font-size: 26px;
    font-weight: 400;
    line-height: 1.25;
    text-wrap: balance;
}

.ank-step--has-bg .ank-cover-title {
    color: #fff;
}

.ank-cover-desc {
    margin: 0;
    font-size: 15px;
    font-weight: 300;
    line-height: 1.55;
    color: var(--ank-fg-muted);
}

.ank-step--has-bg .ank-cover-desc {
    color: rgba(255, 255, 255, 0.85);
}

/* ── Form / question steps ───────────────────────────────────────────────── */

.ank-step-inner {
    width: 100%;
    max-width: 460px;
    padding: 0 24px;
    margin: auto;
}

.ank-step-count {
    margin: 0 0 8px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--ank-accent);
}

.ank-step-title {
    margin: 0 0 20px;
    color: var(--ank-fg);
    font-size: 20px;
    font-weight: 400;
    line-height: 1.35;
    text-wrap: balance;
}

.ank-step-desc {
    margin: -12px 0 20px;
    font-size: 14px;
    font-weight: 300;
    line-height: 1.5;
    color: var(--ank-fg-muted);
}

/* ── Contact fields (floating labels, same mechanism as fd-input) ───────── */

.ank-fields {
    display: flex;
    flex-direction: column;
    gap: 14px;
    margin-bottom: 24px;
}

.ank-field {
    position: relative;
}

.ank-input {
    width: 100%;
    height: 46px;
    box-sizing: border-box;
    padding: 0 16px;
    background: var(--ank-card-bg);
    border: 1px solid var(--ank-border);
    border-radius: 4px;
    color: var(--ank-fg);
    font-family: inherit;
    font-size: 13px;
    font-weight: 300;
    outline: none;
    transition: box-shadow 0.15s, border-color 0.15s, padding-top 0.15s ease, padding-bottom 0.15s ease;
}

/* Uwaga: input.ank-input (nie samo .ank-input) - :placeholder-shown w ogóle nie
   dotyczy elementu <select>, więc :not(:placeholder-shown) na samym .ank-input
   dopasowywało się do selecta zawsze (bez względu na to, czy coś wybrano) -
   stąd "Stanowisko" wyglądało na zwinięte/aktywne od razu. Select ma własny
   mechanizm (.ank-select-wrap.is-floated) sterowany z JS, niżej. */
input.ank-input:focus,
input.ank-input:not(:placeholder-shown) {
    padding-top: 14px;
    padding-bottom: 0;
}

.ank-input:focus {
    border-color: var(--ank-border-strong);
}

.ank-input.ank-invalid {
    border-color: #e0546f;
}

/* ── Select (np. "Stanowisko") - ta sama baza co .ank-input, tylko strzałka
   zamiast :placeholder-shown steruje pływającą etykietą (JS dokleja/zdejmuje
   .is-floated na .ank-select-wrap - patrz single-ankieta.js). ──────────── */

.ank-select-wrap {
    position: relative;
}

.ank-select {
    appearance: none;
    cursor: pointer;
    padding-right: 40px;
}

.ank-select:invalid {
    color: var(--ank-fg-muted);
}

.ank-select option {
    background: var(--ank-card-bg);
    color: var(--ank-fg);
}

.ank-select-wrap.is-floated .ank-select {
    padding-top: 14px;
    padding-bottom: 0;
}

.ank-select-wrap.is-floated .ank-field-label {
    top: 9px;
    transform: none;
    font-size: 9px;
}

.ank-select-wrap .ank-field-label {
    right: 40px;
}

.ank-chevron {
    position: absolute;
    top: 50%;
    right: 14px;
    transform: translateY(-50%);
    color: var(--ank-fg-muted);
    pointer-events: none;
}

.ank-field-label {
    position: absolute;
    left: 16px;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 13px;
    font-weight: 300;
    color: var(--ank-fg-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    pointer-events: none;
    transition: top 0.15s ease, font-size 0.15s ease, transform 0.15s ease, color 0.15s ease;
}

input.ank-input:focus + .ank-field-label,
input.ank-input:not(:placeholder-shown) + .ank-field-label {
    top: 9px;
    transform: none;
    font-size: 9px;
}

.ank-req {
    color: inherit;
}

.ank-error-tip {
    display: block;
    position: absolute;
    left: 0;
    top: 100%;
    margin-top: 0;
    font-size: 11px;
    font-weight: 300;
    line-height: 14px;
    color: #e0546f;
    min-height: 0;
}

.ank-error-tip--consent {
    position: static;
    margin-top: 0;
}

/* ── Consent checkbox ─────────────────────────────────────────────────────── */

.ank-consent {
    position: relative;
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding-top: 2px;
    cursor: pointer;
}

.ank-consent-cb {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.ank-consent-box {
    position: relative;
    flex-shrink: 0;
    margin-top: 2px;
    width: 16px;
    height: 16px;
    border: 1.5px solid var(--ank-border-strong);
    border-radius: 3px;
}

.ank-consent-cb:checked ~ .ank-consent-box {
    background: var(--ank-accent);
    border-color: var(--ank-accent);
}

.ank-consent-cb:checked ~ .ank-consent-box::after {
    content: '';
    position: absolute;
    left: 4px;
    top: 0;
    width: 4px;
    height: 8px;
    border: solid #fff;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.ank-consent-cb.ank-invalid ~ .ank-consent-box {
    border-color: #e0546f;
}

.ank-consent-body {
    font-size: 12px;
    font-weight: 300;
    line-height: 1.6;
    color: var(--ank-fg-muted);
}

.ank-consent-body p {
    margin: 0;
}

/* ── Answers (pytania) ───────────────────────────────────────────────────── */

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

.ank-answer {
    position: relative;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 13px 16px;
    background: var(--ank-card-bg);
    border: 1px solid var(--ank-border);
    border-radius: 4px;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
}

.ank-answer:hover {
    border-color: var(--ank-border-strong);
}

.ank-answer input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.ank-answer-box {
    flex-shrink: 0;
    width: 17px;
    height: 17px;
    border-radius: 50%;
    border: 1.5px solid var(--ank-border-strong);
    position: relative;
    transition: border-color 0.15s;
}

.ank-answer input:checked ~ .ank-answer-box {
    border-color: var(--ank-accent);
}

.ank-answer input:checked ~ .ank-answer-box::after {
    content: '';
    position: absolute;
    inset: 3px;
    border-radius: 50%;
    background: var(--ank-accent);
}

.ank-answer input:checked ~ .ank-answer-text {
    color: var(--ank-fg);
    font-weight: 400;
}

.ank-answer:has(input:checked) {
    border-color: var(--ank-accent);
    background: color-mix(in srgb, var(--ank-accent) 8%, var(--ank-card-bg));
}

.ank-answer-text {
    font-size: 13px;
    font-weight: 300;
    color: var(--ank-fg-muted);
}

/* ── Buttons ──────────────────────────────────────────────────────────────── */
/* Kwadratowe rogi, tak jak globalna .btn (assets/css/style.css) - tylko w
   mniejszym, dopasowanym do tego kreatora rozmiarze. .ank-btn--start bierze
   ten sam akcent (--ank-accent) co checkbox zgody i zaznaczona odpowiedź. */

.ank-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 28px;
    background: transparent;
    border: 1px solid var(--ank-fg);
    color: var(--ank-fg);
    font-family: inherit;
    font-size: 13px;
    font-weight: 700;
    line-height: 18px;
    cursor: pointer;
    transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.ank-btn:hover {
    background: var(--ank-fg);
    color: var(--ank-btn-fg-hover);
}

.ank-btn--start {
    border-color: var(--ank-accent);
    background: var(--ank-accent);
    color: #fff;
}

.ank-btn--start:hover {
    background: transparent;
    color: var(--ank-accent);
}

.ank-btn--next {
    width: 100%;
}

.ank-btn:disabled {
    opacity: 0.6;
    cursor: default;
    pointer-events: none;
}

/* ── Error message (banner na dole formularza) ───────────────────────────── */

.ank-msg {
    position: absolute;
    left: 50%;
    bottom: 16px;
    transform: translateX(-50%);
    z-index: 4;
    padding: 10px 16px;
    border-radius: 4px;
    background: rgba(224, 84, 111, 0.12);
    border: 1px solid rgba(224, 84, 111, 0.4);
    color: #e0546f;
    font-size: 13px;
    max-width: calc(100% - 48px);
    text-align: center;
}

/* ── Mobile ───────────────────────────────────────────────────────────────── */

@media (max-width: 600px) {
    .ank-survey {
        padding: 40px 0;
    }

    .ank-cover-title {
        font-size: 22px;
    }

    .ank-step-title {
        font-size: 18px;
    }

    .ank-step-inner {
        padding: 0 20px;
    }

    .ank-btn {
        width: 100%;
    }
}
