/* ============================================================
   Still Ferro — Cookie Consent (на основе Five Stars Cookie Consent v1.0)
   Legea RM nr. 133/2011 (actuală). Notă: Legea nr. 195/2024 nu a intrat încă în vigoare la momentul scrierii — de actualizat aici dacă/când intră.
   Токены ниже смэплены на переменные style.css темы (:root),
   чтобы баннер визуально не отличался от остального сайта.
   Кнопки в разметке используют реальные .btn / .btn-dark / .btn-light
   классы темы (см. cookie-banner.js) — эти правила их только
   позиционируют внутри баннера, не переопределяют вид.
   ============================================================ */

:root {
  --cc-surface: var(--color-white);
  --cc-text: var(--color-text);
  --cc-text-2: var(--color-muted);
  --cc-border: var(--color-border);
  --cc-border-strong: #cfc7b4;
  --cc-link: var(--color-accent);
  --cc-success: #1d9e75;       /* тумблер во включённом положении — оставлен зелёным нарочно: универсальный сигнал "включено", вне брендовой палитры */
  --cc-toggle-off: #d8d3c7;
  --cc-overlay: rgba(27, 26, 24, 0.55); /* тон --color-dark с прозрачностью */
  --cc-radius: var(--radius);
  --cc-shadow: 0 8px 30px rgba(27, 26, 24, 0.16);
  --cc-z: 99990;
}

.cc-banner,
.cc-modal { font-family: var(--font-body); 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: 20px 24px;
  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; color: var(--cc-text); }
.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: 10px; flex-wrap: wrap; align-items: center; }

/* Кнопки баннера — это реальные классы темы (.btn, .btn-dark, .btn-light),
   см. cookie-banner.js. Здесь только регулируем размер в контексте баннера,
   чтобы не доминировали визуально над текстом. */
.cc-banner .btn,
.cc-modal .btn { padding: 13px 24px; font-size: 13.5px; }

/* "Setări" теперь настоящая кнопка, как и две другие (.btn .btn-dark),
   а не текстовая ссылка с подчёркиванием, как было раньше. */

.cc-close:focus-visible,
.cc-toggle:focus-visible { outline: 2px solid var(--color-accent); outline-offset: 2px; }
.cc-banner .btn:focus-visible,
.cc-modal .btn:focus-visible { outline: 2px solid var(--color-accent); outline-offset: 3px; }

/* ---------- Слой 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: 24px 28px 26px;
  outline: none;
}
.cc-modal__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.cc-modal__title { margin: 0; font-size: 19px; font-weight: 600; color: var(--cc-text); }
.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(--color-accent); }
.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: 16px 0;
}
/* Линия только МЕЖДУ строками категорий (не после последней) — раньше тут
   стоял :last-of-type, но он сравнивает по тегу <div>, а не по классу, и
   из-за соседних <div> (напр. .cc-modal__actions) никогда не срабатывал
   на последней категории. Из-за этого перед кнопками было две линии подряд
   (граница последней категории + граница блока кнопок) вместо одной. */
.cc-cat + .cc-cat { border-top: 1px solid var(--cc-border); }
.cc-cat__info { flex: 1; }
.cc-cat__name { margin: 0 0 3px; font-size: 14px; font-weight: 600; color: var(--cc-text); }
.cc-cat__desc { margin: 0; font-size: 13px; line-height: 1.5; color: var(--cc-text-2); }
.cc-always {
  font-size: 12.5px;
  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: var(--color-white);
  box-shadow: 0 1px 2px rgba(27, 26, 24, 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: 10px;
  padding-top: 18px;
  border-top: 1px solid var(--cc-border);
  margin-top: 4px;
}
.cc-modal__actions .cc-btn--save { grid-column: 1 / -1; }
.cc-modal__actions .btn { width: 100%; }

/* ---------- Мобильная версия ---------- */

@media (max-width: 640px) {
  .cc-banner { left: 10px; right: 10px; bottom: 10px; padding: 16px 16px 14px; }
  .cc-banner__title { font-size: 14px; }
  .cc-banner__desc  { font-size: 12px; }

  .cc-banner__actions { width: 100%; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
  .cc-banner .btn { padding: 12px 10px; font-size: 13px; width: 100%; }
  .cc-btn--settings { grid-column: 1 / -1; }

  .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-toggle, .cc-toggle::after { transition: none; }
}
