/* Worfordis Cookie Consent — baner (frontend).
 * Zmienne --wcc-* wstrzykuje PHP (wp_add_inline_style) na podstawie ustawień.
 */
:root {
  --wcc-bg: #ffffff;
  --wcc-text: #111827;
  --wcc-primary: #2563eb;
  --wcc-primary-text: #ffffff;
  --wcc-secondary: #6b7280;
  --wcc-secondary-text: #ffffff;
  --wcc-border: #e5e7eb;
  --wcc-toggle: #2563eb;
  --wcc-overlay: rgba(0, 0, 0, 0.5);
  --wcc-radius: 8px;
}

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

.wcc-root {
  position: fixed;
  inset: 0;
  z-index: 2147483000;
  pointer-events: none;
  font-family: inherit;
  font-size: 15px;
  line-height: 1.5;
  color: var(--wcc-text);
}
.wcc-root *,
.wcc-root *::before,
.wcc-root *::after { box-sizing: border-box; }

/* ---------- Overlay ---------- */
.wcc-overlay {
  position: absolute;
  inset: 0;
  background: var(--wcc-overlay);
  opacity: 0;
  visibility: hidden;
  transition: opacity .25s ease, visibility .25s ease;
}
.wcc-pos-center .wcc-overlay,
.wcc-is-prefs .wcc-overlay {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  animation: wcc-fade .25s ease;
}

/* ---------- Baner (widok prosty) ---------- */
.wcc-banner,
.wcc-prefs {
  position: absolute;
  pointer-events: auto;
  background: var(--wcc-bg);
  color: var(--wcc-text);
  border: 1px solid var(--wcc-border);
  border-radius: var(--wcc-radius);
  box-shadow: 0 10px 40px rgba(0, 0, 0, .18);
}
.wcc-banner {
  padding: 20px 24px;
  animation: wcc-slide-up .35s cubic-bezier(.2, .8, .2, 1);
}

/* bottom-bar */
.wcc-pos-bottom .wcc-banner {
  left: 0;
  right: 0;
  bottom: 0;
  border-radius: var(--wcc-radius) var(--wcc-radius) 0 0;
  border-left: 0;
  border-right: 0;
  border-bottom: 0;
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-areas: "title actions" "desc actions";
  column-gap: 32px;
  align-items: center;
  padding: 20px max(24px, calc((100% - 1200px) / 2));
}
.wcc-pos-bottom .wcc-title { grid-area: title; }
.wcc-pos-bottom .wcc-desc { grid-area: desc; margin-bottom: 0; }
.wcc-pos-bottom .wcc-banner > .wcc-actions { grid-area: actions; }

/* center-modal */
.wcc-pos-center .wcc-banner {
  top: 50%;
  left: 50%;
  width: calc(100% - 32px);
  max-width: 540px;
  transform: translate(-50%, -50%);
  animation: wcc-pop .3s ease;
}

/* corner-bottom-right */
.wcc-pos-corner .wcc-banner {
  right: 20px;
  bottom: 20px;
  width: calc(100% - 40px);
  max-width: 380px;
}

.wcc-title {
  margin: 0 0 6px;
  padding: 0;
  font-size: 17px;
  font-weight: 700;
  line-height: 1.3;
  color: var(--wcc-text);
}
.wcc-desc {
  margin: 0 0 16px;
  font-size: 14px;
  opacity: .9;
}
.wcc-link {
  color: var(--wcc-primary);
  text-decoration: underline;
  font-weight: 600;
}
.wcc-link:hover { text-decoration: none; }

/* ---------- Przyciski ---------- */
.wcc-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}
.wcc-pos-center .wcc-banner .wcc-actions,
.wcc-pos-corner .wcc-banner .wcc-actions { justify-content: stretch; }
.wcc-pos-center .wcc-banner .wcc-btn,
.wcc-pos-corner .wcc-banner .wcc-btn { flex: 1 1 auto; }

