/* ==========================================================================
 * C3 — Matýsek Consent UI (premium visual)
 * Logic lives in matysek-consent.js (C2) — do not change semantics here.
 * ========================================================================== */

:root {
  --mc-cream: #faf5f0;
  --mc-cream-soft: #fffdfb;
  --mc-burgundy: #7f435e;
  --mc-burgundy-dark: #5e2f43;
  --mc-text: #2a1f25;
  --mc-muted: #6b5560;
  --mc-border: #e8d9df;
  --mc-radius: 18px;
  --mc-radius-btn: 11px;
  --mc-shadow: 0 12px 40px rgba(42, 31, 37, 0.1);
  --mc-shadow-modal: 0 20px 56px rgba(42, 31, 37, 0.14);
  --mc-font: var(--m-font, "Poppins", sans-serif);
}

/* Legacy banner hard-hide (no flash when CMP on) */
body.matysek-cmp-on #iqitcookielaw {
  display: none !important;
  visibility: hidden !important;
  pointer-events: none !important;
  opacity: 0 !important;
}

body.matysek-consent-modal-open {
  overflow: hidden;
}

.matysek-consent__backdrop {
  position: fixed;
  inset: 0;
  background: rgba(42, 31, 37, 0.28);
  z-index: 10040;
  -webkit-backdrop-filter: blur(2px);
  backdrop-filter: blur(2px);
}

/* ---------- Main banner (desktop compact card) ---------- */
.matysek-consent__banner {
  position: fixed;
  left: 24px;
  bottom: 24px;
  right: auto;
  z-index: 10050;
  width: min(560px, calc(100vw - 48px));
  max-width: 560px;
  margin: 0;
  background: var(--mc-cream);
  color: var(--mc-text);
  border: 1px solid var(--mc-border);
  border-radius: var(--mc-radius);
  box-shadow: var(--mc-shadow);
  font-family: var(--mc-font);
}

.matysek-consent__banner[hidden],
.matysek-consent__modal[hidden],
.matysek-consent__backdrop[hidden] {
  display: none !important;
}

.matysek-consent__banner-inner {
  padding: 1.25rem 1.35rem 1.3rem;
}

.matysek-consent__title {
  margin: 0 0 0.45rem;
  font-size: 1.0625rem;
  font-weight: 600;
  color: var(--mc-burgundy-dark);
  line-height: 1.3;
  letter-spacing: -0.01em;
}

.matysek-consent__text {
  margin: 0 0 1.05rem;
  font-size: 0.9rem;
  line-height: 1.55;
  color: var(--mc-muted);
  font-weight: 400;
}

.matysek-consent__policy-link {
  color: var(--mc-burgundy);
  text-decoration: underline;
  text-underline-offset: 2px;
  font-weight: 500;
}

.matysek-consent__policy-link:hover {
  color: var(--mc-burgundy-dark);
}

.matysek-consent__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem 0.6rem;
  align-items: center;
}

.matysek-consent__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0.55rem 1.15rem;
  border-radius: var(--mc-radius-btn);
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  line-height: 1.2;
  text-transform: none;
  letter-spacing: 0;
  cursor: pointer;
  border: 1px solid transparent;
  transition: background-color 0.16s ease, color 0.16s ease, border-color 0.16s ease;
}

.matysek-consent__btn:focus-visible {
  outline: 2px solid var(--mc-burgundy);
  outline-offset: 2px;
}

.matysek-consent__btn--primary {
  background: var(--mc-burgundy);
  color: #fff;
  border-color: var(--mc-burgundy);
}

.matysek-consent__btn--primary:hover {
  background: var(--mc-burgundy-dark);
  border-color: var(--mc-burgundy-dark);
  color: #fff;
}

.matysek-consent__btn--secondary {
  background: var(--mc-cream-soft);
  color: var(--mc-burgundy);
  border-color: var(--mc-burgundy);
}

.matysek-consent__btn--secondary:hover {
  background: rgba(127, 67, 94, 0.07);
  color: var(--mc-burgundy-dark);
  border-color: var(--mc-burgundy-dark);
}

