/**
 * Cookie consent banner.
 *
 * A corner card rather than a full-screen wall: it sits in the bottom-left,
 * never covers the page, and the per-category choices open inside the same
 * card instead of in a second modal. Accent colour follows the country site
 * through --lei-accent (leiservice-theme prints it); the fallback is the UK
 * red for the sites still on the old theme.
 */

/* These sit inside whatever theme (or Elementor kit) the country site runs, so
   the handful of properties a stray theme rule would otherwise win are pinned
   down. [hidden] first: a theme's `button { display: block }` beats the browser
   default and would leave hidden buttons on screen. */
.leis-cc[hidden],
.leis-cc [hidden],
.leis-cc-reopen[hidden] {
  display: none !important;
}

.leis-cc {
  --leis-cc-accent: var(--lei-accent, #de485d);
  --leis-cc-ink: #1c2330;
  --leis-cc-muted: #5b6472;
  --leis-cc-line: #e6e9ef;
  --leis-cc-surface: #ffffff;

  position: fixed;
  left: 20px;
  bottom: 20px;
  z-index: 999999;
  width: min(420px, calc(100vw - 40px));
  font-family: "Rubik", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

.leis-cc__card {
  position: relative;
  overflow: hidden;
  background: var(--leis-cc-surface);
  border-radius: 14px;
  border: 1px solid var(--leis-cc-line);
  box-shadow: 0 18px 48px rgba(20, 27, 40, 0.18);
  padding: 22px 22px 18px;
  color: var(--leis-cc-ink);
  /* the closed state; .leis-cc--visible slides it up */
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 0.25s ease, transform 0.25s ease;
}

.leis-cc__card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 4px;
  background: var(--leis-cc-accent);
}

.leis-cc--visible .leis-cc__card {
  opacity: 1;
  transform: translateY(0);
}

@media (prefers-reduced-motion: reduce) {
  .leis-cc__card {
    transition: none;
  }
}

/* ---------------------------------------------------------------- heading */

.leis-cc__head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.leis-cc__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  border-radius: 50%;
  color: var(--leis-cc-accent);
  background: color-mix(in srgb, var(--leis-cc-accent) 12%, #ffffff);
}

.leis-cc__title {
  margin: 0;
  font-size: 17px;
  line-height: 1.3;
  font-weight: 600;
  color: var(--leis-cc-ink);
}

.leis-cc__intro {
  margin: 0 0 14px;
  font-size: 13.5px;
  line-height: 1.55;
  color: var(--leis-cc-muted);
}

.leis-cc__link {
  color: var(--leis-cc-accent);
  text-decoration: underline;
  text-underline-offset: 2px;
  white-space: nowrap;
}

/* ------------------------------------------------------- category choices */

.leis-cc__options {
  border-top: 1px solid var(--leis-cc-line);
  margin-bottom: 16px;
  max-height: 46vh;
  overflow-y: auto;
}

.leis-cc-option {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 13px 2px;
  border-bottom: 1px solid var(--leis-cc-line);
}

.leis-cc-option:last-child {
  border-bottom: 0;
}

.leis-cc-option__text {
  flex: 1 1 auto;
  min-width: 0;
}

.leis-cc-option__name {
  display: block;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--leis-cc-ink);
}

.leis-cc-option__desc {
  display: block;
  margin-top: 3px;
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--leis-cc-muted);
}

.leis-cc-always {
  flex: 0 0 auto;
  margin-top: 2px;
  padding: 3px 9px;
  border-radius: 999px;
  background: #f1f3f7;
  color: var(--leis-cc-muted);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.01em;
  white-space: nowrap;
}

/* The switch: an ordinary checkbox with its own painted track. The knob is
   positioned against the track rather than pushed around with margins, so no
   inherited line-height or box model from the host theme can shift it, and it
   is inset far enough that its shadow stays inside the track. */

.leis-cc-switch {
  position: relative;
  flex: 0 0 46px;
  margin-top: 2px;
  cursor: pointer;
  line-height: 0;
}

.leis-cc-switch input {
  position: absolute;
  top: 0;
  left: 0;
  opacity: 0;
  width: 46px;
  height: 26px;
  margin: 0;
  cursor: pointer;
}

.leis-cc-switch__track {
  position: relative;
  display: block;
  box-sizing: border-box;
  width: 46px;
  height: 26px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: #cfd5df;
  transition: background 0.18s ease;
}

