/*
 * Заявка на обратный звонок: кнопка-триггер и модалка с формой.
 * План — .claude/callback-request/00-plan.md.
 *
 * Файл подключён СПИСКОМ в AppAsset (обе ветки — обычная и redesign): кнопка живёт
 * и на карточке объявления (старый хром, bootstrap), и на странице компании
 * (изолированный redesign без bootstrap). Поэтому все правила самодостаточны:
 * ни одного наследования от bootstrap или redesign.css, свой префикс .gs-cb*.
 *
 * Модалку строит js/gs-cb.js — на странице компании кнопка приезжает внутри
 * AJAX-ответа таба, и разметки, отрисованной сервером при первой загрузке, могло бы
 * не быть в DOM.
 */

/* ---------- Кнопка-триггер ---------- */
/* Нейтральный вид: используется там, где вьюха не задала свои классы. */
.gs-cb-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 9px 16px;
    border: 1px solid #43b27d;
    border-radius: 8px;
    background: #fff;
    color: #2f8d61;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.2;
    cursor: pointer;
    transition: background-color .15s ease, color .15s ease, border-color .15s ease;
}

.gs-cb-btn:hover,
.gs-cb-btn:focus-visible {
    background: #43b27d;
    border-color: #43b27d;
    color: #fff;
}

.gs-cb-btn--wide {
    width: 100%;
    margin-top: 12px;
}

.gs-cb-trigger__icon {
    flex: 0 0 auto;
}

/*
 * Карточка объявления (старый хром): кнопка идёт третьей в колонке действий.
 * Колонка узкая (~150px), поэтому подпись держим в одну строку и ужимаем отступы —
 * иначе «Заказать звонок» переносится и кнопка становится вдвое выше соседей.
 */
.advert-contacts .gs-cb-trigger {
    margin-top: 8px;
    gap: 6px;
    padding: 9px 10px;
    font-size: 13px;
    white-space: nowrap;
    /*
     * Радиус повторяем за соседями по колонке. Наш класс не bootstrap-овский, поэтому
     * оба значения приходится задавать явно: у .btn в main.style.css радиус 10px,
     * а на ≤575px там же глобальное правило превращает кнопки в «таблетки» (40px) —
     * без этого «Заказать звонок» на телефоне выделялась острыми углами.
     */
    border-radius: 10px;
}

@media (max-width: 575px) {
    .advert-contacts .gs-cb-trigger {
        border-radius: 40px;
    }
}

/*
 * Тёмная карточка компании: кнопка на всю ширину блока контактов.
 * Ни рамки, ни отступа сверху (в отличие от прочих .co-side__group): кнопка — продолжение
 * списка телефонов, а не отдельный раздел карточки. Воздух даёт собственный
 * margin-top кнопки (.co-side__btn--ghost), как у пары «Написать» / «В избранное».
 */
.co-side__group--callback {
    margin-top: 0;
    padding-top: 0;
    border-top: 0;
}

.co-side__group--callback .gs-cb-trigger {
    width: 100%;
}

/*
 * На ≤640px redesign.css показывает блок контактов в табе «Информация»
 * (.co-contacts{display:block}) — там своя кнопка. Кнопку тёмной карточки прячем,
 * иначе на телефоне подряд идут две одинаковые.
 */
@media (max-width: 640px) {
    .co-side__group--callback {
        display: none;
    }
}

/*
 * …и в этом блоке кнопка оформлена ПЛАШКОЙ ТЕЛЕФОНА (.co-phone--light в redesign.css):
 * иконка слева, светлая плитка во всю ширину, тот же радиус и типографика. Так строка
 * «Заказать обратный звонок» читается как продолжение списка номеров, а не как чужая
 * зелёная кнопка. Правило само по себе мобильное: .co-contacts на десктопе display:none.
 * Цвета продублированы литералами (файл не наследует переменные redesign.css).
 */
.co-contacts .gs-cb-trigger {
    justify-content: flex-start;
    gap: 11px;
    width: 100%;
    margin-top: 9px;   /* тот же зазор, что между номерами (.co-phones gap) */
    padding: 10px 12px;
    border: 1px solid #E4F1EA;
    border-radius: 12px;
    background: #F4FAF7;
    color: #16130F;
    font-size: 14.5px;
    font-weight: 800;
    letter-spacing: -.02em;
    text-align: left;
}

.co-contacts .gs-cb-trigger:hover,
.co-contacts .gs-cb-trigger:focus-visible {
    background: #EEF7F2;
    border-color: #359966;
    color: #16130F;
}

.co-contacts .gs-cb-trigger__icon {
    width: 15px;
    height: 15px;
    color: #1F7A50;
}

/* ---------- Модалка ---------- */
.gs-cb-modal {
    position: fixed;
    inset: 0;
    z-index: 10050; /* выше bootstrap-модалок (1050) и шапки redesign */
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: rgba(16, 24, 21, .55);
    opacity: 0;
    transition: opacity .18s ease;
}

.gs-cb-modal[hidden] {
    display: none;
}

.gs-cb-modal.is-open {
    opacity: 1;
}

