/* CTA «Нужен нестандартный размер?» (tpl/blocks/cta.tpl, javascript/cta.js).
   Цвет меняется параметром cta_color (переменная --cta-color). */

.cta {
    --cta-color: #8cc63e;
    --cta-panel-width: 250px;
    --cta-tab-width: 40px;
    position: fixed;
    top: 50%;
    right: 0;
    z-index: 100; /* ниже всплывающих окон сайта (.popupPhone — 101) */
    display: flex;
    align-items: stretch;
    -webkit-transform: translateY(-50%);
    transform: translateY(-50%);
    font-family: 'Open Sans', sans-serif;
}

/* Плашка: свёрнута в ширину 0, при открытии плавно выезжает влево от закладки */
.cta__panel {
    width: 0;
    overflow: hidden;
    background: #fff;
    box-shadow: -4px 0 16px rgba(0, 0, 0, .15);
    -webkit-transition: width .35s ease;
    transition: width .35s ease;
}

.cta__panel-inner {
    position: relative;
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
    width: var(--cta-panel-width);
    height: 100%;
    padding: 22px 20px 20px;
}

.cta.is-open .cta__panel {
    width: var(--cta-panel-width);
}

@media (hover: hover) and (pointer: fine) {
    .cta:hover .cta__panel,
    .cta:focus-within .cta__panel {
        width: var(--cta-panel-width);
    }

    /* Свёрнута крестиком — не раскрывать, пока курсор не уйдёт */
    .cta.is-suppressed:hover .cta__panel,
    .cta.is-suppressed:focus-within .cta__panel {
        width: 0;
    }
}

.cta__close {
    position: absolute;
    top: 4px;
    right: 6px;
    padding: 0 4px;
    border: 0;
    background: none;
    color: #999;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
}

.cta__close:hover {
    color: #333;
}

.cta__title {
    margin-bottom: 14px;
    color: #222;
    font-family: 'Open Sans Bold', sans-serif;
    font-size: 20px;
    font-weight: 800;
    line-height: 1.3;
}

.cta__text {
    flex-grow: 1;
    margin-bottom: 18px;
    color: #333;
    font-size: 15px;
    line-height: 1.4;
}

.cta__btn {
    display: block;
    padding: 12px 10px;
    border-radius: 7px;
    background: var(--cta-color);
    color: #fff;
    font-family: 'Open Sans Bold', sans-serif;
    font-size: 14px;
    text-align: center;
    text-decoration: none;
    white-space: nowrap;
    -webkit-transition: opacity .2s;
    transition: opacity .2s;
}

.cta__btn:hover,
.cta__btn:focus {
    color: #fff;
    text-decoration: none;
    opacity: .85;
}

/* Вертикальная закладка: текст снизу вверх */
.cta__tab {
    display: flex;
    align-items: center;
    justify-content: center;
    width: var(--cta-tab-width);
    min-height: 260px;
    padding: 14px 0;
    border: 0;
    border-radius: 7px 0 0 7px;
    background: var(--cta-color);
    color: #fff;
    cursor: pointer;
    box-shadow: -2px 0 8px rgba(0, 0, 0, .15);
}

.cta__tab-text {
    -webkit-writing-mode: vertical-rl;
    writing-mode: vertical-rl;
    -webkit-transform: rotate(180deg);
    transform: rotate(180deg);
    font-family: 'Open Sans Bold', sans-serif;
    font-size: 14px;
    letter-spacing: .3px;
    white-space: nowrap;
}

.cta__tab-text:before {
    content: '\2039'; /* ‹ — подсказка, что закладка выезжает */
    display: inline-block;
    margin-bottom: 8px;
    -webkit-transform: rotate(90deg);
    transform: rotate(90deg);
    font-size: 18px;
    line-height: 1;
    -webkit-transition: transform .35s;
    transition: transform .35s;
}

.cta.is-open .cta__tab-text:before {
    -webkit-transform: rotate(-90deg);
    transform: rotate(-90deg);
}

@media (hover: hover) and (pointer: fine) {
    .cta:hover .cta__tab-text:before {
        -webkit-transform: rotate(-90deg);
        transform: rotate(-90deg);
    }
}

/* Мобильные: закладка уже и ниже по экрану, чтобы не заслонять кнопки в карточках и шапку */
@media (max-width: 767px) {
    .cta {
        --cta-panel-width: 220px;
        --cta-tab-width: 30px;
        top: 55%;
    }

    .cta__tab {
        min-height: 200px;
        padding: 10px 0;
    }

    .cta__tab-text {
        font-size: 12px;
    }

    .cta__panel-inner {
        padding: 18px 16px 16px;
    }

    .cta__title {
        font-size: 17px;
    }

    .cta__text {
        font-size: 14px;
    }
}

@media print {
    .cta,
    .cta-popup {
        display: none !important;
    }
}

/* Форма заявки: оформление как у формы «Узнать цену» (.popupPhone, .callback-but .b-btn_adv в main.css) */
.cta-popup {
    z-index: 1001; /* поверх баннера cookie (.container-cookie-message — 1000) */
}

.cta-popup .callback-form {
    max-width: 440px;
}

#cta-form-fields > div {
    margin-bottom: 10px;
}

#cta-form-fields input[type="text"] {
    height: 50px;
    border-radius: 10px;
}

#cta-form-fields textarea {
    height: 100px;
    border-radius: 10px;
    resize: vertical;
}

.cta-popup__trap {
    position: absolute;
    left: -10000px;
    width: 1px;
    height: 1px;
    overflow: hidden;
}

.cta-popup__files input[type="file"] {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
}

.cta-popup__files-btn {
    display: inline-block;
    padding: 8px 14px;
    border: 1px dashed #999;
    border-radius: 7px;
    color: #333;
    font-size: 14px;
    cursor: pointer;
}

.cta-popup__files-btn:hover,
.cta-popup__files input[type="file"]:focus + .cta-popup__files-btn {
    border-color: var(--cta-color, #8cc63e);
    color: #000;
}

.cta-popup__files-list {
    margin-top: 6px;
    color: #333;
    font-size: 13px;
    word-break: break-all;
}

.cta-popup__files-hint {
    margin-top: 4px;
    color: #888;
    font-size: 12px;
    line-height: 1.3;
}

.cta-popup__submit {
    cursor: pointer;
}

.cta-popup__submit[disabled] {
    opacity: .6;
    cursor: default;
}

.cta-popup__preload,
.cta-popup__result {
    display: none;
}

.cta-popup__result {
    color: #8cc63e;
}
