/* Consent PL: baner, okno ustawień, pływający przycisk, plansze osadzeń. */

.cpl-root,
.cpl-root *,
.cpl-root *::before,
.cpl-root *::after,
.cpl-embed,
.cpl-embed * {
  box-sizing: border-box;
}

.cpl-root[hidden],
.cpl-root [hidden] {
  display: none !important;
}

/*
 * Odporność na motyw strony. Motywy bywają pisane szeroko – np. "h3 { text-align: center }"
 * albo wersaliki w nagłówkach – i wtedy nazwy kategorii uciekają na środek okna zgód.
 * Tu ustawiamy neutralny punkt wyjścia dla wszystkiego, co wtyczka wyświetla; !important
 * jest konieczne, bo selektory motywu (np. ".entry-content h3") bywają bardziej szczegółowe.
 * Elementy, które mają być wyśrodkowane (przyciski, licznik, plansza osadzenia), dostają
 * własną regułę poniżej.
 */
.cpl-root,
.cpl-root h1,
.cpl-root h2,
.cpl-root h3,
.cpl-root h4,
.cpl-root h5,
.cpl-root h6,
.cpl-root p,
.cpl-root ul,
.cpl-root ol,
.cpl-root li,
.cpl-root dl,
.cpl-root dt,
.cpl-root dd,
.cpl-root div,
.cpl-root span,
.cpl-root a,
.cpl-root label,
.cpl-root button {
  text-align: left !important;
  text-indent: 0 !important;
  float: none !important;
}

.cpl-root h1,
.cpl-root h2,
.cpl-root h3,
.cpl-root h4,
.cpl-root h5,
.cpl-root h6 {
  text-transform: none !important;
  letter-spacing: normal !important;
  font-style: normal !important;
  font-family: inherit;
}

.cpl-root .cpl-btn,
.cpl-root .cpl-modal__close,
.cpl-root .cpl-cat__count,
.cpl-root .cpl-fab {
  text-align: center !important;
}

/* ---------- Baner ---------- */

