/* Survey-specific styles. Relies on vars.css + main.css being loaded first. */

header {
    position: relative;
}

/* ---------- Form controls ---------- */
/* color-scheme: dark alone renders inconsistently across platforms, so these are explicit. */
.survey__field input[type="text"],
.survey__field input[type="number"],
.survey__field textarea,
.survey__field select {
    width: 100%;
    max-width: 46rem;
    font-family: var(--default-font-family);
    font-size: var(--body-2-font-size);
    font-weight: var(--default-font-weight);
    color: #fafafa;
    background-color: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--border-color);
    border-radius: 0.4rem;
    padding: 0.9rem 1.2rem;
}

.survey__field textarea {
    max-width: 100%;
    resize: vertical;
    line-height: 1.5;
}

.survey__field input[type="text"]:hover,
.survey__field input[type="number"]:hover,
.survey__field textarea:hover {
    border-color: var(--border-hover-color);
}

.survey__field input[type="radio"] {
    margin-right: 0.5rem;
}

.survey__scale-options input[type="radio"] {
    display: none;
}

.survey__field input[readonly] {
    background-color: rgba(255, 255, 255, 0.02);
    color: #b1b1b1;
    cursor: not-allowed;
}

.survey__field label,
.survey__field legend {
    display: block;
    font-size: var(--body-1-font-size);
    line-height: 1.4;
    margin-bottom: 0.8rem;
    padding: 0;
}

.survey__field .survey__scale-option {
    padding: 15px;
    text-align: center;
}

.survey__required {
    color: var(--color-somewhat-dissatisfied);
}

.survey__field {
    width: 100%;
    border: none;
    padding: 0;
    margin: 0 0 2rem 0;
}

.survey__field:last-child {
    margin-bottom: 0;
}

.survey__field--sub {
    width: 100%;
    padding-top: 1.5rem;
    border-top: 1px solid rgba(102, 102, 102, 0.4);
}

.survey__field--error input,
.survey__field--error select,
.survey__field--error textarea {
    border-color: var(--color-very-dissatisfied);
}

.survey__error {
    color: var(--color-somewhat-dissatisfied);
    font-size: var(--body-3-font-size);
    margin: 0.8rem 0 0 0;
}
    
.survey__reset {
    margin: 0 !important;
}

.survey__reset-link {
    color: var(--primary-color);
    font-size: var(--body-3-font-size);
    text-decoration: underline;
}

/* ---------- Cards & steps ---------- */
.survey__form {
    width: 100%;
}

.survey__step {
    border: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 2rem;
    width: 100%;
}

.survey__step[hidden] {
    display: none;
}

.survey__step-legend {
    display: block;
    width: 100%;
    padding: 0;
}

.survey__step-title {
    font-size: var(--headline-3-font-size);
    margin: 0 0 1rem 0;
    outline: none;
}

.survey__card {
    gap: 0;
}

.survey__card h3 {
    font-size: var(--headline-4-font-size);
    margin: 0 0 1.5rem 0;
}

.survey__card--error {
    border-color: var(--color-very-dissatisfied);
}

/* ---------- 7-point scale ---------- */
.survey__scale {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
    width: 100%;
}

.survey__scale-anchors {
    display: flex;
    justify-content: space-between;
    gap: 1.5rem;
}

.survey__scale-anchor {
    font-size: var(--body-3-font-size);
    color: #b1b1b1;
    max-width: 20rem;
}

.survey__scale-anchor:last-child {
    text-align: right;
}

.survey__scale-options {
    display: flex;
    gap: 0.8rem;
    flex: 1 1 auto;
    justify-content: space-between;
}

.survey__scale-option {
    flex: 1 1 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.6rem;
    margin: 0;
    padding: 1rem 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: 0.4rem;
    cursor: pointer;
    font-size: var(--body-3-font-size);
}

.survey__scale-option:hover {
    border-color: var(--border-hover-color);
}

.survey__scale-option input {
    accent-color: var(--primary-color);
    margin: 0;
    cursor: pointer;
}

.survey__scale-option:has(input:checked) {
    border-color: var(--primary-color);
    background-color: rgba(52, 152, 219, 0.15);
}

.survey__scale-option--1:has(input:checked) { border-color: var(--color-very-dissatisfied); background-color: rgba(204, 0, 0, 0.2); }
.survey__scale-option--2:has(input:checked) { border-color: var(--color-dissatisfied); background-color: rgba(255, 102, 0, 0.2); }
.survey__scale-option--3:has(input:checked) { border-color: var(--color-somewhat-dissatisfied); background-color: rgba(255, 153, 0, 0.2); }
.survey__scale-option--4:has(input:checked) { border-color: var(--color-neutral); background-color: rgba(255, 204, 51, 0.2); }
.survey__scale-option--5:has(input:checked) { border-color: var(--color-somewhat-satisfied); background-color: rgba(153, 204, 51, 0.2); }
.survey__scale-option--6:has(input:checked) { border-color: var(--color-satisfied); background-color: rgba(51, 153, 51, 0.2); }
.survey__scale-option--7:has(input:checked) { border-color: var(--color-very-satisfied); background-color: rgba(0, 102, 0, 0.3); }