.gs-cb-modal__panel {
    position: relative;
    width: 100%;
    max-width: 420px;
    max-height: calc(100vh - 40px);
    overflow-y: auto;
    padding: 26px 24px 22px;
    border-radius: 16px;
    background: #fff;
    box-shadow: 0 24px 60px rgba(10, 22, 18, .28);
    font-family: inherit;
    transform: translateY(10px);
    transition: transform .18s ease;
}

.gs-cb-modal.is-open .gs-cb-modal__panel {
    transform: translateY(0);
}

.gs-cb-modal__close {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: #75858e;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
}

.gs-cb-modal__close:hover {
    background: #f1f4f0;
    color: #16211e;
}

.gs-cb-modal__title {
    margin: 0 0 6px;
    padding-right: 28px;
    font-size: 20px;
    font-weight: 700;
    line-height: 1.25;
    color: #16211e;
}

.gs-cb-modal__sub {
    margin: 0 0 18px;
    font-size: 13px;
    line-height: 1.45;
    color: #75858e;
}

/* ---------- Поля ---------- */
.gs-cb-field {
    margin-bottom: 14px;
}

.gs-cb-field__label {
    display: block;
    margin-bottom: 6px;
    font-size: 13px;
    font-weight: 600;
    color: #3d4a45;
}

.gs-cb-field__label span {
    color: #e0524d;
}

.gs-cb-field input,
.gs-cb-field textarea {
    width: 100%;
    padding: 11px 13px;
    border: 1px solid #dfe5e1;
    border-radius: 10px;
    background: #fff;
    font-family: inherit;
    font-size: 15px;
    line-height: 1.3;
    color: #16211e;
    transition: border-color .15s ease, box-shadow .15s ease;
    box-sizing: border-box;
}

.gs-cb-field textarea {
    min-height: 76px;
    resize: vertical;
}

.gs-cb-field input:focus,
.gs-cb-field textarea:focus {
    outline: none;
    border-color: #43b27d;
    box-shadow: 0 0 0 3px rgba(67, 178, 125, .15);
}

.gs-cb-field.has-error input,
.gs-cb-field.has-error textarea {
    border-color: #e0524d;
}

.gs-cb-field__error {
    margin-top: 5px;
    font-size: 12px;
    line-height: 1.35;
    color: #e0524d;
}

.gs-cb-field__error:empty {
    display: none;
}

/*
 * Ловушка для ботов: поле должно быть недоступно человеку, но заполняемо скриптом.
 * display:none многие боты пропускают — уводим за пределы экрана.
 */
.gs-cb-hp {
    position: absolute;
    left: -9999px;
    width: 1px;
    height: 1px;
    overflow: hidden;
    opacity: 0;
}

/* ---------- Капча ---------- */
.gs-cb-captcha {
    margin: 0 0 14px;
    min-height: 0;
}

.gs-cb-captcha:not(:empty) {
    min-height: 100px;
}

/* ---------- Кнопки и статусы ---------- */
.gs-cb-submit {
    width: 100%;
    padding: 12px 16px;
    border: 0;
    border-radius: 10px;
    background: #43b27d;
    color: #fff;
    font-family: inherit;
    font-size: 15px;
    font-weight: 600;
    line-height: 1.2;
    cursor: pointer;
    transition: background-color .15s ease;
}

.gs-cb-submit:hover:not(:disabled) {
    background: #379a6a;
}

.gs-cb-submit:disabled {
    opacity: .6;
    cursor: default;
}

.gs-cb-alert {
    margin: 0 0 14px;
    padding: 10px 12px;
    border-radius: 10px;
    background: #fdecea;
    color: #b23c37;
    font-size: 13px;
    line-height: 1.4;
}

.gs-cb-alert:empty {
    display: none;
}

.gs-cb-note {
    margin: 12px 0 0;
    font-size: 11px;
    line-height: 1.4;
    color: #96a3a9;
}

.gs-cb-note a {
    color: #75858e;
    text-decoration: underline;
}

/* Экран «заявка принята» */
.gs-cb-done {
    text-align: center;
    padding: 8px 0 4px;
}

.gs-cb-done__icon {
    width: 56px;
    height: 56px;
    margin: 0 auto 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: #e8f6ef;
    color: #43b27d;
}

.gs-cb-done__title {
    margin: 0 0 8px;
    font-size: 18px;
    font-weight: 700;
    color: #16211e;
}

.gs-cb-done__text {
    margin: 0 0 18px;
    font-size: 14px;
    line-height: 1.45;
    color: #5b6a64;
}

/* ---------- Телефон: модалка становится нижней шторкой ---------- */
@media (max-width: 575px) {
    .gs-cb-modal {
        padding: 0;
        align-items: flex-end;
    }

    .gs-cb-modal__panel {
        max-width: none;
        max-height: 92vh;
        border-radius: 18px 18px 0 0;
        padding: 22px 18px 18px;
        transform: translateY(24px);
    }
}

@media (prefers-reduced-motion: reduce) {
    .gs-cb-modal,
    .gs-cb-modal__panel {
        transition: none;
    }
}