.wcc-btn {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  margin: 0;
  padding: 10px 18px;
  border: 1px solid transparent;
  border-radius: var(--wcc-radius);
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.2;
  white-space: nowrap;
  cursor: pointer;
  text-decoration: none;
  transition: filter .15s ease, background-color .15s ease, transform .1s ease;
}
.wcc-btn:hover { filter: brightness(.93); }
.wcc-btn:active { transform: translateY(1px); }
.wcc-btn:focus-visible,
.wcc-close:focus-visible,
.wcc-cat__toggle-list:focus-visible,
.wcc-float:focus-visible {
  outline: 2px solid var(--wcc-primary);
  outline-offset: 2px;
}
.wcc-btn--primary,
.wcc-btn-primary {
  background: var(--wcc-primary);
  border-color: var(--wcc-primary);
  color: var(--wcc-primary-text);
}
.wcc-btn--secondary,
.wcc-btn-secondary {
  background: var(--wcc-secondary);
  border-color: var(--wcc-secondary);
  color: var(--wcc-secondary-text);
}
.wcc-btn--outline,
.wcc-btn-outline {
  background: transparent;
  border-color: var(--wcc-border);
  color: var(--wcc-text);
}

/* ---------- Widok szczegółowy (ustawienia) ---------- */
.wcc-prefs {
  top: 50%;
  left: 50%;
  width: calc(100% - 32px);
  max-width: 640px;
  max-height: calc(100vh - 48px);
  max-height: calc(100dvh - 48px);
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: wcc-pop .3s ease;
}
.wcc-prefs__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 24px;
  border-bottom: 1px solid var(--wcc-border);
}
.wcc-prefs__head .wcc-title { margin: 0; }
.wcc-close {
  appearance: none;
  flex: 0 0 auto;
  width: 36px;
  height: 36px;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--wcc-text);
  font-size: 26px;
  line-height: 1;
  cursor: pointer;
}
.wcc-close:hover { background: rgba(0, 0, 0, .06); }
.wcc-prefs__body {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 8px 24px;
  -webkit-overflow-scrolling: touch;
}
.wcc-prefs__foot {
  padding: 16px 24px;
  border-top: 1px solid var(--wcc-border);
}

.wcc-cat,
.wcc-category-item {
  padding: 14px 0;
  border-bottom: 1px solid var(--wcc-border);
}
.wcc-cat:last-child { border-bottom: 0; }
.wcc-cat__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.wcc-cat__toggle-list {
  appearance: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  padding: 4px 0;
  border: 0;
  background: transparent;
  color: var(--wcc-text);
  font: inherit;
  font-weight: 700;
  font-size: 15px;
  text-align: left;
  cursor: pointer;
}
.wcc-cat__count { font-weight: 400; opacity: .6; font-size: 13px; }
.wcc-chev {
  width: 8px;
  height: 8px;
  margin-left: 4px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg) translateY(-2px);
  transition: transform .2s ease;
}
.wcc-cat__toggle-list[aria-expanded="true"] .wcc-chev { transform: rotate(-135deg) translateY(-2px); }
.wcc-cat__desc {
  margin: 6px 0 0;
  font-size: 13.5px;
  opacity: .8;
}
.wcc-cat__list {
  list-style: none;
  margin: 10px 0 0;
  padding: 10px 12px;
  max-height: 200px;
  overflow-y: auto;
  background: rgba(0, 0, 0, .03);
  border: 1px solid var(--wcc-border);
  border-radius: calc(var(--wcc-radius) * .75);
  font-size: 13px;
}
.wcc-cat__list li { margin: 0; padding: 3px 0; }
.wcc-cat__list code {
  padding: 1px 5px;
  border-radius: 4px;
  background: rgba(0, 0, 0, .06);
  font-size: 12px;
  color: inherit;
}
.wcc-cat__list span { opacity: .7; }
.wcc-empty { font-style: italic; opacity: .7; }

