/**
 * AlavirCookie — стили виджета согласия на обработку cookie-файлов.
 * Все правила изолированы префиксом .ac- и контейнером .ac-root.
 */

.ac-root {
    --ac-accent: #1a73e8;
    --ac-accent-text: #ffffff;
    --ac-bg: #ffffff;
    --ac-text: #1f2430;
    --ac-muted: #5f6673;
    --ac-border: #e3e6eb;
    --ac-shadow: 0 8px 40px rgba(15, 23, 42, 0.18);
    --ac-radius: 14px;

    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
        "Helvetica Neue", Arial, sans-serif;
    font-size: 15px;
    line-height: 1.5;
    color: var(--ac-text);
    -webkit-font-smoothing: antialiased;
}

.ac-theme--dark {
    --ac-bg: #1e2430;
    --ac-text: #eef1f6;
    --ac-muted: #a7afbd;
    --ac-border: #333c4d;
    --ac-shadow: 0 8px 40px rgba(0, 0, 0, 0.5);
}

@media (prefers-color-scheme: dark) {
    .ac-theme--auto {
        --ac-bg: #1e2430;
        --ac-text: #eef1f6;
        --ac-muted: #a7afbd;
        --ac-border: #333c4d;
        --ac-shadow: 0 8px 40px rgba(0, 0, 0, 0.5);
    }
}

.ac-root *,
.ac-root *::before,
.ac-root *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

/* Атрибут hidden должен скрывать элементы даже при заданном display
   (например, display: flex у .ac-modal) */
.ac-root [hidden],
.ac-root[hidden] {
    display: none !important;
}

.ac-link {
    color: var(--ac-accent);
    text-decoration: underline;
    text-underline-offset: 2px;
}

.ac-link:hover {
    text-decoration: none;
}

html.ac-no-scroll,
html.ac-no-scroll body {
    overflow: hidden;
}

/* ---------------- Кнопки ---------------- */

.ac-btn {
    display: inline-block;
    padding: 10px 22px;
    border-radius: 999px;
    border: 1px solid transparent;
    font: inherit;
    font-weight: 600;
    cursor: pointer;
    transition: filter 0.15s ease, background-color 0.15s ease;
    white-space: nowrap;
}

.ac-btn:focus-visible {
    outline: 2px solid var(--ac-accent);
    outline-offset: 2px;
}

.ac-btn--primary {
    background: var(--ac-accent);
    color: var(--ac-accent-text);
}

.ac-btn--primary:hover {
    filter: brightness(1.08);
}

/* «Отклонить» визуально равнозначна «Принять» — требование
   прозрачности НЦЗПД (запрет «тёмных паттернов») */
.ac-btn--secondary {
    background: transparent;
    color: var(--ac-accent);
    border-color: var(--ac-accent);
}

.ac-btn--secondary:hover {
    background: rgba(127, 127, 127, 0.08);
}

/* ---------------- Баннер ---------------- */

.ac-banner {
    position: fixed;
    z-index: 2147483000;
    background: var(--ac-bg);
    box-shadow: var(--ac-shadow);
    animation: ac-slide-up 0.35s ease;
}

@keyframes ac-slide-up {
    from { transform: translateY(24px); opacity: 0; }
    to   { transform: translateY(0);    opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
    .ac-banner { animation: none; }
}

.ac-banner--bar {
    left: 0;
    right: 0;
    bottom: 0;
    border-top: 1px solid var(--ac-border);
}

.ac-banner--bar .ac-banner__inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 18px 24px;
}

.ac-banner--left,
.ac-banner--right {
    bottom: 20px;
    max-width: 440px;
    border: 1px solid var(--ac-border);
    border-radius: var(--ac-radius);
}

.ac-banner--left  { left: 20px; }
.ac-banner--right { right: 20px; }

.ac-banner--left .ac-banner__inner,
.ac-banner--right .ac-banner__inner {
    padding: 20px 22px;
}

.ac-banner__title {
    font-size: 17px;
    font-weight: 700;
    margin-bottom: 6px;
}

.ac-banner__text {
    color: var(--ac-muted);
    margin-bottom: 14px;
}

.ac-banner__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

@media (max-width: 640px) {
    .ac-banner--left,
    .ac-banner--right {
        left: 10px;
        right: 10px;
        bottom: 10px;
        max-width: none;
    }

    .ac-banner__actions .ac-btn {
        flex: 1 1 auto;
        text-align: center;
    }
}

/* ---------------- Модальное окно ---------------- */

