/* Pre-Questionnaire Modal — animation layer
   Layout and colour are handled by Tailwind classes in the HTML.
   This file owns only the transition effects.                    */

/* ── Overlay ── */
#pre-assessment-overlay {
    transition: opacity 0.35s ease;
}

#pre-assessment-overlay.pq-fading {
    opacity: 0;
    pointer-events: none;
}

/* ── Card ── */
#pre-assessment-card {
    transition:
        transform 0.42s cubic-bezier(0.4, 0, 0.2, 1),
        opacity   0.42s ease;
    transform-origin: center bottom;
    height: min(88vh, calc(100vh - 2rem));
    max-height: calc(100vh - 2rem);
}

@media (max-height: 700px) {
    #pre-assessment-card {
        height: calc(100vh - 1rem);
        max-height: calc(100vh - 1rem);
    }
}

/* Old scrollable modal layout used a taller card with `max-height` + `overflow-y: auto`.
   Restore that if we ever switch back to the single-page scrolling version. */

#pre-assessment-card.pq-minimizing {
    transform: scale(0.82) translateY(48px);
    opacity: 0;
}

/* ── Inline validation errors ── */
.pq-error-msg {
    font-size: 0.75rem;
    color: #dc2626;
    margin-top: 0.25rem;
    display: none;
}

.pq-field-error .pq-error-msg {
    display: block;
}

.pq-field-error input,
.pq-field-error select,
.pq-field-error textarea {
    border-color: #dc2626 !important;
    outline: none;
    box-shadow: 0 0 0 2px rgba(220, 38, 38, 0.15);
}

/* ── Submit button spinner ── */
#pq-submit-btn.pq-loading {
    opacity: 0.7;
    cursor: not-allowed;
    pointer-events: none;
}

/* ── Checkbox / radio item rows ── */
.pq-choice-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.75rem;
    margin-top: 0.5rem;
}

@media (min-width: 640px) {
    .pq-choice-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

.pq-choice-tile {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.9rem 1rem;
    border: 1px solid #dbe3ef;
    border-radius: 0.9rem;
    background: #ffffff;
    cursor: pointer;
    transition: border-color 0.2s ease, background-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.pq-choice-tile:hover {
    border-color: #4c1d95;
    background: #f5f3ff;
    transform: translateY(-1px);
}

.pq-question-label {
    display: flex;
    align-items: baseline;
    gap: 0.35rem;
    flex-wrap: wrap;
}

.pq-question-label-text {
    display: inline;
}

.pq-required-mark {
    color: #dc2626;
    font-weight: 700;
    line-height: 1;
}

.pq-optional-mark {
    color: #b45309;
    font-size: 0.6rem;
    font-weight: 600;
    padding: 0.1rem 0.3rem;
    border-radius: 9999px;
    background: #fffbeb;
    border: 1px solid #fcd34d;
    line-height: 1;
    /* need to move a bit to the right to add spacing between the mark and the text */
    margin-left: 0.25rem;
}

.pq-choice-selected {
    border-color: #4c1d95;
    background: #f5f3ff;
    box-shadow: 0 10px 22px rgba(76, 29, 149, 0.08);
}

.pq-choice-mark {
    flex-shrink: 0;
    width: 1.25rem;
    height: 1.25rem;
    margin-top: 0.1rem;
    border: 2px solid #cbd5e1;
    border-radius: 9999px;
    background: #ffffff;
    position: relative;
}

.pq-choice-tile[data-choice-type="checkbox"] .pq-choice-mark {
    border-radius: 0.35rem;
}

.pq-choice-selected .pq-choice-mark {
    border-color: #4c1d95;
    background: #4c1d95;
}

.pq-choice-selected .pq-choice-mark::after {
    content: "";
    position: absolute;
    left: 50%;
    top: 50%;
    width: 0.38rem;
    height: 0.22rem;
    border-left: 2px solid #ffffff;
    border-bottom: 2px solid #ffffff;
    transform: translate(-50%, -60%) rotate(-45deg);
}

.pq-choice-label {
    font-size: 0.70rem;
    line-height: 1.35rem;
    color: #334155;
}

.pq-choice-selected .pq-choice-label {
    color: #1e1b4b;
    font-weight: 300;
}
