/* ------------------------------------------------------------------
   Congress survey: public modal (.survey-modal) + inline lecture
   button (a.content-survey-btn). Everything is scoped so nothing
   leaks into the rest of the site.
   ------------------------------------------------------------------ */

/* ---------- inline button next to a lecture title ---------- */
a.content-survey-btn {
    --csb-color: var(--main-color, #105484);
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    vertical-align: middle;
    margin: .15rem .4rem;
    padding: .2rem .7rem;
    border: 1px solid rgba(16, 84, 132, .35);
    border-radius: 999px;
    background: rgba(16, 84, 132, .06);
    color: var(--csb-color);
    font-family: "Vazir M", sans-serif;
    font-size: .78rem;
    font-weight: 500;
    line-height: 1.5;
    white-space: nowrap;
    text-decoration: none;
    transition: background-color .15s ease, color .15s ease, box-shadow .15s ease;
}

a.content-survey-btn i {
    font-size: .85em;
}

a.content-survey-btn:hover,
a.content-survey-btn:focus-visible {
    background: var(--csb-color);
    color: #fff;
    text-decoration: none;
    box-shadow: 0 2px 8px rgba(16, 84, 132, .25);
    outline: none;
}

[dir="ltr"] a.content-survey-btn,
a.content-survey-btn[dir="ltr"] {
    font-family: "SansPro R", sans-serif;
}

/* ---------- survey modal ---------- */
.survey-modal {
    --sv-accent: var(--main-color, #105484);
    --sv-accent-soft: rgba(16, 84, 132, .08);
    --sv-accent-ring: rgba(16, 84, 132, .25);
    --sv-ink: #212121;
    --sv-ink-2: #5a5a5a;
    --sv-line: #e6e8ec;
    --sv-surface: #f7f8fa;
    font-family: "Vazir M", sans-serif;
    color: var(--sv-ink);
    direction: rtl;
    text-align: right;
}

.survey-modal[dir="ltr"] {
    font-family: "SansPro R", sans-serif;
    direction: ltr;
    text-align: left;
}

.survey-modal .modal-header {
    align-items: center;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--sv-line);
    background: linear-gradient(180deg, #fff 0%, var(--sv-surface) 100%);
}

.survey-modal .modal-title {
    display: flex;
    align-items: center;
    gap: .5rem;
    margin: 0;
    font-size: 1.05rem;
    font-weight: 700;
}

.survey-modal .modal-title i {
    color: var(--sv-accent);
}

.survey-modal .modal-body {
    padding: 1.25rem;
}

.survey-modal .modal-footer {
    gap: .5rem;
    justify-content: flex-start;
    padding: .9rem 1.25rem;
    border-top: 1px solid var(--sv-line);
    background: var(--sv-surface);
}

.survey-modal .btn {
    font-family: inherit;
    border-radius: .6rem;
    padding: .5rem 1.25rem;
}

.survey-modal .btn-primary {
    background: var(--sv-accent);
    border-color: var(--sv-accent);
}

.survey-modal .btn-primary:hover,
.survey-modal .btn-primary:focus {
    background: #0c3f63;
    border-color: #0c3f63;
}

.survey-modal .btn-secondary {
    background: #fff;
    color: var(--sv-ink);
    border-color: #cfd4db;
}

.survey-modal .btn-secondary:hover {
    background: #eef0f3;
    color: var(--sv-ink);
}

/* subject header */
.survey-subject {
    display: grid;
    gap: .35rem;
    padding: 1rem 1.1rem;
    margin-bottom: 1.25rem;
    border: 1px solid var(--sv-line);
    border-inline-start: 4px solid var(--sv-accent);
    border-radius: .75rem;
    background: var(--sv-surface);
}

.survey-subject-label {
    display: inline-block;
    width: fit-content;
    padding: .1rem .6rem;
    border-radius: 999px;
    background: var(--sv-accent);
    color: #fff;
    font-size: .72rem;
    letter-spacing: .02em;
}

.survey-subject-title {
    font-size: 1.05rem;
    font-weight: 700;
    line-height: 1.6;
}

.survey-subject-meta {
    display: flex;
    align-items: center;
    gap: .4rem;
    color: var(--sv-ink-2);
    font-size: .85rem;
}

.survey-subject-meta i {
    width: 1.1rem;
    text-align: center;
    color: var(--sv-accent);
}

/* progress */
.survey-progress {
    display: flex;
    align-items: center;
    gap: .75rem;
    margin-bottom: 1rem;
    font-size: .8rem;
    color: var(--sv-ink-2);
}

.survey-progress-bar {
    flex: 1;
    height: 6px;
    border-radius: 999px;
    background: #e3e7ee;
    overflow: hidden;
}

.survey-progress-fill {
    height: 100%;
    width: 0;
    border-radius: 999px;
    background: var(--sv-accent);
    transition: width .25s ease;
}

.survey-progress-text {
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

/* question cards */
.survey-question {
    margin: 0 0 1rem;
    padding: 1rem 1.1rem;
    border: 1px solid var(--sv-line);
    border-radius: .75rem;
    background: #fff;
    min-width: 0;
    transition: border-color .15s ease, box-shadow .15s ease;
}

.survey-question.is-answered {
    border-color: var(--sv-accent-ring);
    box-shadow: 0 0 0 3px var(--sv-accent-soft);
}

.survey-question-title {
    display: flex;
    align-items: flex-start;
    gap: .6rem;
    float: none;
    width: 100%;
    margin: 0 0 .35rem;
    padding: 0;
    font-size: .98rem;
    font-weight: 700;
    line-height: 1.6;
}

.survey-question-number {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.6rem;
    height: 1.6rem;
    margin-top: .1rem;
    border-radius: 50%;
    background: var(--sv-accent-soft);
    color: var(--sv-accent);
    font-size: .78rem;
    font-weight: 700;
}

.survey-question.is-answered .survey-question-number {
    background: var(--sv-accent);
    color: #fff;
}

.survey-question-description {
    margin: 0 2.2rem .6rem 0;
    color: var(--sv-ink-2);
    font-size: .84rem;
    line-height: 1.7;
}

/* option pills */
.survey-options {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
    margin-top: .6rem;
}

.survey-options .btn-check {
    position: absolute;
    clip: rect(0, 0, 0, 0);
    pointer-events: none;
}

.survey-option {
    flex: 1 1 auto;
    min-width: 3rem;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: .45rem .9rem;
    border: 1.5px solid #cfd4db;
    border-radius: .6rem;
    background: #fff;
    color: var(--sv-ink);
    font-size: .92rem;
    text-align: center;
    cursor: pointer;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
    transition: background-color .12s ease, border-color .12s ease, color .12s ease, box-shadow .12s ease;
}

.survey-option:hover {
    border-color: var(--sv-accent);
    background: var(--sv-accent-soft);
}

.btn-check:focus-visible + .survey-option {
    box-shadow: 0 0 0 3px var(--sv-accent-ring);
}

.btn-check:checked + .survey-option {
    background: var(--sv-accent);
    border-color: var(--sv-accent);
    color: #fff;
    font-weight: 700;
}

.btn-check:disabled + .survey-option {
    opacity: .6;
    cursor: default;
}

/* free text */
.survey-text {
    margin-top: .6rem;
    border-radius: .6rem;
    border-color: #cfd4db;
    font-family: inherit;
    font-size: .92rem;
    line-height: 1.7;
    resize: vertical;
}

.survey-text:focus {
    border-color: var(--sv-accent);
    box-shadow: 0 0 0 3px var(--sv-accent-soft);
}

/* states */
.survey-modal .alert {
    border-radius: .75rem;
    font-size: .9rem;
    line-height: 1.8;
}

.survey-state {
    display: grid;
    justify-items: center;
    gap: .75rem;
    padding: 1.5rem 1rem;
    text-align: center;
}

.survey-state-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 3.5rem;
    height: 3.5rem;
    border-radius: 50%;
    font-size: 1.5rem;
}

.survey-state-icon.is-info {
    background: var(--sv-accent-soft);
    color: var(--sv-accent);
}

.survey-state-icon.is-success {
    background: rgba(25, 135, 84, .12);
    color: #198754;
}

.survey-state-icon.is-warning {
    background: rgba(255, 193, 7, .18);
    color: #b7791f;
}

.survey-state-title {
    font-size: 1rem;
    font-weight: 700;
}

.survey-state-text {
    color: var(--sv-ink-2);
    font-size: .9rem;
    line-height: 1.8;
    max-width: 32rem;
}

.survey-modal.is-submitted .survey-question {
    opacity: .75;
}

/* Tablet-width dialogs (500px): tighten pills so a 5-point scale stays on one row. */
@media (max-width: 991.98px) {
    .survey-option {
        padding: .45rem .55rem;
        font-size: .86rem;
    }
}

@media (max-width: 575.98px) {
    .survey-modal .modal-header {
        padding: .75rem 1rem;
    }

    .survey-modal .modal-body {
        padding: .75rem 1rem;
    }

    .survey-modal .modal-body.pb-0 + form .modal-body,
    .survey-modal form .modal-body {
        padding-top: 0;
    }

    /* compact subject card */
    .survey-subject {
        gap: .2rem;
        padding: .6rem .75rem;
        margin-bottom: .75rem;
    }

    .survey-subject-label {
        font-size: .66rem;
        padding: 0 .5rem;
    }

    .survey-subject-title {
        font-size: .95rem;
        line-height: 1.45;
    }

    .survey-subject-meta {
        display: inline;
        font-size: .78rem;
    }

    .survey-subject-meta + .survey-subject-meta::before {
        content: "\00a0\00b7\00a0";
        color: #b0b4ba;
    }

    .survey-subject-meta i {
        width: auto;
        margin-inline-end: .2rem;
    }

    .survey-progress {
        margin-bottom: .6rem;
        font-size: .75rem;
    }

    /* tighter question cards */
    .survey-question {
        margin-bottom: .6rem;
        padding: 12px;
    }

    .survey-question-title {
        font-size: .92rem;
        margin-bottom: .2rem;
    }

    .survey-question-description {
        margin-bottom: .4rem;
        font-size: .8rem;
    }

    /* rating scale as one segmented row of equal cells */
    .survey-options {
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(54px, 1fr));
        gap: 4px;
        margin-top: .4rem;
        padding: 4px;
        border: 1px solid #cfd4db;
        border-radius: .7rem;
        background: #f1f3f6;
    }

    .survey-option {
        width: 100%;
        min-width: 0;
        min-height: 52px;
        padding: .3rem .25rem;
        border: 1px solid transparent;
        border-radius: .45rem;
        background: #fff;
        font-size: .8rem;
        line-height: 1.3;
        word-break: break-word;
        overflow-wrap: anywhere;
    }

    .survey-option:hover {
        border-color: transparent;
        background: #fff;
    }

    .btn-check:checked + .survey-option {
        border-color: var(--sv-accent);
    }

    .survey-text {
        margin-top: .4rem;
    }

    .survey-text[rows] {
        min-height: 4.5rem;
    }

    /* sticky footer: primary on top, full width; close as a plain outline below */
    .survey-modal .modal-footer {
        position: sticky;
        bottom: 0;
        z-index: 2;
        flex-direction: column;
        align-items: stretch;
        gap: .4rem;
        padding: .6rem 1rem;
        box-shadow: 0 -6px 12px -8px rgba(0, 0, 0, .18);
    }

    .survey-modal .modal-footer .btn {
        width: 100%;
        margin: 0;
    }

    .survey-modal .modal-footer .btn-secondary {
        background: transparent;
        border-color: transparent;
        color: var(--sv-ink-2);
        padding: .35rem 1rem;
    }

    .survey-modal .modal-footer .btn-secondary:hover {
        background: #eef0f3;
    }

    .survey-modal .modal-footer #survey-submit.d-none + .btn-secondary {
        background: #fff;
        border-color: #cfd4db;
        color: var(--sv-ink);
    }
}

