/* ============================================================
   Хайнет — Cookie Consent Manager
   Фиксированный баннер внизу + окно настроек (§14–20 ТЗ)
   ============================================================ */

/* ---------------- Banner (компактная плашка) ---------------- */

.cookie-banner {
  position: fixed;
  left: 50%;
  bottom: 14px;
  z-index: 120;
  width: max-content;
  max-width: min(920px, calc(100vw - 24px));
  display: flex;
  align-items: center;
  gap: 16px;
  background: rgba(14, 15, 18, 0.96);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px 14px;
  box-shadow: 0 12px 40px -16px rgba(0, 0, 0, 0.85);
  transform: translate(-50%, 16px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease, transform 0.3s ease;
}
.cookie-banner.visible {
  transform: translate(-50%, 0);
  opacity: 1;
  pointer-events: auto;
}

.cookie-banner p {
  color: var(--text-2);
  font-size: 0.8rem;
  line-height: 1.45;
  margin: 0;
  min-width: 0;
}
.cookie-banner a { color: var(--accent); white-space: nowrap; }

.cookie-banner-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}
.cookie-banner-actions .btn {
  height: 34px;
  padding: 0 14px;
  font-size: 0.78rem;
  border-radius: 8px;
  white-space: nowrap;
}
.cookie-btn-secondary {
  border: 1px solid var(--border-strong);
  color: var(--text-2);
  border-radius: 8px;
  background: none;
  font: inherit;
  font-weight: 600;
  font-size: 0.78rem;
  height: 34px;
  padding: 0 14px;
  white-space: nowrap;
  transition: border-color 0.2s ease, color 0.2s ease;
}
.cookie-btn-secondary:hover { border-color: rgba(255, 255, 255, 0.3); color: var(--text); }

/* ---------------- Modal ---------------- */

.cookie-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 130;
  background: rgba(0, 0, 0, 0.6);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}
.cookie-modal-overlay.visible { opacity: 1; pointer-events: auto; }

.cookie-modal {
  width: 100%;
  max-width: 520px;
  max-height: min(640px, 90vh);
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 20px;
  padding: 28px 26px;
  transform: translateY(12px);
  transition: transform 0.25s ease;
}
.cookie-modal-overlay.visible .cookie-modal { transform: none; }

.cookie-modal h3 {
  font-size: 1.2rem;
  margin-bottom: 8px;
}
.cookie-modal > p {
  color: var(--text-2);
  font-size: 0.9rem;
  margin-bottom: 20px;
}

.cookie-cat {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  padding: 16px 0;
  border-top: 1px solid var(--border);
}
.cookie-cat:last-of-type { border-bottom: 1px solid var(--border); }
.cookie-cat h4 { font-size: 0.98rem; }
.cookie-cat p {
  color: var(--text-3);
  font-size: 0.82rem;
  margin: 4px 0 0;
  line-height: 1.5;
}
.cookie-cat .always {
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--accent);
  white-space: nowrap;
  padding-top: 4px;
}

/* toggle */
.cookie-toggle {
  position: relative;
  flex-shrink: 0;
  width: 46px;
  height: 26px;
  border-radius: 13px;
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  cursor: pointer;
  transition: background 0.25s ease, border-color 0.25s ease;
}
.cookie-toggle::after {
  content: "";
  position: absolute;
  top: 3px; left: 3px;
  width: 18px; height: 18px;
  border-radius: 50%;
  background: var(--text-2);
  transition: transform 0.25s ease, background 0.25s ease;
}
.cookie-toggle[aria-checked="true"] {
  background: var(--accent);
  border-color: var(--accent);
}
.cookie-toggle[aria-checked="true"]::after {
  transform: translateX(20px);
  background: var(--accent-text);
}

.cookie-modal-actions {
  margin-top: 22px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.cookie-modal-actions .btn { width: 100%; }
.cookie-modal-actions .cookie-btn-secondary { width: 100%; }

/* ---------------- Adaptive ---------------- */

@media (max-width: 860px) {
  .cookie-banner {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    width: auto;
    max-width: calc(100vw - 24px);
    padding: 12px 14px;
  }
  .cookie-banner p { font-size: 0.78rem; }
  .cookie-banner a { white-space: normal; }
  .cookie-banner-actions { justify-content: stretch; }
  .cookie-banner-actions .btn,
  .cookie-banner-actions .cookie-btn-secondary { flex: 1 1 auto; height: 38px; padding: 0 10px; }
  /* не перекрывает sticky CTA — баннер выше по z, sticky CTA прячем при открытом баннере */
  body.cookie-open .sticky-cta { opacity: 0 !important; pointer-events: none !important; }
}

@media (prefers-reduced-motion: reduce) {
  .cookie-banner, .cookie-modal, .cookie-toggle::after { transition: none; }
}