/* ---------- Yes/No toggle ---------- */
.survey__yesno {
    display: flex;
    gap: 0.8rem;
}

.survey__yesno-option {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
    margin: 0;
    border-radius: 0.4rem;
    padding: 1rem !important;
    cursor: pointer;
}

.survey__yesno-option:hover {
    border-color: var(--border-hover-color);
}

.survey__yesno-option input {
    accent-color: var(--primary-color);
    margin: 0;
    cursor: pointer;
}

.survey__yesno-option:has(input:checked) {
    border-color: var(--primary-color);
    background-color: rgba(52, 152, 219, 0.15);
}

/* ---------- Percent group ---------- */
.survey__percent-input {
    display: flex;
    align-items: center;
    gap: 0.8rem;
}

.survey__percent-input input {
    max-width: 10rem;
}

.survey__group-total {
    width: 100%;
    margin: 1.5rem 0 0 0;
    padding-top: 1.5rem;
    border-top: 1px solid rgba(102, 102, 102, 0.4);
    font-size: var(--body-1-font-size);
}

.survey__percent-total {
    color: var(--color-somewhat-dissatisfied);
}

.survey__percent-total.is-complete {
    color: var(--color-satisfied);
}

/* ---------- Progress ---------- */
.survey__progress {
    position: sticky;
    top: 0;
    z-index: 900;
    padding: 1.5rem 10rem;
    background-color: rgba(5, 10, 20, 0.95);
    border-bottom: 1px solid rgba(102, 102, 102, 0.5);
}

.survey__progress-track {
    width: 100%;
    height: 0.6rem;
    background-color: rgba(255, 255, 255, 0.12);
    border-radius: 0.3rem;
    overflow: hidden;
}

.survey__progress-fill {
    width: var(--progress, 0%);
    height: 100%;
    background-color: var(--primary-color);
    transition: width 0.3s ease-in-out;
}

.survey__progress-label {
    margin: 0.8rem 0 0 0;
    font-size: var(--body-3-font-size);
    color: #b1b1b1;
}

/* ---------- Navigation ---------- */
.survey__nav {
    justify-content: space-between;
    max-width: none;
    margin-top: 1rem;
}

.survey__nav button {
    min-width: 12rem;
}

/* ---------- Landing & message panels ---------- */
.survey__landing-card,
.survey__message .data__container {
    max-width: 60rem;
    margin: 0 auto 4rem;
    padding: 1.5rem 2rem 3rem;
}

.survey__message-icon {
    font-size: 3.2rem;
    color: var(--primary-color);
    margin-bottom: 1rem;
}

.survey__message h2 {
    margin: 0 0 1rem 0;
    font-size: var(--headline-3-font-size);
}

.survey__message-action {
    font-weight: var(--clickable-font-weight);
}

.survey__access-form {
    width: 100%;
}

.survey__landing .section__text {
    max-width: 60rem;
    margin: 0 auto 4rem;
}

/* ---------- No-JS fallback: reveal every step ---------- */
.no-js .survey__step[hidden] {
    display: flex;
}

.no-js .survey__progress,
.no-js #surveyBack,
.no-js #surveyNext {
    display: none;
}

.no-js #surveySubmit {
    display: inline-block;
}

/* ---------- Responsive ---------- */
@media screen and (max-width: 1280px) {
    .survey__progress {
        padding: 1.5rem 6rem;
    }
}

@media screen and (max-width: 768px) {
    .survey__progress {
        padding: 1.5rem 4rem;
    }
}

@media screen and (max-width: 600px) {
    .survey__progress {
        padding: 1.2rem 2rem;
    }

    .survey__nav {
        flex-direction: column;
    }

    .survey__nav button {
        width: 100%;
        max-width: none;
    }

    .survey__scale-options {
        flex-wrap: wrap;
    }

    .survey__scale-option {
        flex: 1 0 calc(25% - 0.8rem);
    }

    .survey__scale-anchors {
        flex-direction: column;
        gap: 0.3rem;
    }

    .survey__scale-anchor:last-child {
        text-align: left;
    }

    .survey__landing-card,
    .survey__message .data__container {
        margin: 0 0 3rem 0;
    }
}

@media (prefers-reduced-motion: reduce) {
    .survey__progress-fill {
        transition: none;
    }
}
