/**
 * Куки-баннер и окно настроек.
 *
 * Базируется на вёрстке, согласованной с заказчиком. Цвета, шрифт и радиус
 * вынесены в CSS-переменные и переопределяются из админки (ТЗ 3.6),
 * поэтому менять оформление можно без правки исходного кода.
 *
 * Адаптив от 320px (ТЗ 3.8).
 */

.ck {
    --ck-green: #52AD32;
    --ck-green-dark: #468f2b;
    /* Кнопка «Отклонить» — в цвет акцента: в макете она прозрачная, с рамкой. */
    --ck-second: #52AD32;
    --ck-second-dark: #468f2b;
    --ck-text: #2b2b2b;
    --ck-muted: #6b7280;
    --ck-line: #e3e6ea;
    --ck-bg: #ffffff;
    --ck-radius: 8px;
    --ck-font: Roboto, sans-serif;
    font-family: var(--ck-font);
    box-sizing: border-box;
}

.ck *,
.ck *::before,
.ck *::after {
    box-sizing: inherit;
}

/* Страница-хозяин может стилизовать button/input глобально (jQuery UI, jqx и т.п.) —
   сбрасываем то, что искажает вид баннера. Особенно важно в личном кабинете. */
.ck button {
    margin: 0;
    box-shadow: none;
    text-transform: none;
    text-shadow: none;
    outline: none;
}

.ck button:focus {
    box-shadow: none;
    outline: none;
}

.ck button:focus-visible {
    outline: 2px solid var(--ck-green);
    outline-offset: 2px;
}

/* ---------- баннер ---------- */

.ck-banner {
    position: fixed;
    left: 24px;
    bottom: 24px;
    z-index: 100000;
    width: 420px;
    max-width: calc(100vw - 32px);
    padding: 24px;
    background: var(--ck-bg);
    border-radius: var(--ck-radius);
    box-shadow: 0 12px 40px rgba(16, 24, 40, .18);
}

.ck-banner[hidden] {
    display: none;
}

/* Вариант «карточка в правом углу» */
.ck-banner--right:not(.ck-banner--bar) {
    left: auto;
    right: 24px;
}

.ck-banner__text {
    margin: 0 0 20px;
    font-size: 14px;
    line-height: 1.55;
    color: var(--ck-text);
}

.ck-banner__text a {
    color: var(--ck-green);
    text-decoration: underline;
}

.ck-banner__text a:hover {
    color: var(--ck-green-dark);
}

/* Вариант «горизонтальная полоса»: класс ck-banner--bar на .ck-banner. */

.ck-banner--bar {
    left: 15px;
    right: 15px;
    bottom: 24px;
    width: auto;
    max-width: 1240px;
    margin: 0 auto;
    padding: 0;
    border-radius: var(--ck-radius);
    box-shadow: 0 12px 40px rgba(16, 24, 40, .18);
}

.ck-banner--bar .ck-banner__inner {
    display: flex;
    flex-direction: column;
    gap: 20px;
    max-width: none;
    padding: 24px 32px;
    margin: 0;
}

.ck-banner--bar .ck-banner__text {
    margin: 0;
    max-height: 42vh;
    overflow-y: auto;
    overscroll-behavior: contain;
}

.ck-banner--bar .ck-banner__buttons {
    justify-content: center;
}

.ck-banner__buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}

/* ---------- кнопки ---------- */

.ck-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 11px 22px;
    border: 1px solid transparent;
    border-radius: 5px;
    font-family: inherit;
    font-size: 14px;
    font-weight: 700;
    line-height: 1.2;
    cursor: pointer;
    transition: background-color .2s, border-color .2s, color .2s;
}

.ck-btn--primary {
    background: var(--ck-green);
    color: #fff;
}

.ck-btn--primary:hover {
    background: var(--ck-green-dark);
}

.ck-btn--secondary {
    background: var(--ck-second);
    color: #fff;
}

.ck-btn--secondary:hover {
    background: var(--ck-second-dark);
}

