/* ============================================================
   Уведомление о cookie и окно настроек согласия
   Разметка — /local/include/main/cookie-consent.php,
   логика — /local/templates/zipteh/assets/js/cookie-consent.js.
   22.09.2026.

   Все правила — внутри #ztCookieConsent и #ztCookieSettings:
   общие стили сайта не меняются.

   reset.css даёт каждому элементу 16 px, line-height 1 и свой цвет,
   поэтому кегль, интерлиньяж и цвет заданы каждому тексту явно,
   а вложенные ссылки и подписи наследуют их через inherit.
   Гарнитуры не задаются: их раздаёт zt-redesign.css по ролям
   (<button> — Manrope, «__heading» — Russo One, текст — Tektur).

   Слои: карточка — 9980, ниже нижнего меню (9990), шторки
   «Связаться» (9995), уведомлений корзины и окон заявок — любое
   окно сайта перекрывает карточку. Окно настроек — поверх всего.
   ============================================================ */

#ztCookieConsent,
#ztCookieSettings {
    --zt-cc-ink: var(--zt-ink, #333A43);
    --zt-cc-soft: #56606B;
    --zt-cc-line: #E3E6EA;
    --zt-cc-yellow: var(--zt-yellow, #FFB800);
    --zt-cc-yellow-hover: var(--zt-yellow-hover, #E8A600);
    --zt-cc-radius: var(--zt-radius-card, 12px);
    --zt-cc-radius-btn: var(--zt-radius-btn, 8px);
}

#ztCookieConsent[hidden],
#ztCookieSettings[hidden] {
    display: none !important;
}

/* ---------- Карточка уведомления ---------- */

#ztCookieConsent {
    position: fixed;
    left: 24px;
    bottom: var(--zt-cc-bottom, 24px);
    z-index: 9980;
    width: min(480px, calc(100vw - 48px));
    margin: 0;
    padding: 0;
    transition: transform .32s cubic-bezier(.2, .8, .2, 1), opacity .32s ease;
}

#ztCookieConsent.zt-cc--enter {
    transform: translateY(16px);
    opacity: 0;
}

#ztCookieConsent.zt-cc--leave {
    transform: translateY(16px);
    opacity: 0;
    pointer-events: none;
}

#ztCookieConsent .zt-cc__card {
    display: grid;
    gap: 12px;
    padding: 20px 22px 22px;
    background: #fff;
    border: 1px solid var(--zt-cc-line);
    border-radius: var(--zt-cc-radius);
    box-shadow: 0 24px 70px rgba(17, 24, 32, .22), 0 2px 6px rgba(17, 24, 32, .06);
    color: var(--zt-cc-ink);
}

#ztCookieConsent .zt-cc__top {
    display: flex;
    align-items: center;
    gap: 12px;
}

#ztCookieConsent .zt-cc__icon {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--zt-cc-yellow);
}

#ztCookieConsent .zt-cc__icon svg {
    width: 24px;
    height: 24px;
    fill: none;
    stroke: #1A1A1A;
    stroke-width: 1.7;
    stroke-linecap: round;
    stroke-linejoin: round;
}

#ztCookieConsent .zt-cc__icon svg circle {
    fill: #1A1A1A;
    stroke: none;
}

#ztCookieConsent .zt-cc__heading {
    margin: 0;
    font-size: 19px;
    line-height: 1.25;
    font-weight: 400;
    color: var(--zt-cc-ink);
}

#ztCookieConsent .zt-cc__text {
    margin: 0;
    font-size: 14px;
    line-height: 1.5;
    font-weight: 400;
    color: var(--zt-cc-soft);
}

#ztCookieConsent .zt-cc__link,
#ztCookieSettings .zt-cc__link {
    font-size: inherit;
    line-height: inherit;
    font-weight: 600;
    color: var(--zt-cc-ink);
    text-decoration: underline;
    text-decoration-color: var(--zt-cc-yellow);
    text-decoration-thickness: 2px;
    text-underline-offset: 3px;
    transition: color .16s ease, text-decoration-color .16s ease;
}