.matysek-consent__btn--ghost {
  background: transparent;
  color: var(--mc-burgundy-dark);
  border-color: transparent;
  text-decoration: underline;
  text-underline-offset: 2px;
  font-weight: 500;
  padding-left: 0.65rem;
  padding-right: 0.65rem;
}

.matysek-consent__btn--ghost:hover {
  color: var(--mc-burgundy);
  background: transparent;
}

/* Desktop: settings as tertiary text next to CTAs */
.matysek-consent__banner .matysek-consent__btn--ghost {
  margin-left: 0.15rem;
}

/* ---------- Settings modal ---------- */
.matysek-consent__modal {
  position: fixed;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  z-index: 10060;
  width: min(540px, calc(100vw - 2rem));
  max-height: min(85vh, 640px);
  overflow: auto;
  background: var(--mc-cream);
  color: var(--mc-text);
  border: 1px solid var(--mc-border);
  border-radius: var(--mc-radius);
  box-shadow: var(--mc-shadow-modal);
  font-family: var(--mc-font);
  -webkit-overflow-scrolling: touch;
}

.matysek-consent__modal-inner {
  padding: 1.25rem 1.4rem 1.4rem;
}

.matysek-consent__modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.35rem;
}

.matysek-consent__modal-header .matysek-consent__title {
  margin-bottom: 0;
  padding-top: 0.35rem;
}

.matysek-consent__close {
  flex: 0 0 auto;
  min-width: 44px;
  min-height: 44px;
  border: 0;
  background: transparent;
  font-size: 1.5rem;
  line-height: 1;
  color: var(--mc-muted);
  cursor: pointer;
  border-radius: 10px;
}

.matysek-consent__close:hover {
  color: var(--mc-burgundy);
  background: rgba(127, 67, 94, 0.06);
}

.matysek-consent__close:focus-visible {
  outline: 2px solid var(--mc-burgundy);
  outline-offset: 2px;
}

.matysek-consent__categories {
  margin-top: 0.5rem;
}

.matysek-consent__category {
  padding: 0.95rem 0;
  border-top: 1px solid rgba(232, 217, 223, 0.95);
}

.matysek-consent__category:first-child {
  border-top: 0;
  padding-top: 0.55rem;
}

.matysek-consent__category-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.matysek-consent__category-name {
  margin: 0 0 0.3rem;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--mc-text);
  display: block;
}

.matysek-consent__category-desc {
  margin: 0;
  font-size: 0.8125rem;
  line-height: 1.5;
  color: var(--mc-muted);
  max-width: 34ch;
}

.matysek-consent__locked {
  flex: 0 0 auto;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--mc-muted);
  padding: 0.35rem 0.65rem;
  margin-top: 0.1rem;
  border-radius: 999px;
  background: rgba(232, 217, 223, 0.55);
  border: 1px solid var(--mc-border);
  white-space: nowrap;
}

/* Soft toggles */
.matysek-consent__switch {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 48px;
  min-height: 44px;
  cursor: pointer;
  flex: 0 0 auto;
}

.matysek-consent__switch input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
}

.matysek-consent__switch-ui {
  width: 46px;
  height: 28px;
  border-radius: 999px;
  background: #efe6ea;
  border: 1px solid #dccbd3;
  position: relative;
  transition: background-color 0.16s ease, border-color 0.16s ease;
}

.matysek-consent__switch-ui::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(42, 31, 37, 0.14);
  transition: transform 0.16s ease;
}

.matysek-consent__switch input:checked + .matysek-consent__switch-ui {
  background: var(--mc-burgundy);
  border-color: var(--mc-burgundy);
}

.matysek-consent__switch input:checked + .matysek-consent__switch-ui::after {
  transform: translateX(18px);
}

.matysek-consent__switch input:focus-visible + .matysek-consent__switch-ui {
  outline: 2px solid var(--mc-burgundy);
  outline-offset: 2px;
}

