/* Виджет опроса посетителей (rspp.survey). БЭМ, mobile-first. */

.rspp-survey {
    --rspp-survey-accent: #0e52a9;
    --rspp-survey-accent-dark: #0a3d80;
    --rspp-survey-text: #1d2430;
    --rspp-survey-muted: #6b7480;
    --rspp-survey-border: #dde3ea;
    --rspp-survey-bg: #ffffff;
    --rspp-survey-radius: 12px;

    position: fixed;
    z-index: 99990;
    right: 0;
    bottom: 0;
    left: 0;
    max-height: 85vh;
    overflow: auto;
    background: var(--rspp-survey-bg);
    color: var(--rspp-survey-text);
    border: 1px solid var(--rspp-survey-border);
    border-radius: var(--rspp-survey-radius) var(--rspp-survey-radius) 0 0;
    box-shadow: 0 8px 40px rgba(13, 35, 67, 0.22);
    font-family: inherit;
    font-size: 15px;
    line-height: 1.45;
    opacity: 0;
    transform: translateY(24px);
    transition: opacity 0.25s ease, transform 0.25s ease;
}

.rspp-survey--visible {
    opacity: 1;
    transform: translateY(0);
}

/* На десктопе — карточка в правом нижнем углу */
@media (min-width: 576px) {
    .rspp-survey {
        left: auto;
        right: 24px;
        bottom: 24px;
        width: 380px;
        border-radius: var(--rspp-survey-radius);
    }
}

.rspp-survey__head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    padding: 16px 16px 0;
}

.rspp-survey__progress {
    font-size: 12px;
    color: var(--rspp-survey-muted);
}

.rspp-survey__progress-track {
    height: 3px;
    margin-top: 6px;
    width: 120px;
    background: var(--rspp-survey-border);
    border-radius: 2px;
    overflow: hidden;
}

.rspp-survey__progress-fill {
    height: 100%;
    width: 0;
    background: var(--rspp-survey-accent);
    border-radius: 2px;
    transition: width 0.2s ease;
}

.rspp-survey__close {
    flex: 0 0 auto;
    width: 28px;
    height: 28px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: var(--rspp-survey-muted);
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
}

.rspp-survey__close:hover,
.rspp-survey__close:focus-visible {
    background: #f0f3f6;
    color: var(--rspp-survey-text);
}

.rspp-survey__body {
    padding: 10px 16px 16px;
}

.rspp-survey__title {
    margin: 0 0 8px;
    font-size: 17px;
    font-weight: 700;
}

.rspp-survey__text {
    margin: 0 0 12px;
    color: var(--rspp-survey-muted);
    font-size: 14px;
}

.rspp-survey__hint {
    margin: 0 0 10px;
    font-size: 12px;
    color: var(--rspp-survey-muted);
}

/* Варианты ответа */
.rspp-survey__options {
    margin: 0 0 4px;
    padding: 0;
    list-style: none;
    max-height: 46vh;
    overflow: auto;
}

.rspp-survey__option {
    margin: 0 0 8px;
}

.rspp-survey__option-label {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 10px 12px;
    border: 1px solid var(--rspp-survey-border);
    border-radius: 8px;
    cursor: pointer;
    transition: border-color 0.15s ease, background 0.15s ease;
}

.rspp-survey__option-label:hover {
    border-color: var(--rspp-survey-accent);
}

.rspp-survey__option-input {
    margin: 3px 0 0;
    accent-color: var(--rspp-survey-accent);
    flex: 0 0 auto;
}

.rspp-survey__option--checked .rspp-survey__option-label {
    border-color: var(--rspp-survey-accent);
    background: rgba(14, 82, 169, 0.06);
}

.rspp-survey__option--disabled .rspp-survey__option-label {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Текстовые поля («Другое», «Что именно не нашли?», email) */
.rspp-survey__input,
.rspp-survey__textarea {
    width: 100%;
    box-sizing: border-box;
    margin: 6px 0 0;
    padding: 9px 12px;
    border: 1px solid var(--rspp-survey-border);
    border-radius: 8px;
    font: inherit;
    font-size: 14px;
    color: var(--rspp-survey-text);
    background: #fff;
}

.rspp-survey__input:focus,
.rspp-survey__textarea:focus {
    outline: none;
    border-color: var(--rspp-survey-accent);
}

.rspp-survey__textarea {
    min-height: 64px;
    resize: vertical;
}

/* Согласие на обработку ПД */
.rspp-survey__consent {
    display: flex;
    gap: 8px;
    align-items: flex-start;
    margin: 10px 0 0;
    font-size: 12px;
    color: var(--rspp-survey-muted);
    cursor: pointer;
}

.rspp-survey__consent input {
    margin: 2px 0 0;
    accent-color: var(--rspp-survey-accent);
}

.rspp-survey__consent a {
    color: var(--rspp-survey-accent);
}

/* Honeypot: скрытое от людей поле-ловушка для ботов */
.rspp-survey__website {
    position: absolute !important;
    left: -9999px !important;
    width: 1px;
    height: 1px;
    opacity: 0;
}

.rspp-survey__error {
    margin: 8px 0 0;
    font-size: 13px;
    color: #c0392b;
}

/* Кнопки */
.rspp-survey__actions {
    display: flex;
    gap: 8px;
    margin-top: 14px;
}

.rspp-survey__btn {
    flex: 1 1 auto;
    padding: 10px 16px;
    border: 0;
    border-radius: 8px;
    font: inherit;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    background: var(--rspp-survey-accent);
    color: #fff;
    transition: background 0.15s ease;
}

.rspp-survey__btn:hover,
.rspp-survey__btn:focus-visible {
    background: var(--rspp-survey-accent-dark);
}

.rspp-survey__btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.rspp-survey__btn--ghost {
    flex: 0 0 auto;
    background: transparent;
    color: var(--rspp-survey-muted);
    font-weight: 400;
}

.rspp-survey__btn--ghost:hover,
.rspp-survey__btn--ghost:focus-visible {
    background: #f0f3f6;
    color: var(--rspp-survey-text);
}

/* Финальный экран */
.rspp-survey__thanks {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
}

.rspp-survey__thanks-icon {
    flex: 0 0 auto;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: #1e8a44;
    color: #fff;
    text-align: center;
    line-height: 28px;
    font-size: 15px;
}

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