/* Вариант по макету: прозрачная, только рамка. */
.ck-btn--secondary-ghost {
    background: transparent;
    border-color: var(--ck-second);
    color: var(--ck-second);
}

.ck-btn--secondary-ghost:hover {
    background: var(--ck-second);
    color: #fff;
}

.ck-btn--outline {
    background: transparent;
    border-color: var(--ck-green);
    color: var(--ck-green);
}

.ck-btn--outline:hover {
    background: var(--ck-green);
    color: #fff;
}

.ck-btn--link {
    padding: 11px 8px;
    background: none;
    color: var(--ck-muted);
    font-weight: 400;
    text-decoration: underline;
}

.ck-btn--link:hover {
    color: var(--ck-green);
}

/* ---------- окно настроек ---------- */

.ck-modal {
    position: fixed;
    inset: 0;
    z-index: 100001;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: rgba(16, 24, 40, .55);
}

.ck-modal[hidden] {
    display: none;
}

.ck-modal__window {
    display: flex;
    flex-direction: column;
    width: 640px;
    max-width: 100%;
    max-height: 100%;
    background: var(--ck-bg);
    border-radius: var(--ck-radius);
    box-shadow: 0 24px 64px rgba(16, 24, 40, .3);
}

.ck-modal__head {
    position: relative;
    flex: 0 0 auto;
    padding: 28px 32px 16px;
}

.ck-modal__title {
    margin: 0;
    padding: 0 32px;
    font-size: 22px;
    font-weight: 700;
    line-height: 1.3;
    text-align: center;
    color: var(--ck-text);
}

.ck-modal__intro,
.ck-modal__lead {
    margin: 12px 0 0;
    font-size: 14px;
    line-height: 1.55;
    color: var(--ck-muted);
}

.ck-modal__close {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 32px;
    height: 32px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: var(--ck-muted);
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
    transition: background-color .2s, color .2s;
}

.ck-modal__close:hover {
    background: #f2f4f7;
    color: var(--ck-text);
}

.ck-modal__body {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    padding: 8px 32px 0;
}

/* ---------- группы cookie ---------- */

.ck-group {
    padding: 20px 0;
    border-top: 1px solid var(--ck-line);
}

.ck-group:first-child {
    border-top: 0;
}

.ck-group__head {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 8px;
}

.ck-group__name {
    font-size: 15px;
    font-weight: 700;
    line-height: 1.35;
    color: var(--ck-text);
    cursor: pointer;
}

.ck-group__desc {
    margin: 0;
    padding-left: 32px;
    font-size: 13px;
    line-height: 1.6;
    color: var(--ck-muted);
}

/* ---------- чекбокс ---------- */

.ck-check {
    position: relative;
    flex: 0 0 auto;
    width: 20px;
    height: 20px;
    margin-top: 1px;
}

.ck-check input {
    position: absolute;
    width: 100%;
    height: 100%;
    margin: 0;
    opacity: 0;
    cursor: pointer;
}

.ck-check__box {
    display: block;
    width: 20px;
    height: 20px;
    border: 1px solid #c4cad3;
    border-radius: 4px;
    background: #fff;
    transition: background-color .2s, border-color .2s;
}

.ck-check__box::after {
    content: '';
    position: absolute;
    top: 4px;
    left: 7px;
    width: 5px;
    height: 10px;
    border: solid #fff;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg) scale(0);
    transition: transform .15s;
}

.ck-check input:checked ~ .ck-check__box {
    background: var(--ck-green);
    border-color: var(--ck-green);
}

.ck-check input:checked ~ .ck-check__box::after {
    transform: rotate(45deg) scale(1);
}

.ck-check input:focus-visible ~ .ck-check__box {
    outline: 2px solid var(--ck-green);
    outline-offset: 2px;
}

.ck-check input:disabled ~ .ck-check__box {
    background: #a8cf97;
    border-color: #a8cf97;
    cursor: default;
}

.ck-check input:disabled {
    cursor: default;
}

/* ---------- подвал окна ---------- */

.ck-modal__foot {
    flex: 0 0 auto;
    padding: 20px 32px 28px;
    border-top: 1px solid var(--ck-line);
}