.leis-cc-switch__track::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 5px;
  width: 16px;
  height: 16px;
  margin: 0;
  border-radius: 50%;
  background: #ffffff;
  box-shadow: 0 1px 2px rgba(20, 27, 40, 0.22);
  transform: translateY(-50%);
  transition: transform 0.18s ease;
}

.leis-cc-switch input:checked + .leis-cc-switch__track {
  background: var(--leis-cc-accent);
}

/* 46 track - 16 knob - 5 inset on each side = 20 */
.leis-cc-switch input:checked + .leis-cc-switch__track::after {
  transform: translateY(-50%) translateX(20px);
}

.leis-cc-switch input:focus-visible + .leis-cc-switch__track {
  outline: 2px solid var(--leis-cc-accent);
  outline-offset: 2px;
}

/* ---------------------------------------------------------------- buttons */

.leis-cc__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.leis-cc__btn {
  flex: 1 1 0;
  appearance: none;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 11px 14px;
  font: inherit;
  font-size: 13.5px;
  font-weight: 600;
  line-height: 1.2;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

/* The save button only appears with the toggles open, on a row of its own
   above accept-all / reject-all. */
.leis-cc__btn--save {
  flex: 0 0 100%;
  order: -1;
}

.leis-cc__btn--primary,
.leis-cc__btn--primary:hover,
.leis-cc__btn--primary:focus,
.leis-cc__btn--primary:active {
  background: var(--leis-cc-accent) !important;
  color: #ffffff !important;
}

.leis-cc__btn--primary:hover {
  filter: brightness(0.93);
}

.leis-cc__btn--ghost,
.leis-cc__btn--ghost:hover,
.leis-cc__btn--ghost:focus,
.leis-cc__btn--ghost:active {
  background: transparent !important;
  border-color: #d3d8e1;
  color: var(--leis-cc-ink) !important;
}

.leis-cc__btn--ghost:hover {
  border-color: var(--leis-cc-accent);
  color: var(--leis-cc-accent) !important;
}

/* With the toggles open, saving the choice is the primary action; accept-all
   steps back to match reject-all so the two carry the same weight. */
.leis-cc--expanded .leis-cc__btn--primary:not(.leis-cc__btn--save),
.leis-cc--expanded .leis-cc__btn--primary:not(.leis-cc__btn--save):hover,
.leis-cc--expanded .leis-cc__btn--primary:not(.leis-cc__btn--save):focus {
  background: transparent !important;
  border-color: #d3d8e1;
  color: var(--leis-cc-ink) !important;
}

.leis-cc--expanded .leis-cc__btn--primary:not(.leis-cc__btn--save):hover {
  border-color: var(--leis-cc-accent);
  color: var(--leis-cc-accent) !important;
}

.leis-cc__btn:focus-visible {
  outline: 2px solid var(--leis-cc-accent);
  outline-offset: 2px;
}

.leis-cc__toggle,
.leis-cc__toggle:hover,
.leis-cc__toggle:focus,
.leis-cc__toggle:active {
  display: block;
  width: 100%;
  margin-top: 12px;
  padding: 2px;
  background: none !important;
  border: 0 !important;
  box-shadow: none !important;
  font: inherit;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--leis-cc-muted) !important;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}

.leis-cc__toggle:hover {
  color: var(--leis-cc-accent) !important;
}

.leis-cc__toggle:focus:not(:focus-visible) {
  outline: none;
}

/* --------------------------------------------- the button that brings it back */

.leis-cc-reopen {
  position: fixed;
  left: 20px;
  bottom: 20px;
  z-index: 999998;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  padding: 0;
  border: 1px solid #e6e9ef;
  border-radius: 50%;
  background: #ffffff;
  color: var(--lei-accent, #de485d);
  box-shadow: 0 6px 18px rgba(20, 27, 40, 0.16);
  cursor: pointer;
  opacity: 0.75;
  transition: opacity 0.15s ease, transform 0.15s ease;
}

.leis-cc-reopen:hover {
  opacity: 1;
  transform: translateY(-1px);
}

/* ----------------------------------------------------------------- mobile */

@media (max-width: 600px) {
  .leis-cc {
    left: 10px;
    right: 10px;
    bottom: 10px;
    width: auto;
  }

  .leis-cc__card {
    padding: 18px 16px 14px;
  }

  .leis-cc__actions {
    flex-direction: column;
  }

  .leis-cc__options {
    max-height: 38vh;
  }

  .leis-cc-reopen {
    left: 12px;
    bottom: 12px;
  }
}