/* Honeypot field: off-screen rather than display:none, which some bots skip. */
.survey-modal .survey-hp {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}

/* guest note at the top of the form */
.survey-modal .survey-guest-note {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: .35rem .5rem;
    margin: 0 0 .75rem;
    padding: .45rem .75rem;
    border: 1px solid rgba(16, 84, 132, .18);
    border-radius: .6rem;
    background: var(--sv-accent-soft);
    color: var(--sv-ink-2);
    font-size: .82rem;
    line-height: 1.6;
}

.survey-modal .survey-guest-note > i {
    flex: 0 0 auto;
    color: var(--sv-accent);
}

.survey-modal .survey-guest-note > span {
    flex: 1 1 auto;
    min-width: 0;
}

.survey-modal .survey-guest-note > a {
    flex: 0 0 auto;
    margin-inline-start: auto;
    color: var(--sv-accent);
    font-weight: 700;
    text-decoration: none;
    white-space: nowrap;
}

.survey-modal .survey-guest-note > a:hover,
.survey-modal .survey-guest-note > a:focus-visible {
    text-decoration: underline;
}

.survey-modal[dir="ltr"] .survey-guest-note {
    font-family: "SansPro R", sans-serif;
    text-align: left;
}

@media (max-width: 575.98px) {
    .survey-modal .survey-guest-note {
        padding: .4rem .6rem;
        font-size: .78rem;
        margin-bottom: .6rem;
    }
}
