/* =========================================================================
   Warsaw Genomics — Cookie consent (Google Consent Mode v2)
   UI rewrite 2026-06-06 (IT) — mobile-first bottom-sheet, WCAG, brand.
   LOGIKA GCMv2 + server-log = head.js / body-end.js (NIETKNIĘTE).
   Marka: Warsaw Genomics. Paleta brand: #0054a6 / #ee3d96 / #7961ab.
   ========================================================================= */
:root {
  --cookiesBanner: #0054a6;
  --cookiesBannerDark: #00417f;
  --textColor: #15141A;
  --cookiesMuted: #5b6470;
  --cookiesBorder: #e2e6ec;
}

/* ---------- Wrapper / overlay ---------- */
#cookies-baner-wrapper {
  display: none;            /* JS przełącza na flex */
  position: fixed;
  inset: 0;
  justify-content: center;
  align-items: flex-end;    /* MOBILE = bottom-sheet */
  width: 100%;
  height: 100%;
  margin: 0;
  z-index: 2147483646;
  -webkit-tap-highlight-color: transparent;
}
#cookies-overlay {
  position: fixed;
  inset: 0;
  background-color: rgba(0, 0, 0, 0.55);
  pointer-events: none;
  opacity: 0;
  transition: opacity .25s ease;
  z-index: 2147483645;
}
#cookies-overlay.active { opacity: 1; pointer-events: all; }

/* ---------- Karta ---------- */
#cookies-baner-wrapper .cookies-baner {
  position: relative;
  width: 100%;
  max-width: 100%;
  max-height: 92vh;
  display: flex;
  flex-direction: column;
  background: #fff;
  border: 1px solid var(--cookiesBorder);
  border-bottom: none;
  border-radius: 18px 18px 0 0;
  box-shadow: 0 -8px 40px rgba(0, 0, 0, .18);
  animation: cookieSheetUp .28s ease;
}
@keyframes cookieSheetUp { from { transform: translateY(100%); } to { transform: translateY(0); } }

/* ---------- Header ---------- */
#cookies-baner-wrapper .cookies-baner-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--cookiesBorder);
  background: #fff;
  border-radius: 18px 18px 0 0;
  flex: 0 0 auto;
}
#cookies-baner-wrapper .cookies-baner-header-left {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
}
#cookies-baner-wrapper .cookies-baner-header-left p {
  margin: 0;
  font-size: 18px;
  font-weight: 600 !important;
  line-height: 1.2;
  color: var(--textColor);
}
/* "Powered by DevaGroup" — własny consent, ukrywamy credit */
#cookies-baner-wrapper .cookies-baner-header-right { display: none; }
#Capa_1 { fill: var(--cookiesBanner); width: 30px; height: 30px; flex: 0 0 auto; }

/* ---------- Treść (scroll) ---------- */
#cookies-baner-wrapper .cookies-baner-content {
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  flex: 1 1 auto;
}
#cookies-baner-wrapper .cookies-baner-main { padding: 16px 18px; }
#cookies-baner-wrapper p {
  color: var(--textColor);
  font-size: 13px;
  line-height: 1.5;
  font-weight: 400 !important;
  margin: 0 0 10px;
}
#cookies-baner-wrapper a { color: var(--cookiesBanner); text-decoration: underline; }
#cookies-baner-wrapper a:hover { color: var(--cookiesBannerDark); }

/* ---------- Przyciski ---------- */
#cookies-baner-wrapper .buttons,
#cookies-baner-wrapper .extended-buttons {
  display: flex;
  flex-direction: column-reverse;   /* primary (Akceptuję) na górze stosu */
  gap: 8px;
  margin-top: 14px;
}
#cookies-baner-wrapper .btn {
  width: 100%;
  min-width: 0;
  padding: 14px 18px;
  font-size: 15px;
  font-weight: 600 !important;
  line-height: 1.2;
  letter-spacing: 0 !important;
  text-align: center;
  border-radius: 8px;
  border: 2px solid var(--cookiesBanner);
  background: var(--cookiesBanner);
  color: #fff;
  cursor: pointer;
  transition: background .15s ease, color .15s ease;
}
#cookies-baner-wrapper .btn:hover { background: var(--cookiesBannerDark); border-color: var(--cookiesBannerDark); color: #fff; }
#cookies-baner-wrapper .btn-color-reverse {
  background: #fff;
  color: var(--cookiesBanner) !important;
}
#cookies-baner-wrapper .btn-color-reverse:hover { background: #eef4fb; color: var(--cookiesBannerDark) !important; }