.cpl-banner {
  position: fixed;
  z-index: 2147483000;
  left: 0;
  right: 0;
  bottom: 0;
  margin: 0;
  padding: 16px;
  background: var(--cpl-bg, #fff);
  color: var(--cpl-text, #1f2937);
  font-size: 15px;
  line-height: 1.5;
  text-align: left;
  box-shadow: 0 -2px 16px rgba(0, 0, 0, 0.18);
}

.cpl-banner__inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 24px;
  max-width: 1200px;
  margin: 0 auto;
}

.cpl-banner__content {
  flex: 1 1 420px;
  min-width: 0;
}

.cpl-banner__title {
  margin: 0 0 4px;
  font-size: 16px;
  font-weight: 700;
  color: inherit;
}

.cpl-banner__msg {
  margin: 0;
  font-size: 14px;
  color: inherit;
}

.cpl-banner__link,
.cpl-banner__link:visited {
  color: inherit;
  text-decoration: underline;
}

.cpl-banner__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.cpl-banner--box {
  left: 16px;
  right: auto;
  bottom: 16px;
  width: calc(100% - 32px);
  max-width: 440px;
  border-radius: 12px;
  box-shadow: 0 6px 28px rgba(0, 0, 0, 0.25);
}

.cpl-banner--box .cpl-banner__inner {
  flex-direction: column;
  align-items: stretch;
}

.cpl-banner--box .cpl-banner__content {
  flex: none;
}

.cpl-banner--box .cpl-btn {
  flex: 1 1 auto;
}

/* ---------- Przyciski ---------- */

.cpl-btn {
  -webkit-appearance: none;
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  margin: 0;
  padding: 10px 18px;
  border: 2px solid var(--cpl-accent, #1d4ed8);
  border-radius: 8px;
  font-family: inherit;
  font-size: 15px;
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: normal;
  text-align: center;
  text-decoration: none;
  text-transform: none;
  white-space: normal;
  cursor: pointer;
  box-shadow: none;
}

.cpl-btn--primary,
.cpl-btn--primary:hover,
.cpl-btn--primary:focus {
  background: var(--cpl-accent, #1d4ed8);
  color: var(--cpl-accent-text, #fff);
}

.cpl-btn--secondary,
.cpl-btn--secondary:hover,
.cpl-btn--secondary:focus {
  background: transparent;
  color: var(--cpl-text, #1f2937);
  border-color: currentColor;
}

.cpl-btn--link,
.cpl-btn--link:hover,
.cpl-btn--link:focus {
  background: transparent;
  border-color: transparent;
  color: inherit;
  text-decoration: underline;
  padding-left: 8px;
  padding-right: 8px;
}

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

.cpl-root :focus-visible,
.cpl-root:focus-visible,
.cpl-embed :focus-visible {
  outline: 3px solid var(--cpl-text, #1f2937);
  outline-offset: 2px;
}

/* ---------- Okno ustawień ---------- */

html.cpl-lock {
  overflow: hidden;
}

.cpl-overlay {
  position: fixed;
  z-index: 2147483001;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(17, 24, 39, 0.55);
}

.cpl-modal {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 640px;
  max-height: calc(100vh - 32px);
  max-height: calc(100dvh - 32px);
  background: var(--cpl-bg, #fff);
  color: var(--cpl-text, #1f2937);
  border-radius: 12px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
  font-size: 15px;
  line-height: 1.5;
  text-align: left;
  outline: none;
}

.cpl-modal__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 20px;
  border-bottom: 1px solid rgba(127, 127, 127, 0.3);
}

.cpl-modal__title {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
  line-height: 1.3;
  color: inherit;
}

.cpl-modal__close {
  -webkit-appearance: none;
  appearance: none;
  flex: none;
  width: 44px;
  height: 44px;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: inherit;
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
}

.cpl-modal__body {
  padding: 12px 20px;
  overflow-y: auto;
}

.cpl-modal__intro {
  margin: 0 0 8px;
  font-size: 13.5px;
  line-height: 1.5;
}

.cpl-cat {
  padding: 12px 0;
  border-top: 1px solid rgba(127, 127, 127, 0.25);
}

.cpl-modal__intro + .cpl-cat {
  border-top: 0;
}

.cpl-cat__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.cpl-cat__title {
  flex: 1 1 auto;
  min-width: 0;
  margin: 0;
  padding: 0;
  font-size: 16px;
  font-weight: 700;
  line-height: 1.4;
  color: inherit;
}

/* Nagłówek kategorii = przycisk rozwijający listę usług (strzałka, nazwa, licznik). */
.cpl-modal .cpl-cat__expand,
.cpl-modal .cpl-cat__expand:hover,
.cpl-modal .cpl-cat__expand:focus,
.cpl-modal .cpl-cat__expand:active {
  -webkit-appearance: none;
  appearance: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  width: auto;
  min-height: 44px;
  margin: 0;
  padding: 4px 4px 4px 0;
  border: 0;
  border-radius: 6px;
  background: transparent;
  box-shadow: none;
  color: inherit;
  font: inherit;
  font-weight: 700;
  line-height: 1.3;
  letter-spacing: normal;
  text-align: left;
  text-transform: none;
  text-decoration: none;
  cursor: pointer;
}

.cpl-cat__chevron {
  flex: none;
  width: 18px;
  height: 18px;
  transition: transform 0.15s;
}

.cpl-cat__expand[aria-expanded="true"] .cpl-cat__chevron {
  transform: rotate(180deg);
}

.cpl-cat__count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  min-width: 24px;
  height: 24px;
  padding: 0 7px;
  border-radius: 999px;
  background: rgba(127, 127, 127, 0.2);
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
}

.cpl-sr {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  margin: -1px !important;
  padding: 0 !important;
  overflow: hidden !important;
  clip: rect(0 0 0 0) !important;
  clip-path: inset(50%) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.cpl-cat__control {
  display: flex;
  flex: none;
  align-items: center;
  gap: 8px;
}

.cpl-cat__always {
  font-size: 13px;
  font-weight: 600;
}

/* Opis i lista usług zaczynają się przy lewej krawędzi okna, równo z nagłówkiem kategorii. */
.cpl-cat__desc {
  margin: 2px 0 0;
  font-size: 14px;
}

.cpl-cat__services {
  margin: 10px 0 0;
  font-size: 14px;
}

.cpl-cat__list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.cpl-cat__list li {
  margin: 0 0 8px;
  padding: 8px 12px;
  border-radius: 6px;
  background: rgba(127, 127, 127, 0.1);
}

.cpl-cat__list li:last-child {
  margin-bottom: 0;
}

.cpl-cat__services a {
  color: inherit;
}

/* Brak usług w kategorii – szary boks dopasowany do tekstu. */
.cpl-cat__empty {
  display: inline-block;
  margin: 0;
  padding: 6px 12px;
  border-radius: 6px;
  background: rgba(127, 127, 127, 0.14);
  font-size: 13px;
  line-height: 1.4;
}

.cpl-root code {
  font-size: 13px;
  word-break: break-all;
}

.cpl-modal__foot {
  padding: 12px 20px 16px;
  border-top: 1px solid rgba(127, 127, 127, 0.3);
}

.cpl-modal__id {
  margin: 0 0 8px;
  font-size: 12px;
}

.cpl-modal__actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

/* Przełącznik (natywny checkbox) */
.cpl-switch {
  -webkit-appearance: none;
  appearance: none;
  position: relative;
  flex: none;
  width: 48px;
  height: 28px;
  margin: 0;
  border: 0;
  border-radius: 999px;
  background: #6b7280;
  cursor: pointer;
  transition: background-color 0.15s;
}

.cpl-switch::before {
  content: "";
  position: absolute;
  top: 4px;
  left: 4px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
  transition: transform 0.15s;
}

.cpl-switch:checked {
  background: var(--cpl-accent, #1d4ed8);
}

.cpl-switch:checked::before {
  transform: translateX(20px);
}

.cpl-switch:disabled {
  cursor: not-allowed;
  opacity: 0.6;
}

/* ---------- Pływający przycisk ---------- */

.cpl-fab {
  -webkit-appearance: none;
  appearance: none;
  position: fixed;
  z-index: 2147482999;
  bottom: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--cpl-accent, #1d4ed8);
  color: var(--cpl-accent-text, #fff);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.25);
  cursor: pointer;
}

.cpl-fab--left {
  left: 16px;
}

.cpl-fab--right {
  right: 16px;
}

.cpl-fab svg {
  width: 26px;
  height: 26px;
}

/* ---------- Plansza osadzeń (YouTube, Vimeo, Mapy Google) ---------- */

.cpl-embed {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  margin: 0 auto;
  background: #f3f4f6;
  color: #111827;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  text-align: center;
}

/* Plansza siedzi w treści strony, więc też chronimy ją przed wyrównaniem z motywu. */
.cpl-embed,
.cpl-embed p,
.cpl-embed div,
.cpl-embed span,
.cpl-embed a,
.cpl-embed button {
  text-align: center !important;
  text-indent: 0 !important;
  float: none !important;
}

.cpl-embed__notice {
  max-width: 520px;
  padding: 16px;
  font-size: 14px;
  line-height: 1.5;
}

.cpl-embed__text {
  margin: 0 0 12px;
}

.cpl-embed__actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin: 0;
}

.cpl-embed .cpl-btn--link {
  color: #111827;
}

.cpl-embed :focus-visible {
  outline-color: #111827;
}

/* Bloki osadzeń Gutenberga: wyłączamy sztuczkę z proporcjami, gdy w środku jest nasza plansza,
   bo inaczej nad planszą zostaje pusta przestrzeń po podmienionym iframe. */
.wp-block-embed__wrapper:has(> .cpl-embed)::before {
  display: none;
}

.wp-has-aspect-ratio .cpl-embed {
  max-width: none;
}

/* ---------- Tabela cookies (shortcode) ---------- */

.cpl-cookie-table table {
  width: 100%;
  border-collapse: collapse;
  margin: 0 0 1.5em;
  font-size: 0.9em;
}

.cpl-cookie-table th,
.cpl-cookie-table td,
.cpl-policy th,
.cpl-policy td {
  text-align: left !important;
  vertical-align: top;
}

.cpl-cookie-table th,
.cpl-cookie-table td {
  padding: 8px;
  border: 1px solid rgba(127, 127, 127, 0.4);
}

/*
 * Tabele (polityka i tabela cookies): gdy nie mieszczą się na ekranie, przewija się tylko tabela –
 * suwak jest pod nią, a strona się nie rozjeżdża. contain: inline-size sprawia, że szerokość tabeli
 * nie rozpycha kolumny motywu (flex/grid), więc cała strona nie dostaje poziomego suwaka.
 * !important chroni przed stylami motywu.
 */
.cpl-policy,
.cpl-cookie-table {
  max-width: 100%;
  min-width: 0;
}

.cpl-table-scroll {
  display: block !important;
  width: 100% !important;
  max-width: 100% !important;
  min-width: 0 !important;
  contain: inline-size;
  overflow-x: auto !important;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  margin: 0 0 1.5em;
  padding-bottom: 2px;
  scrollbar-width: thin;
}

.cpl-table-scroll > table {
  width: 100% !important;
  min-width: 600px !important;
  max-width: none !important;
  table-layout: auto !important;
  margin: 0 !important;
}

.cpl-table-scroll::-webkit-scrollbar {
  height: 8px;
}

.cpl-table-scroll::-webkit-scrollbar-thumb {
  border-radius: 4px;
  background: rgba(127, 127, 127, 0.5);
}

.cpl-table-scroll:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 2px;
}

/* ---------- Mobile, ruch, druk ---------- */

@media (max-width: 600px) {
  .cpl-banner {
    padding: 12px;
  }

  .cpl-banner__actions,
  .cpl-modal__actions {
    width: 100%;
  }

  .cpl-banner__actions .cpl-btn,
  .cpl-modal__actions .cpl-btn {
    flex: 1 1 100%;
  }

  .cpl-banner--box {
    left: 8px;
    bottom: 8px;
    width: calc(100% - 16px);
    max-width: none;
  }

  .cpl-modal__head,
  .cpl-modal__body,
  .cpl-modal__foot {
    padding-left: 14px;
    padding-right: 14px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .cpl-switch,
  .cpl-switch::before {
    transition: none;
  }
}

@media print {
  .cpl-banner,
  .cpl-overlay,
  .cpl-fab {
    display: none !important;
  }
}
