/* ============================================================
   Cookie Consent v1.0 (Закон РМ №195/2024)
   ============================================================ */

:root {
  --cc-surface: #ffffff;
  --cc-text: #161616;
  --cc-text-2: #5c5c5c;
  --cc-border: #e2e2e2;
  --cc-border-strong: #c4c4c4;
  --cc-dark: #161616;          /* «Отклонить все», «Сохранить выбор» */
  --cc-dark-hover: #000000;
  --cc-on-dark: #ffffff;
  --cc-link: #0f62d6;
  --cc-success: #1d9e75;       /* тумблер во включённом положении */
  --cc-toggle-off: #cfcfcf;
  --cc-overlay: rgba(20, 25, 35, 0.55);
  --cc-radius: 12px;
  --cc-radius-btn: 8px;
  --cc-shadow: 0 8px 30px rgba(0, 0, 0, 0.14);
  --cc-z: 99990;
}

.cc-banner,
.cc-modal { font-family: inherit; color: var(--cc-text); box-sizing: border-box; }
.cc-banner *,
.cc-modal * { box-sizing: border-box; }

/* ---------- Слой 1: баннер ---------- */

.cc-banner {
  position: fixed;
  left: 16px; right: 16px; bottom: 16px;
  z-index: var(--cc-z);
  max-width: 1240px;
  margin: 0 auto;
  background: var(--cc-surface);
  border: 1px solid var(--cc-border);
  border-radius: var(--cc-radius);
  box-shadow: var(--cc-shadow);
  padding: 16px 20px;
  display: flex;
  align-items: center;
  gap: 12px 24px;
  flex-wrap: wrap;
}
.cc-banner[hidden] { display: none; }

.cc-banner__text { flex: 1 1 320px; min-width: 260px; }
.cc-banner__title { margin: 0 0 4px; font-size: 15px; font-weight: 600; line-height: 1.3; }
.cc-banner__desc  { margin: 0; font-size: 13px; line-height: 1.55; color: var(--cc-text-2); }
.cc-link { color: var(--cc-link); text-decoration: underline; }

.cc-banner__actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* ---------- Кнопки ----------
   «Принять все» — белая с обводкой, «Отклонить все» — тёмная.
   Равный размер обеих кнопок — требование свободного согласия,
   тёмная «Отклонить» заметнее белой «Принять» — это допустимо
   (запрещена только обратная ситуация). Не менять при вёрстке. */

.cc-btn {
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  line-height: 1;
  padding: 13px 22px;
  border-radius: var(--cc-radius-btn);
  cursor: pointer;
  border: 1px solid transparent;
  transition: background-color 0.15s, border-color 0.15s, color 0.15s;
  -webkit-appearance: none;
  appearance: none;
}
.cc-btn--dark  { background: var(--cc-dark); color: var(--cc-on-dark); }
.cc-btn--dark:hover { background: var(--cc-dark-hover); }
.cc-btn--white { background: #ffffff; color: var(--cc-text); border-color: var(--cc-border-strong); }
.cc-btn--white:hover { border-color: var(--cc-text); }
.cc-btn--ghost { background: transparent; color: var(--cc-text); border-color: var(--cc-border); }
.cc-btn--ghost:hover { border-color: var(--cc-border-strong); }

.cc-btn:focus-visible,
.cc-toggle:focus-visible,
.cc-close:focus-visible { outline: 2px solid var(--cc-link); outline-offset: 2px; }

/* ---------- Слой 2: модальное окно настроек ---------- */

.cc-overlay {
  position: fixed;
  inset: 0;
  z-index: calc(var(--cc-z) + 1);
  background: var(--cc-overlay);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.cc-overlay[hidden] { display: none; }

.cc-modal {
  background: var(--cc-surface);
  border-radius: var(--cc-radius);
  max-width: 480px;
  width: 100%;
  max-height: calc(100vh - 40px);
  overflow-y: auto;
  padding: 20px 24px 22px;
  outline: none;
}
.cc-modal__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.cc-modal__title { margin: 0; font-size: 18px; font-weight: 600; }
.cc-close {
  background: none;
  border: none;
  font-size: 22px;
  line-height: 1;
  color: var(--cc-text-2);
  cursor: pointer;
  padding: 4px;
}
.cc-close:hover { color: var(--cc-text); }
.cc-modal__intro { margin: 6px 0 4px; font-size: 13px; line-height: 1.5; color: var(--cc-text-2); }

/* Категории */
.cc-cat {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 14px 0;
  border-bottom: 1px solid var(--cc-border);
}
.cc-cat:last-of-type { border-bottom: none; }
.cc-cat__info { flex: 1; }
.cc-cat__name { margin: 0 0 3px; font-size: 14px; font-weight: 600; }
.cc-cat__desc { margin: 0; font-size: 13px; line-height: 1.5; color: var(--cc-text-2); }
.cc-always {
  font-size: 13px;
  font-weight: 600;
  color: var(--cc-success);
  white-space: nowrap;
  padding-top: 2px;
}

/* Тумблер (role="switch", состояние — в aria-checked) */
.cc-toggle {
  position: relative;
  width: 44px; height: 24px;
  flex: none;
  border: none;
  border-radius: 12px;
  background: var(--cc-toggle-off);
  cursor: pointer;
  padding: 0;
  transition: background-color 0.15s;
}
.cc-toggle::after {
  content: "";
  position: absolute;
  top: 3px; left: 3px;
  width: 18px; height: 18px;
  border-radius: 50%;
  background: #ffffff;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
  transition: left 0.15s;
}
.cc-toggle[aria-checked="true"] { background: var(--cc-success); }
.cc-toggle[aria-checked="true"]::after { left: 23px; }

/* Раскладка: «Сохранить выбор» — на всю ширину (строка 1),
   «Принять все» + «Отклонить все» — 50/50 (строка 2). */
.cc-modal__actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding-top: 16px;
  border-top: 1px solid var(--cc-border);
  margin-top: 2px;
}
.cc-modal__actions .cc-btn--save { grid-column: 1 / -1; }

/* ---------- Мобильная версия (плашка ≤ 30% высоты экрана) ---------- */

@media (max-width: 640px) {
  .cc-banner { left: 10px; right: 10px; bottom: 10px; padding: 14px 14px 12px; }
  .cc-banner__title { font-size: 14px; }
  .cc-banner__desc  { font-size: 12px; }

  /* «Принять» и «Отклонить» — в ряд 50/50, «Настроить» — текстовой ссылкой ниже */
  .cc-banner__actions { width: 100%; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
  .cc-btn { padding: 12px 10px; font-size: 13px; }
  .cc-btn--settings {
    grid-column: 1 / -1;
    background: none;
    border: none;
    text-decoration: underline;
    padding: 8px 4px;
    font-weight: 500;
  }

  /* Модалка — нижним листом. Раскладка кнопок (grid 2 колонки,
     «Сохранить» на всю ширину) наследуется из основного правила. */
  .cc-overlay { padding: 0; align-items: flex-end; }
  .cc-modal { max-width: none; border-radius: 16px 16px 0 0; max-height: 88vh; }
}

@media (prefers-reduced-motion: reduce) {
  .cc-btn, .cc-toggle, .cc-toggle::after { transition: none; }
}