#ztCookieConsent .zt-cc__link:hover,
#ztCookieSettings .zt-cc__link:hover {
    color: #000;
    text-decoration-color: var(--zt-cc-yellow-hover);
}

/* Один ряд на всех ширинах: значок ⚙ · «Только необходимые» (тянется) ·
   «Принять» справа. */
#ztCookieConsent .zt-cc__actions {
    display: grid;
    grid-template-columns: 44px minmax(0, 1fr) auto;
    align-items: center;
    gap: 8px;
    margin-top: 4px;
}

/* ---------- Кнопки (общие для карточки и окна) ---------- */

#ztCookieConsent .zt-cc__button,
#ztCookieSettings .zt-cc__button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 44px;
    margin: 0;
    padding: 0 18px;
    border: 1px solid transparent;
    border-radius: var(--zt-cc-radius-btn);
    background: transparent;
    font-size: 14px;
    line-height: 1.2;
    font-weight: 700;
    color: var(--zt-cc-ink);
    white-space: nowrap;
    cursor: pointer;
    transition: background-color .16s ease, border-color .16s ease, color .16s ease, box-shadow .16s ease;
}

#ztCookieConsent .zt-cc__button > span,
#ztCookieSettings .zt-cc__button > span {
    font-size: inherit;
    line-height: inherit;
    font-weight: inherit;
    color: inherit;
}

#ztCookieConsent .zt-cc__button--accept,
#ztCookieSettings .zt-cc__button--accept {
    background: var(--zt-cc-yellow);
    border-color: var(--zt-cc-yellow);
    color: #1A1A1A;
    padding: 0 24px;
}

#ztCookieConsent .zt-cc__button--accept:hover,
#ztCookieSettings .zt-cc__button--accept:hover {
    background: var(--zt-cc-yellow-hover);
    border-color: var(--zt-cc-yellow-hover);
    box-shadow: 0 12px 28px rgba(255, 184, 0, .24);
}

#ztCookieConsent .zt-cc__button--necessary,
#ztCookieSettings .zt-cc__button--necessary {
    background: #fff;
    border-color: #CDD2D8;
}

#ztCookieConsent .zt-cc__button--necessary:hover,
#ztCookieSettings .zt-cc__button--necessary:hover {
    border-color: var(--zt-cc-ink);
}

/* «Настроить» — квадратный значок слева в ряду кнопок, «Принять» — справа
   (указания заказчика 22.09.2026: «кнопка принять должна быть справа под
   палец», «оставить один значок с настройками… слева рядом с кнопками»,
   «и в версиях для пк можно только значок оставить»). Подпись скрыта
   визуально, но остаётся названием кнопки для экранных дикторов; мышью —
   подсказка title. */
#ztCookieConsent .zt-cc__button--settings {
    width: 44px;
    min-width: 44px;
    padding: 0;
    background: #fff;
    border-color: #CDD2D8;
    color: var(--zt-cc-ink);
}

#ztCookieConsent .zt-cc__button--settings:hover {
    border-color: var(--zt-cc-ink);
    background: #F7F8FA;
}

#ztCookieConsent .zt-cc__button--settings svg {
    width: 20px;
    height: 20px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
}

#ztCookieConsent .zt-cc__button-label {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0 0 0 0);
    clip-path: inset(50%);
    white-space: nowrap;
    border: 0;
}

#ztCookieConsent .zt-cc__button:focus-visible,
#ztCookieSettings .zt-cc__button:focus-visible,
#ztCookieSettings .zt-cc-dialog__close:focus-visible,
#ztCookieConsent .zt-cc__link:focus-visible,
#ztCookieSettings .zt-cc__link:focus-visible {
    outline: 3px solid rgba(255, 184, 0, .55);
    outline-offset: 2px;
}

/* ---------- Окно настроек ---------- */

#ztCookieSettings {
    position: fixed;
    inset: 0;
    z-index: 2147483100;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

#ztCookieSettings .zt-cc-dialog__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(17, 24, 32, .5);
}