/* ---------- A11y: focus widoczny (WCAG 2.4.7) ---------- */
#cookies-baner-wrapper .btn:focus-visible,
#cookies-baner-wrapper a:focus-visible,
#cookies-baner-wrapper input[type='checkbox']:focus-visible,
#cookies-baner-open:focus-visible {
  outline: 3px solid #7961ab;
  outline-offset: 2px;
}

/* ---------- Sekcja rozszerzona (kategorie) ---------- */
#cookies-baner-wrapper .cookies-baner-extended { display: none; }
#cookies-baner-wrapper .show-more-cookies .cookies-baner-extended { display: block; padding: 0 18px 18px; }
#cookies-baner-wrapper .show-more-cookies .cookies-baner-main .buttons { display: none; }
#cookies-baner-wrapper .extended-content {
  list-style: none;
  margin: 0;
  padding: 14px 0 0;
  border-top: 1px solid var(--cookiesBorder);
}
#cookies-baner-wrapper .extendex-checkbox {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 14px;
}
#cookies-baner-wrapper .extendex-checkbox input[type='checkbox'] {
  width: 20px; height: 20px;
  flex: 0 0 auto;
  margin-top: 2px;
  accent-color: var(--cookiesBanner);   /* zamiast czerwonego tła (TODO usunięty) */
}
#cookies-baner-wrapper .checkbox-text { flex: 1 1 auto; }
#cookies-baner-wrapper .label-title-checkbox {
  margin: 0 0 4px;
  font-size: 15px;
  font-weight: 600 !important;
  color: var(--textColor);
}
#cookies-baner-wrapper .checkbox-text p { font-size: 12px; line-height: 1.45; color: var(--cookiesMuted); }
#cookies-baner-wrapper .checkbox-text p s { color: var(--cookiesMuted); }

/* ---------- Close ---------- */
#cookies-baner-wrapper .btn-close {
  position: absolute;
  right: 12px; top: 10px;
  width: 32px; height: 32px;
  font-size: 24px; line-height: 1;
  padding: 0; margin: 0;
  border: none; background: none;
  color: var(--cookiesBanner);
  transform: rotate(45deg);
  cursor: pointer;
}

/* ---------- Ikona „Zarządzaj cookies" (re-open) ---------- */
#cookies-baner-open { display: none; }   /* JS pokazuje gdy zgoda już wyrażona */
#cookies-baner-open.cookies-baner-icon {
  display: block;
  position: fixed;
  bottom: 14px; left: 14px;
  right: auto;
  border-radius: 50%;
  cursor: pointer;
  z-index: 2147483640;
}
#cookies-baner-open.cookies-baner-icon .cookies-baner-open-content {
  width: 46px; height: 46px;
  padding: 1px;
  border: 2px solid var(--cookiesBanner);
  border-radius: 50%;
  background-color: var(--cookiesBanner);
}
#cookies-baner-icon-inner { width: 30px; height: 30px; fill: #fff; margin: 6px; }
/* wariant shortcode (np. w stopce) — bez pozycji fixed */
#cookies-baner-open.cookies-baner-open-shortcode {
  display: block; position: relative;
  left: unset; bottom: unset; background: unset; border: unset;
  text-align: unset; border-radius: unset; color: inherit;
}

/* ======================= DESKTOP (>= 769px) ======================= */
@media only screen and (min-width: 769px) {
  #cookies-baner-wrapper { align-items: center; }
  #cookies-baner-wrapper .cookies-baner {
    width: min(94%, 720px);
    max-height: 86vh;
    border: 2px solid var(--cookiesBanner);
    border-radius: 14px;
    animation: cookieFadeIn .22s ease;
  }
  #cookies-baner-wrapper .cookies-baner-header { border-radius: 12px 12px 0 0; }
  #cookies-baner-wrapper .cookies-baner-header-left p { font-size: 22px; }
  #cookies-baner-wrapper .cookies-baner-main { padding: 22px; }
  #cookies-baner-wrapper p { font-size: 14px; }
  #cookies-baner-wrapper .buttons,
  #cookies-baner-wrapper .extended-buttons { flex-direction: row; justify-content: flex-end; flex-wrap: wrap; }
  #cookies-baner-wrapper .btn { width: auto; min-width: 180px; }
  @keyframes cookieFadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
}

/* ======================= reduced motion ======================= */
@media (prefers-reduced-motion: reduce) {
  #cookies-baner-wrapper .cookies-baner,
  #cookies-overlay { animation: none !important; transition: none !important; }
}