.ck-modal__note {
    margin: 0 0 16px;
    font-size: 13px;
    line-height: 1.6;
    color: var(--ck-muted);
}

.ck-modal__note a {
    color: var(--ck-green);
    text-decoration: underline;
}

.ck-modal__note a:hover {
    color: var(--ck-green-dark);
}

.ck-modal__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
}

/* ---------- постоянная кнопка вызова настроек (ТЗ 4.4) ---------- */

.ck-recall {
    position: fixed;
    left: 20px;
    bottom: 20px;
    z-index: 99998;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px 10px 12px;
    border: 1px solid var(--ck-line);
    border-radius: 999px;
    background: var(--ck-bg);
    color: var(--ck-text);
    font-family: var(--ck-font);
    font-size: 13px;
    font-weight: 700;
    line-height: 1;
    cursor: pointer;
    box-shadow: 0 6px 20px rgba(16, 24, 40, .16);
    transition: border-color .2s, color .2s, transform .2s;
}

.ck-recall[hidden] {
    display: none;
}

.ck-recall:hover {
    border-color: var(--ck-green);
    color: var(--ck-green);
    transform: translateY(-1px);
}

.ck-recall__icon {
    display: inline-flex;
    color: var(--ck-green);
}

/* Кнопка, встроенная в подвал сайта (footer_button_style = inline) */
.ck-recall--inline {
    position: static;
    box-shadow: none;
}

/* ---------- адаптив ---------- */

@media only screen and (max-width: 1000px) {
    .ck-banner--bar .ck-banner__inner {
        gap: 16px;
        padding: 20px 24px;
    }

    .ck-modal__title {
        font-size: 20px;
    }
}

@media only screen and (max-width: 768px) {
    .ck-banner--bar {
        left: 12px;
        right: 12px;
        bottom: 12px;
    }

    .ck-banner--bar .ck-banner__inner {
        padding: 18px 20px;
    }

    .ck-banner--bar .ck-banner__buttons {
        justify-content: stretch;
    }

    .ck-banner__buttons .ck-btn {
        flex: 1 1 160px;
    }
}

@media only screen and (max-width: 600px) {
    .ck-banner:not(.ck-banner--bar) {
        left: 12px;
        right: 12px;
        bottom: 12px;
        width: auto;
        padding: 20px;
    }

    .ck-banner__text {
        font-size: 13px;
    }

    .ck-banner--bar .ck-banner__inner {
        gap: 14px;
        padding: 16px;
    }

    .ck-banner--bar .ck-banner__text {
        max-height: 38vh;
    }

    .ck-banner__buttons {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }

    .ck-banner__buttons .ck-btn {
        flex: 0 0 auto;
        width: 100%;
    }

    .ck-modal {
        padding: 12px;
    }

    .ck-modal__head {
        padding: 22px 20px 12px;
    }

    .ck-modal__title {
        padding: 0 28px;
        font-size: 18px;
        text-align: left;
    }

    .ck-modal__close {
        top: 14px;
        right: 12px;
    }

    .ck-modal__body {
        padding: 8px 20px 0;
    }

    .ck-modal__foot {
        padding: 16px 20px 20px;
    }

    .ck-modal__actions {
        flex-direction: column;
    }

    .ck-modal__foot .ck-btn {
        width: 100%;
    }

    .ck-group {
        padding: 16px 0;
    }

    .ck-recall__label {
        display: none;
    }

    .ck-recall {
        padding: 12px;
        border-radius: 50%;
    }
}

@media only screen and (max-width: 380px) {
    .ck-banner--bar .ck-banner__inner {
        padding: 14px;
    }

    .ck-group__desc {
        padding-left: 0;
    }
}

@media only screen and (max-height: 500px) {
    .ck-banner--bar .ck-banner__text {
        max-height: 30vh;
    }

    .ck-modal {
        padding: 8px;
    }

    .ck-modal__head {
        padding: 16px 20px 10px;
    }

    .ck-modal__foot {
        padding: 12px 20px 14px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .ck * {
        transition: none !important;
    }
}