/* ---------- Przełącznik ---------- */
.wcc-switch {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
  margin: 0;
  cursor: pointer;
}
.wcc-switch input {
  position: absolute;
  width: 44px;
  height: 24px;
  margin: 0;
  opacity: 0;
  cursor: pointer;
  z-index: 1;
}
.wcc-switch__track {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
  border-radius: 999px;
  background: #cbd5e1;
  transition: background-color .2s ease;
}
.wcc-switch__track::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .25);
  transition: transform .2s ease;
}
.wcc-switch input:checked + .wcc-switch__track { background: var(--wcc-toggle); }
.wcc-switch input:checked + .wcc-switch__track::after { transform: translateX(20px); }
.wcc-switch input:focus-visible + .wcc-switch__track { outline: 2px solid var(--wcc-toggle); outline-offset: 2px; }
.wcc-switch input:disabled,
.wcc-switch input:disabled + .wcc-switch__track { cursor: not-allowed; opacity: .5; }
.wcc-switch:has(input:disabled) { cursor: not-allowed; }
.wcc-always {
  order: -1;
  font-size: 12px;
  font-weight: 600;
  color: var(--wcc-toggle);
  white-space: nowrap;
}

/* ---------- Pływający przycisk ---------- */
.wcc-float {
  appearance: none;
  position: fixed;
  bottom: 20px;
  z-index: 2147482999;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 46px;
  height: 46px;
  margin: 0;
  padding: 0;
  border: 1px solid var(--wcc-border);
  border-radius: 50%;
  background: var(--wcc-bg);
  color: var(--wcc-primary);
  box-shadow: 0 4px 16px rgba(0, 0, 0, .15);
  cursor: pointer;
  transition: transform .15s ease, box-shadow .15s ease;
  animation: wcc-fade .3s ease;
}
.wcc-float:hover { transform: scale(1.06); box-shadow: 0 6px 20px rgba(0, 0, 0, .2); }
.wcc-float--left { left: 20px; }
.wcc-float--right { right: 20px; }

.wcc-settings-link { cursor: pointer; }

/* ---------- Animacje ---------- */
@keyframes wcc-slide-up {
  from { transform: translateY(100%); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}
@keyframes wcc-pop {
  from { transform: translate(-50%, -46%); opacity: 0; }
  to { transform: translate(-50%, -50%); opacity: 1; }
}
@keyframes wcc-fade {
  from { opacity: 0; }
  to { opacity: 1; }
}
@media (prefers-reduced-motion: reduce) {
  .wcc-root *,
  .wcc-float { animation: none !important; transition: none !important; }
}

/* ---------- Mobile: zawsze dolny panel ---------- */
@media (max-width: 600px) {
  .wcc-root { font-size: 14px; }
  .wcc-pos-bottom .wcc-banner,
  .wcc-pos-center .wcc-banner,
  .wcc-pos-corner .wcc-banner {
    top: auto;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    max-width: none;
    transform: none;
    display: block;
    padding: 16px;
    border-radius: var(--wcc-radius) var(--wcc-radius) 0 0;
    border-left: 0;
    border-right: 0;
    border-bottom: 0;
    animation: wcc-slide-up .35s cubic-bezier(.2, .8, .2, 1);
  }
  .wcc-pos-center .wcc-overlay { opacity: 0; visibility: hidden; pointer-events: none; }
  .wcc-is-prefs .wcc-overlay { opacity: 1; visibility: visible; pointer-events: auto; }
  .wcc-title { font-size: 16px; }
  .wcc-desc { font-size: 13.5px; margin-bottom: 12px; }
  .wcc-actions { flex-direction: column-reverse; }
  .wcc-btn { width: 100%; font-size: 14px; }
  .wcc-prefs {
    top: auto;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    max-width: none;
    max-height: 88vh;
    max-height: 88dvh;
    transform: none;
    border-radius: var(--wcc-radius) var(--wcc-radius) 0 0;
    animation: wcc-slide-up .35s cubic-bezier(.2, .8, .2, 1);
  }
  .wcc-prefs__head,
  .wcc-prefs__body,
  .wcc-prefs__foot { padding-left: 16px; padding-right: 16px; }
  .wcc-float { bottom: 14px; width: 42px; height: 42px; }
  .wcc-float--left { left: 14px; }
  .wcc-float--right { right: 14px; }
}