#ztCookieSettings .zt-cc-dialog__panel {
    position: relative;
    width: min(580px, 100%);
    max-height: calc(100vh - 48px);
    max-height: calc(100dvh - 48px);
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 26px 28px 24px;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 24px 70px rgba(17, 24, 32, .3);
    color: var(--zt-cc-ink);
    outline: none;
}

#ztCookieSettings .zt-cc-dialog__head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
}

#ztCookieSettings .zt-cc-dialog__heading {
    margin: 4px 0 0;
    font-size: 22px;
    line-height: 1.2;
    font-weight: 400;
    color: var(--zt-cc-ink);
}

#ztCookieSettings .zt-cc-dialog__close {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    margin: -6px -10px 0 0;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: var(--zt-cc-soft);
    cursor: pointer;
}

#ztCookieSettings .zt-cc-dialog__close:hover {
    background: #F3F4F6;
    color: var(--zt-cc-ink);
}

#ztCookieSettings .zt-cc-dialog__close svg {
    width: 22px;
    height: 22px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
}

#ztCookieSettings .zt-cc-dialog__lead {
    margin: 10px 0 0;
    font-size: 14px;
    line-height: 1.5;
    font-weight: 400;
    color: var(--zt-cc-soft);
}

#ztCookieSettings .zt-cc-dialog__list {
    margin: 18px 0 0;
    padding: 0;
    list-style: none;
    border-top: 1px solid var(--zt-cc-line);
}

#ztCookieSettings .zt-cc-cat {
    margin: 0;
    padding: 16px 0;
    list-style: none;
    border-bottom: 1px solid var(--zt-cc-line);
}

#ztCookieSettings .zt-cc-cat::before,
#ztCookieSettings .zt-cc-cat::marker {
    content: none;
}

#ztCookieSettings .zt-cc-cat__row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

#ztCookieSettings .zt-cc-cat__name {
    margin: 0;
    font-size: 16px;
    line-height: 1.3;
    font-weight: 700;
    color: var(--zt-cc-ink);
    cursor: default;
}

#ztCookieSettings label.zt-cc-cat__name {
    cursor: pointer;
}

#ztCookieSettings .zt-cc-cat__always {
    flex: 0 0 auto;
    font-size: 13px;
    line-height: 1.2;
    font-weight: 600;
    color: #2E7D32;
}

#ztCookieSettings .zt-cc-cat__text {
    margin: 6px 0 0;
    font-size: 13px;
    line-height: 1.5;
    font-weight: 400;
    color: var(--zt-cc-soft);
}

/* Переключатель: настоящий чекбокс поверх нарисованной дорожки —
   клавиатура, экранные дикторы и клик работают без скрипта. */
#ztCookieSettings .zt-cc-switch {
    position: relative;
    flex: 0 0 auto;
    display: inline-block;
    width: 48px;
    height: 28px;
}

#ztCookieSettings .zt-cc-switch__input {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    margin: 0;
    opacity: 0;
    cursor: pointer;
    z-index: 1;
}

#ztCookieSettings .zt-cc-switch__track {
    position: absolute;
    inset: 0;
    border-radius: 999px;
    background: #C9CED4;
    transition: background-color .18s ease;
}

#ztCookieSettings .zt-cc-switch__thumb {
    position: absolute;
    top: 3px;
    left: 3px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, .25);
    transition: transform .18s ease;
}

#ztCookieSettings .zt-cc-switch__input:checked + .zt-cc-switch__track {
    background: var(--zt-cc-yellow);
}

#ztCookieSettings .zt-cc-switch__input:checked + .zt-cc-switch__track .zt-cc-switch__thumb {
    transform: translateX(20px);
}

#ztCookieSettings .zt-cc-switch__input:focus-visible + .zt-cc-switch__track {
    outline: 3px solid rgba(255, 184, 0, .55);
    outline-offset: 2px;
}

#ztCookieSettings .zt-cc-dialog__actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 20px;
}

#ztCookieSettings .zt-cc-dialog__links {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 10px;
    margin: 18px 0 0;
    font-size: 13px;
    line-height: 1.4;
    font-weight: 400;
    color: var(--zt-cc-soft);
}