.matysek-consent__actions--modal {
  margin-top: 0.85rem;
  padding-top: 1rem;
  border-top: 1px solid var(--mc-border);
}

/* Modal reject = outline (not tiny ghost) */
.matysek-consent__actions--modal .matysek-consent__btn--ghost {
  text-decoration: none;
  border-color: var(--mc-burgundy);
  color: var(--mc-burgundy);
  font-weight: 600;
  background: var(--mc-cream-soft);
  padding-left: 1.15rem;
  padding-right: 1.15rem;
}

.matysek-consent__actions--modal .matysek-consent__btn--ghost:hover {
  background: rgba(127, 67, 94, 0.07);
}

/* ---------- Footer reopen (F1 link style) ---------- */
#footer .matysek-consent-reopen,
.matysek-consent-reopen {
  display: inline;
  padding: 0;
  margin: 0;
  border: 0;
  background: none;
  color: var(--m-text-muted, var(--mc-muted));
  font: inherit;
  font-size: inherit;
  line-height: inherit;
  text-decoration: none;
  cursor: pointer;
  min-height: auto;
  box-shadow: none;
}

#footer .matysek-consent-reopen:hover,
.matysek-consent-reopen:hover {
  color: var(--m-primary, var(--mc-burgundy));
  text-decoration: none;
}

#footer .matysek-consent-reopen:focus-visible,
.matysek-consent-reopen:focus-visible {
  outline: 2px solid var(--m-primary, var(--mc-burgundy));
  outline-offset: 2px;
  border-radius: 2px;
}

.matysek-footer-sep {
  opacity: 0.65;
  color: var(--m-text-muted, var(--mc-muted));
}

/* ---------- Tablet ---------- */
@media (max-width: 1024px) and (min-width: 768px) {
  .matysek-consent__banner {
    left: 20px;
    bottom: 20px;
    width: min(520px, calc(100vw - 40px));
  }
}

/* ---------- Mobile bottom sheet ---------- */
@media (max-width: 767.98px) {
  .matysek-consent__banner {
    left: 14px;
    right: 14px;
    bottom: max(14px, env(safe-area-inset-bottom, 0px));
    width: auto;
    max-width: none;
  }

  .matysek-consent__banner-inner {
    padding: 1.15rem 1.15rem 1.2rem;
  }

  .matysek-consent__actions {
    flex-direction: column;
    align-items: stretch;
    gap: 0.55rem;
  }

  .matysek-consent__banner .matysek-consent__btn {
    width: 100%;
  }

  .matysek-consent__banner .matysek-consent__btn--ghost {
    margin-left: 0;
    order: 3;
  }

  .matysek-consent__modal {
    top: auto;
    left: 0;
    right: 0;
    bottom: 0;
    transform: none;
    width: 100%;
    max-width: none;
    max-height: min(88vh, 100%);
    border-radius: 18px 18px 0 0;
    border-bottom: 0;
    padding-bottom: env(safe-area-inset-bottom, 0px);
  }

  .matysek-consent__actions--modal {
    flex-direction: column;
    align-items: stretch;
  }

  .matysek-consent__actions--modal .matysek-consent__btn {
    width: 100%;
  }

  .matysek-consent__category-desc {
    max-width: none;
  }
}

@media (max-width: 389.98px) {
  .matysek-consent__banner {
    left: 12px;
    right: 12px;
    bottom: max(12px, env(safe-area-inset-bottom, 0px));
  }

  .matysek-consent__title {
    font-size: 1rem;
  }

  .matysek-consent__text {
    font-size: 0.875rem;
  }
}

.matysek-consent .sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}


/* C4 — information links under banner/modal intro */
.matysek-consent__links {
  margin: -0.55rem 0 1.05rem;
  font-size: 0.875rem;
  line-height: 1.45;
  color: var(--mc-muted);
}

.matysek-consent__links--modal {
  margin: 0 0 0.75rem;
}

.matysek-consent__link-sep {
  margin: 0 0.35rem;
  color: var(--mc-muted);
  opacity: 0.7;
}