.ac-modal {
    position: fixed;
    inset: 0;
    z-index: 2147483100;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.ac-modal__overlay {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.55);
}

.ac-modal__dialog {
    position: relative;
    width: 100%;
    max-width: 680px;
    max-height: calc(100vh - 40px);
    overflow-y: auto;
    background: var(--ac-bg);
    border-radius: var(--ac-radius);
    box-shadow: var(--ac-shadow);
    padding: 28px 30px;
    animation: ac-fade-in 0.25s ease;
}

@keyframes ac-fade-in {
    from { transform: translateY(14px); opacity: 0; }
    to   { transform: translateY(0);    opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
    .ac-modal__dialog { animation: none; }
}

.ac-modal__close {
    position: absolute;
    top: 14px;
    right: 16px;
    width: 34px;
    height: 34px;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: var(--ac-muted);
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
}

.ac-modal__close:hover {
    background: rgba(127, 127, 127, 0.12);
    color: var(--ac-text);
}

.ac-modal__title {
    font-size: 22px;
    font-weight: 700;
    line-height: 1.3;
    margin-bottom: 14px;
    padding-right: 36px;
}

.ac-modal__title::after {
    content: "";
    display: block;
    width: 64px;
    height: 3px;
    margin-top: 12px;
    border-radius: 2px;
    background: var(--ac-accent);
}

.ac-modal__text {
    color: var(--ac-muted);
    margin-bottom: 12px;
}

.ac-modal__note {
    font-size: 13.5px;
}

.ac-modal__actions {
    margin-top: 20px;
}

/* ---------------- Категории ---------------- */

.ac-cats {
    margin-top: 16px;
    border-top: 1px solid var(--ac-border);
}

.ac-cat {
    border-bottom: 1px solid var(--ac-border);
}

.ac-cat__head {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 13px 0;
}

.ac-cat__name {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    border: 0;
    background: transparent;
    font: inherit;
    font-weight: 600;
    color: var(--ac-text);
    cursor: pointer;
    text-align: left;
}

.ac-cat__name:hover {
    color: var(--ac-accent);
}

.ac-cat__arrow {
    flex: 0 0 auto;
    transition: transform 0.2s ease;
}

.ac-cat--open .ac-cat__arrow {
    transform: rotate(180deg);
}

.ac-cat__desc {
    padding: 0 0 14px 58px;
    color: var(--ac-muted);
    font-size: 14px;
}

@media (max-width: 640px) {
    .ac-cat__desc { padding-left: 0; }
}

/* ---------------- Переключатель ---------------- */

.ac-switch {
    position: relative;
    flex: 0 0 auto;
    width: 44px;
    height: 24px;
    display: inline-block;
    cursor: pointer;
}

.ac-switch input {
    position: absolute;
    opacity: 0;
    width: 100%;
    height: 100%;
    margin: 0;
    cursor: pointer;
}

.ac-switch__slider {
    position: absolute;
    inset: 0;
    border-radius: 999px;
    background: #c3c9d2;
    transition: background-color 0.2s ease;
    pointer-events: none;
}

.ac-switch__slider::before {
    content: "";
    position: absolute;
    top: 3px;
    left: 3px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #ffffff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
    transition: transform 0.2s ease;
}

.ac-switch input:checked + .ac-switch__slider {
    background: var(--ac-accent);
}

.ac-switch input:checked + .ac-switch__slider::before {
    transform: translateX(20px);
}

.ac-switch input:focus-visible + .ac-switch__slider {
    outline: 2px solid var(--ac-accent);
    outline-offset: 2px;
}

.ac-switch--locked {
    cursor: default;
    opacity: 0.55;
}

.ac-switch--locked input {
    cursor: default;
}

/* ---------------- Встроенная панель (страница политики) ---------------- */

.ac-inline {
    background: var(--ac-bg);
    border: 1px solid var(--ac-border);
    border-radius: var(--ac-radius);
    padding: 26px 28px;
    margin: 20px 0;
}

.ac-inline__title {
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 12px;
}

.ac-inline__text {
    color: var(--ac-muted);
    margin-bottom: 10px;
}

.ac-inline__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 20px;
}

.ac-inline__saved {
    margin-top: 12px;
    font-weight: 600;
    color: #1d8a3c;
}

.ac-inline__note {
    margin-top: 16px;
    font-size: 13.5px;
    color: var(--ac-muted);
}

@media (max-width: 640px) {
    .ac-inline { padding: 18px 16px; }

    .ac-inline__actions .ac-btn {
        flex: 1 1 auto;
        text-align: center;
    }
}
