/* OWNS: .xf-cookie, .xf-cookie__* (consent banner + панель «Настроить»), .xf-cookie--expanded.
   Все селекторы строго под .xf-cookie__ — не пересекаются с form.css (.licence_block)
   и css/*. Перед добавлением нового класса: grep по css/ и этому файлу.
   Уважает токены xcore_front (Onest + OKLCH accent 268°), dark/light.
   JS-контракт: container#cookie_notice__wrap, btnClose#cookies_btn__close,
   hide-class .cookie_hidden, panel#xf-cookie-prefs, чекбоксы #xf-pref-*. */

.xf-cookie {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 9999;
    background: var(--surface);
    color: var(--text);
    border-top: 1px solid var(--accent-line);
    box-shadow: 0 -8px 32px -8px oklch(0.3 0.05 285 / 0.18);
    font-family: var(--font-sans);
    transition: transform .4s cubic-bezier(0.16, 1, 0.3, 1), opacity .3s ease;
    transform: translateY(0);
    opacity: 1;
}

.xf-cookie.cookie_hidden {
    transform: translateY(120%);
    opacity: 0;
    pointer-events: none;
}

.xf-cookie__inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 14px 20px;
    display: flex;
    align-items: flex-start;
    gap: 16px;
}

.xf-cookie__main {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}

.xf-cookie__text {
    flex: 1 1 320px;
    margin: 0;
    font-size: 14px;
    line-height: 1.5;
    color: var(--text-2);
}

.xf-cookie__text strong { color: var(--text); font-weight: 600; }

.xf-cookie__link {
    color: var(--text);
    text-decoration: underline;
    text-decoration-color: var(--accent-line);
    text-underline-offset: 3px;
    transition: text-decoration-color .15s ease;
}

.xf-cookie__link:hover { text-decoration-color: var(--accent); }

.xf-cookie__actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

/* Действия согласия */
.xf-cookie__accept {
    appearance: none;
    border: 0;
    background: var(--accent);
    color: oklch(1 0 0);
    font: 500 14px/1 var(--font-sans);
    padding: 11px 20px;
    border-radius: 10px;
    cursor: pointer;
    transition: background .15s ease, transform .08s ease;
}
.xf-cookie__accept:hover  { background: var(--accent-2); }
.xf-cookie__accept:active { transform: scale(0.98); }

.xf-cookie__reject {
    appearance: none;
    background: transparent;
    color: var(--text-2);
    border: 1px solid var(--accent-line);
    font: 500 14px/1 var(--font-sans);
    padding: 10px 18px;
    border-radius: 10px;
    cursor: pointer;
    transition: color .15s ease, border-color .15s ease, background .15s ease, transform .08s ease;
}
.xf-cookie__reject:hover  { color: var(--text); border-color: var(--text-3); background: var(--surface-2); }
.xf-cookie__reject:active { transform: scale(0.98); }

/* «Настроить» — третичное действие (открыть панель), без рамки */
.xf-cookie__settings {
    appearance: none;
    background: transparent;
    border: 0;
    color: var(--text-2);
    font: 500 14px/1 var(--font-sans);
    padding: 10px 12px;
    border-radius: 10px;
    cursor: pointer;
    text-decoration: underline;
    text-decoration-color: var(--accent-line);
    text-underline-offset: 3px;
    transition: color .15s ease, background .15s ease;
}
.xf-cookie__settings:hover { color: var(--text); background: var(--surface-2); }

.xf-cookie__close {
    appearance: none;
    border: 0;
    background: transparent;
    color: var(--text-3);
    width: 36px;
    height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    cursor: pointer;
    flex-shrink: 0;
    transition: color .15s ease, background .15s ease;
}
.xf-cookie__close:hover { color: var(--text); background: var(--surface-2); }

/* ───────── Панель «Настроить» ───────── */
.xf-cookie__panel {
    border-top: 1px solid var(--surface-3);
    background: var(--surface-2);
}
.xf-cookie__panel[hidden] { display: none; }

.xf-cookie__panel-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 16px 20px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    max-height: 48vh;
    overflow-y: auto;
}

.xf-cookie__pref { display: flex; flex-direction: column; gap: 4px; }

.xf-cookie__pref-row {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
}
.xf-cookie__pref > .xf-cookie__pref-row { cursor: default; } /* locked-ряд «Необходимые» */
label.xf-cookie__pref-row { cursor: pointer; }

.xf-cookie__pref-title {
    flex: 1;
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
}

.xf-cookie__pref-state {
    font: 500 12px/1 var(--font-mono);
    color: var(--text-2); /* AA: consent-маркер должен проходить 4.5:1, --text-3 не дотягивает */
    letter-spacing: .02em;
}

.xf-cookie__pref-desc {
    margin: 0;
    font-size: 12.5px;
    line-height: 1.45;
    color: var(--text-2); /* AA: юридически значимое раскрытие — не --text-3 (4.38:1) */
    padding-right: 52px; /* запас под тумблер справа */
}

/* Доступный switch: визуально скрытый checkbox + дорожка с кноб'ом */
.xf-cookie__check {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    margin: 0;
    pointer-events: none;
}
.xf-cookie__switch {
    position: relative;
    flex-shrink: 0;
    width: 40px;
    height: 24px;
    border-radius: 999px;
    background: var(--surface-3);
    border: 1px solid var(--accent-line);
    transition: background .15s ease, border-color .15s ease, opacity .15s ease;
}
.xf-cookie__knob {
    position: absolute;
    top: 2px;
    left: 2px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--surface);
    box-shadow: 0 1px 2px oklch(0 0 0 / 0.25);
    transition: transform .15s ease;
}
.xf-cookie__check:checked + .xf-cookie__switch {
    background: var(--accent);
    border-color: var(--accent);
}
.xf-cookie__check:checked + .xf-cookie__switch .xf-cookie__knob {
    transform: translateX(16px);
}
.xf-cookie__check:focus-visible + .xf-cookie__switch {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

/* Locked-тумблер «Необходимые» — всегда вкл., не интерактивен */
.xf-cookie__switch--locked {
    background: var(--accent);
    border-color: var(--accent);
    opacity: .65;
}
.xf-cookie__switch--locked .xf-cookie__knob { transform: translateX(16px); }

.xf-cookie__panel-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding-top: 4px;
}

@media (max-width: 720px) {
    .xf-cookie__inner { padding: 10px 16px; gap: 8px; }
    .xf-cookie__main { gap: 10px; }
    .xf-cookie__text { flex-basis: 100%; padding-right: 36px; font-size: 13px; line-height: 1.4; }
    .xf-cookie__actions { width: 100%; gap: 6px; }
    .xf-cookie__settings { order: 3; flex: 1 1 100%; text-align: center; }
    .xf-cookie__reject,
    .xf-cookie__accept { flex: 1; padding: 10px 14px; font-size: 13px; }
    .xf-cookie__close { position: absolute; top: 6px; right: 6px; width: 30px; height: 30px; }
    .xf-cookie__panel-inner { padding: 14px 16px; max-height: 56vh; }
    .xf-cookie__pref-desc { padding-right: 0; }
    .xf-cookie__panel-actions { flex-direction: column-reverse; }
    .xf-cookie__panel-actions .xf-cookie__reject,
    .xf-cookie__panel-actions .xf-cookie__accept { width: 100%; text-align: center; }
}