#ztCookieSettings .zt-cc-dialog__links > span {
    font-size: inherit;
    line-height: inherit;
    color: inherit;
}

#ztCookieSettings .zt-cc-dialog__links .zt-cc__link {
    font-weight: 600;
}

html.zt-cc-lock,
html.zt-cc-lock body {
    overflow: hidden !important;
}

/* ---------- Планшет и ноутбук с нижним меню (≤1399) ----------
   Высоту меню меряет скрипт и кладёт в --zt-cc-bottom;
   здесь — запас на случай, если замер не успел. */
@media (max-width: 1399px) {
    #ztCookieConsent {
        bottom: var(--zt-cc-bottom, calc(68px + env(safe-area-inset-bottom, 0px)));
    }
}

/* ---------- Телефон ---------- */
@media (max-width: 640px) {
    #ztCookieConsent {
        left: 12px;
        right: 12px;
        width: auto;
    }

    #ztCookieConsent .zt-cc__card {
        gap: 10px;
        padding: 16px 16px 14px;
    }

    #ztCookieConsent .zt-cc__icon {
        width: 32px;
        height: 32px;
    }

    #ztCookieConsent .zt-cc__icon svg {
        width: 20px;
        height: 20px;
    }

    #ztCookieConsent .zt-cc__heading {
        font-size: 17px;
    }

    #ztCookieConsent .zt-cc__text {
        font-size: 13px;
        line-height: 1.45;
    }

    #ztCookieConsent .zt-cc__actions {
        margin-top: 2px;
    }

    #ztCookieConsent .zt-cc__button:not(.zt-cc__button--settings) {
        padding: 0 10px;
        font-size: 14px;
    }

    /* узко — «Только необходимые» переносится в две строки, кнопка
       остаётся 44 px */
    #ztCookieConsent .zt-cc__button--necessary {
        padding: 0 8px;
        white-space: normal;
        text-align: center;
    }

    #ztCookieConsent .zt-cc__button--accept {
        padding: 0 20px;
    }

    #ztCookieSettings {
        align-items: flex-end;
        padding: 0;
    }

    #ztCookieSettings .zt-cc-dialog__panel {
        width: 100%;
        max-height: 92vh;
        max-height: 92dvh;
        padding: 20px 16px calc(16px + env(safe-area-inset-bottom, 0px));
        border-radius: 16px 16px 0 0;
    }

    #ztCookieSettings .zt-cc-dialog__heading {
        font-size: 20px;
    }

    /* «Принять все» — нижней кнопкой, под палец */
    #ztCookieSettings .zt-cc-dialog__actions {
        display: grid;
        grid-template-columns: 1fr;
    }
}

/* На самых узких (320–359) — кегль кнопок 13 */
@media (max-width: 359px) {
    #ztCookieConsent .zt-cc__button {
        font-size: 13px;
    }

    #ztCookieConsent .zt-cc__button--accept {
        padding: 0 16px;
    }
}

/* Телефон боком: мало высоты — карточка ниже, без заголовка, кнопки 40 px. */
@media (max-height: 480px) and (orientation: landscape) {
    #ztCookieConsent .zt-cc__card {
        gap: 8px;
        padding: 12px 16px;
    }

    #ztCookieConsent .zt-cc__top {
        display: none;
    }

    #ztCookieConsent .zt-cc__actions {
        grid-template-columns: 40px minmax(0, 1fr) auto;
    }

    #ztCookieConsent .zt-cc__button {
        min-height: 40px;
    }

    #ztCookieConsent .zt-cc__button--settings {
        width: 40px;
        min-width: 40px;
    }
}

@media (prefers-reduced-motion: reduce) {
    #ztCookieConsent,
    #ztCookieSettings .zt-cc-switch__track,
    #ztCookieSettings .zt-cc-switch__thumb {
        transition: none;
    }
}

@media print {
    #ztCookieConsent,
    #ztCookieSettings {
        display: none !important;
    }
}
