/* ═══════════════════════════════════════════════════════════════
   mkdev — Baner i panel preferencji plików cookie
   Samodzielny komponent (własne tokeny, własna przestrzeń nazw
   "mkdev-cc-"), żeby dało się go wpiąć na każdej podstronie bez
   zależności od tego, jakie zmienne CSS akurat tam istnieją.
   ═══════════════════════════════════════════════════════════════ */

#mkdev-cc-banner,
#mkdev-cc-modal,
#mkdev-cc-reopen {
  --mkdev-cc-green: oklch(0.72 0.22 142);
  --mkdev-cc-black: oklch(0.06 0.002 264);
  --mkdev-cc-fu: 'Inter', system-ui, sans-serif;
  --mkdev-cc-fh: 'DM Serif Display', Georgia, serif;
  box-sizing: border-box;
}
#mkdev-cc-banner *,
#mkdev-cc-modal *,
#mkdev-cc-reopen * {
  box-sizing: border-box;
}

/* ── BANER ─────────────────────────────────────────────────── */
#mkdev-cc-banner {
  position: fixed;
  left: 50%;
  bottom: 20px;
  transform: translate(-50%, 0);
  z-index: 9999;
  width: min(920px, calc(100vw - 32px));
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 18px 26px;
  background: oklch(0.06 0.002 264 / 0.88);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border: 1px solid oklch(1 0 0 / 0.09);
  border-radius: 16px;
  box-shadow: 0 12px 40px oklch(0 0 0 / 0.35);
  font-family: var(--mkdev-cc-fu);
  opacity: 0;
  transform: translate(-50%, 16px);
  transition: opacity 320ms cubic-bezier(0.16, 1, 0.3, 1),
              transform 320ms cubic-bezier(0.16, 1, 0.3, 1);
  pointer-events: none;
}

#mkdev-cc-banner.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
  pointer-events: auto;
}

#mkdev-cc-banner .mkdev-cc-text {
  flex: 1 1 auto;
  min-width: 0;
  font-size: 0.8rem;
  line-height: 1.6;
  font-weight: 300;
  color: oklch(1 0 0 / 0.7);
  text-align: justify;
  text-align-last: left;
}

#mkdev-cc-banner .mkdev-cc-text a {
  color: var(--mkdev-cc-green);
  text-decoration: underline;
  text-underline-offset: 2px;
  font-weight: 400;
}
#mkdev-cc-banner .mkdev-cc-text a:hover { opacity: 0.8; }

.mkdev-cc-actions {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 12px;
}
.mkdev-cc-actions .mkdev-cc-btn--ghost,
.mkdev-cc-actions .mkdev-cc-btn--link {
  text-align: center;
}

.mkdev-cc-btn {
  font-family: var(--mkdev-cc-fu);
  font-size: 0.78rem;
  font-weight: 500;
  letter-spacing: 0.01em;
  cursor: pointer;
  white-space: nowrap;
  background: none;
  border: none;
  color: inherit;
  padding: 0;
}

.mkdev-cc-btn--ghost {
  color: oklch(1 0 0 / 0.7);
  border: 1.5px solid oklch(1 0 0 / 0.25);
  padding: 10px 20px;
  border-radius: 999px;
  transition: color 200ms, border-color 200ms;
}
.mkdev-cc-btn--ghost:hover { color: oklch(1 0 0 / 0.95); border-color: oklch(1 0 0 / 0.5); }

.mkdev-cc-btn--link {
  color: var(--mkdev-cc-green);
  border: 1.5px solid oklch(0.72 0.22 142 / 0.35);
  padding: 10px 20px;
  border-radius: 999px;
  text-decoration: none;
  transition: opacity 200ms, border-color 200ms;
}
.mkdev-cc-btn--link:hover { opacity: 1; border-color: oklch(0.72 0.22 142 / 0.6); }

.mkdev-cc-btn--accept {
  background: var(--mkdev-cc-green);
  color: var(--mkdev-cc-black);
  padding: 10px 20px;
  border-radius: 999px;
  font-weight: 600;
  transition: transform 200ms, opacity 200ms;
}
.mkdev-cc-btn--accept:hover { opacity: 0.9; transform: scale(1.02); }

/* ── PANEL PREFERENCJI ─────────────────────────────────────── */
#mkdev-cc-modal {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: oklch(0 0 0 / 0.6);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 250ms ease;
  font-family: var(--mkdev-cc-fu);
}
#mkdev-cc-modal.is-visible {
  opacity: 1;
  pointer-events: auto;
}

.mkdev-cc-modal-card {
  width: min(460px, 100%);
  max-height: min(600px, calc(100vh - 48px));
  overflow-y: auto;
  background: oklch(0.08 0.002 264 / 0.97);
  border: 1px solid oklch(1 0 0 / 0.09);
  border-radius: 20px;
  padding: 32px;
  color: oklch(1 0 0 / 0.92);
  transform: translateY(10px) scale(0.98);
  transition: transform 280ms cubic-bezier(0.16, 1, 0.3, 1);
}
#mkdev-cc-modal.is-visible .mkdev-cc-modal-card {
  transform: translateY(0) scale(1);
}

.mkdev-cc-modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
}

.mkdev-cc-modal-title {
  font-family: var(--mkdev-cc-fh);
  font-size: 1.4rem;
  font-weight: 400;
  color: #fff;
}

.mkdev-cc-close {
  flex: 0 0 auto;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  color: oklch(1 0 0 / 0.5);
  font-size: 1.1rem;
  line-height: 1;
  transition: color 200ms, background 200ms;
}
.mkdev-cc-close:hover {
  color: #fff;
  background: oklch(1 0 0 / 0.08);
}

.mkdev-cc-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 0;
  border-top: 1px solid oklch(1 0 0 / 0.07);
}
.mkdev-cc-row:first-of-type { border-top: none; padding-top: 0; }

.mkdev-cc-row-text { flex: 1 1 auto; min-width: 0; }

.mkdev-cc-row-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  font-weight: 600;
  color: #fff;
  margin-bottom: 4px;
}

.mkdev-cc-row-desc {
  font-size: 0.75rem;
  line-height: 1.55;
  font-weight: 300;
  color: oklch(1 0 0 / 0.5);
}

.mkdev-cc-required {
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--mkdev-cc-green);
  border: 1px solid oklch(0.72 0.22 142 / 0.35);
  background: oklch(0.72 0.22 142 / 0.1);
  padding: 2px 8px;
  border-radius: 999px;
  flex: 0 0 auto;
  white-space: nowrap;
}

/* Przełącznik — te trzy (marketing / personalizacja / analityka) są
   punktem zaczepienia dla przyszłego Google Analytics: gdy zostanie
   dopięty, "analityka" ma po prostu sterować ładowaniem gtag.js. */
.mkdev-cc-switch {
  position: relative;
  flex: 0 0 auto;
  width: 40px;
  height: 22px;
  border-radius: 999px;
  background: oklch(1 0 0 / 0.14);
  cursor: pointer;
  transition: background 200ms;
  border: none;
  padding: 0;
}
.mkdev-cc-switch[aria-checked="true"] {
  background: var(--mkdev-cc-green);
}
.mkdev-cc-switch::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  transition: transform 200ms cubic-bezier(0.34, 1.56, 0.64, 1);
}
.mkdev-cc-switch[aria-checked="true"]::after {
  transform: translateX(18px);
}

.mkdev-cc-modal-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 24px;
  flex-wrap: wrap;
}

/* ── KÓŁKO POWROTU DO PREFERENCJI ──────────────────────────────
   Zostaje na stałe w lewym dolnym rogu po podjęciu decyzji na
   banerze — pozwala wrócić i zmienić zdanie w dowolnym momencie. */
#mkdev-cc-reopen {
  position: fixed;
  left: 20px;
  bottom: 20px;
  z-index: 9998;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: oklch(0.06 0.002 264 / 0.85);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid oklch(1 0 0 / 0.1);
  color: var(--mkdev-cc-green);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 24px oklch(0 0 0 / 0.3);
  opacity: 0;
  transform: scale(0.8);
  pointer-events: none;
  transition: opacity 250ms cubic-bezier(0.16, 1, 0.3, 1),
              transform 250ms cubic-bezier(0.16, 1, 0.3, 1),
              border-color 200ms, background 200ms;
}
#mkdev-cc-reopen.is-visible {
  opacity: 1;
  transform: scale(1);
  pointer-events: auto;
}
#mkdev-cc-reopen:hover {
  border-color: oklch(0.72 0.22 142 / 0.4);
  background: oklch(0.08 0.002 264 / 0.92);
}

@media (max-width: 640px) {
  #mkdev-cc-banner {
    flex-direction: column;
    align-items: stretch;
    bottom: 12px;
    width: calc(100vw - 24px);
    padding: 18px 20px;
  }
  .mkdev-cc-actions {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }
  .mkdev-cc-actions .mkdev-cc-btn--accept,
  .mkdev-cc-actions .mkdev-cc-btn--ghost,
  .mkdev-cc-actions .mkdev-cc-btn--link {
    width: 100%;
    text-align: center;
  }
}
