/**
 * Puzzle Interact — Law 25 cookie consent (vanilla drop-in)
 * Theme: light / accessible (matches landing carousel)
 */

#pi-consent-root {
  --pi-bg: #ffffff;
  --pi-bg-soft: linear-gradient(145deg, #ffffff 0%, #f6fcf9 42%, #eef8f2 100%);
  --pi-text: #1e3a2f;
  --pi-text-body: rgba(45, 52, 54, 0.88);
  --pi-muted: rgba(45, 52, 54, 0.62);
  --pi-border: rgba(59, 166, 102, 0.22);
  --pi-border-strong: rgba(59, 166, 102, 0.35);
  --pi-accent: #3ba666;
  --pi-accent-dark: #2e7d32;
  --pi-accent-hover: #56c97f;
  --pi-accent-soft: rgba(59, 166, 102, 0.12);
  --pi-danger: #c62828;
  --pi-danger-hover: #e53935;
  --pi-danger-soft: rgba(198, 40, 40, 0.08);
  --pi-shadow: 0 -12px 48px rgba(27, 94, 32, 0.08), 0 2px 12px rgba(0, 0, 0, 0.04);
  --pi-panel-shadow: 0 16px 48px rgba(27, 94, 32, 0.12), 0 4px 16px rgba(0, 0, 0, 0.06);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Ubuntu, Cantarell, "Noto Sans", sans-serif;
  font-size: 15px;
  line-height: 1.5;
  box-sizing: border-box;
}

#pi-consent-root *,
#pi-consent-root *::before,
#pi-consent-root *::after {
  box-sizing: border-box;
}

.pi-consent__accent-bar {
  height: 4px;
  width: 100%;
  background: linear-gradient(90deg, #3ba666, #6bcf8e);
  flex-shrink: 0;
}

.pi-consent__backdrop {
  position: fixed;
  inset: 0;
  z-index: 99998;
  background: rgba(30, 58, 47, 0.28);
  backdrop-filter: blur(2px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s ease;
}

.pi-consent__backdrop.pi-consent__backdrop--visible {
  opacity: 1;
  pointer-events: auto;
}

.pi-consent__bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 99999;
  background: var(--pi-bg-soft);
  color: var(--pi-text);
  border-top: 1px solid var(--pi-border);
  box-shadow: var(--pi-shadow);
  transform: translateY(110%);
  transition: transform 0.28s cubic-bezier(0.22, 1, 0.36, 1);
  display: flex;
  flex-direction: column;
}

.pi-consent__bar.pi-consent__bar--visible {
  transform: translateY(0);
}

.pi-consent__inner {
  max-width: 1120px;
  margin: 0 auto;
  padding: 1.25rem 1.25rem 1.5rem;
  width: 100%;
}

.pi-consent__bar-layout {
  display: grid;
  gap: 1rem;
  align-items: start;
}

@media (min-width: 768px) {
  .pi-consent__bar-layout {
    grid-template-columns: 1fr auto;
    gap: 1.5rem 2rem;
  }
}

.pi-consent__brand {
  font-weight: 700;
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--pi-accent-dark);
  margin: 0 0 0.35rem;
}

.pi-consent__title {
  font-size: 1.2rem;
  font-weight: 800;
  margin: 0 0 0.5rem;
  letter-spacing: -0.02em;
  line-height: 1.3;
  background: linear-gradient(118deg, #1e3a2f 0%, #2e7d32 42%, #3ba666 100%);
  background-clip: text;
  -webkit-background-clip: text;
  color: transparent;
}

.pi-consent__text {
  margin: 0;
  color: var(--pi-text-body);
  max-width: 72ch;
  line-height: 1.65;
}

.pi-consent__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  align-items: stretch;
}

@media (min-width: 768px) {
  .pi-consent__actions {
    justify-content: flex-end;
    align-self: end;
    min-width: 280px;
  }
}

/**
 * Equal prominence: Accept All and Reject All share the same size and primary visual weight (Law 25).
 */
.pi-consent__btn {
  appearance: none;
  border-radius: 8px;
  padding: 0.65rem 1.15rem;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  border: 2px solid transparent;
  min-height: 46px;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

.pi-consent__btn:focus-visible {
  outline: 2px solid var(--pi-accent);
  outline-offset: 3px;
}

.pi-consent__btn--accept {
  background: var(--pi-accent);
  color: #ffffff;
  border-color: var(--pi-accent);
  box-shadow: 0 2px 8px rgba(59, 166, 102, 0.25);
}

.pi-consent__btn--accept:hover {
  background: var(--pi-accent-hover);
  border-color: var(--pi-accent-hover);
}

.pi-consent__btn--reject {
  background: #ffffff;
  color: var(--pi-danger);
  border-color: var(--pi-danger);
}

.pi-consent__btn--reject:hover {
  background: var(--pi-danger-soft);
  border-color: var(--pi-danger-hover);
  color: var(--pi-danger-hover);
}

.pi-consent__btn--ghost {
  background: #ffffff;
  color: var(--pi-text);
  border-color: var(--pi-border-strong);
}

.pi-consent__btn--ghost:hover {
  border-color: var(--pi-accent);
  background: var(--pi-accent-soft);
  color: var(--pi-accent-dark);
}

.pi-consent__panel-wrap {
  position: fixed;
  inset: 0;
  z-index: 100000;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 1rem;
  pointer-events: none;
}

.pi-consent__panel-wrap.pi-consent__panel-wrap--visible {
  pointer-events: auto;
}

.pi-consent__panel {
  width: min(520px, 100%);
  max-height: min(85vh, 620px);
  overflow: auto;
  background: var(--pi-bg);
  color: var(--pi-text);
  border: 1px solid var(--pi-border);
  border-radius: 12px;
  box-shadow: var(--pi-panel-shadow);
  margin-bottom: env(safe-area-inset-bottom, 0);
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 0.22s ease, transform 0.22s ease;
  display: flex;
  flex-direction: column;
}

.pi-consent__panel-wrap.pi-consent__panel-wrap--visible .pi-consent__panel {
  opacity: 1;
  transform: translateY(0);
}

.pi-consent__panel-body {
  padding: 1.35rem 1.35rem 1.25rem;
}

.pi-consent__panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.pi-consent__panel-head-text {
  flex: 1;
  min-width: 0;
}

.pi-consent__panel h2 {
  margin: 0 0 0.35rem;
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--pi-text);
}

.pi-consent__panel-desc {
  margin: 0;
  color: var(--pi-text-body);
  font-size: 0.9rem;
  line-height: 1.55;
}

.pi-consent__chart-wrap {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
}

.pi-consent__doughnut {
  width: 72px;
  height: 72px;
  transform: rotate(-90deg);
}

.pi-consent__doughnut-ring {
  fill: none;
  stroke-linecap: round;
}

.pi-consent__chart-legend {
  font-size: 0.68rem;
  color: var(--pi-muted);
  text-align: center;
  max-width: 88px;
  line-height: 1.3;
}

.pi-consent__category-block {
  background: rgba(59, 166, 102, 0.06);
  border: 1px solid var(--pi-border);
  border-radius: 10px;
  padding: 0.15rem 0.85rem;
  margin-bottom: 0.75rem;
}

.pi-consent__category {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.85rem 0;
  border-bottom: 1px solid var(--pi-border);
}

.pi-consent__category:last-of-type {
  border-bottom: none;
}

.pi-consent__category-label strong {
  display: block;
  font-size: 0.95rem;
  color: var(--pi-text);
}

.pi-consent__category-label span {
  display: block;
  font-size: 0.82rem;
  color: var(--pi-muted);
  margin-top: 0.25rem;
  line-height: 1.45;
}

.pi-consent__muted {
  font-size: 0.85rem;
  color: var(--pi-accent-dark);
  font-weight: 600;
  padding-top: 2px;
  white-space: nowrap;
}

.pi-consent__switch {
  position: relative;
  width: 48px;
  height: 28px;
  flex-shrink: 0;
}

.pi-consent__switch input {
  opacity: 0;
  width: 0;
  height: 0;
  position: absolute;
}

.pi-consent__switch-track {
  position: absolute;
  inset: 0;
  background: #cfd8dc;
  border-radius: 999px;
  transition: background 0.18s ease;
}

.pi-consent__switch-thumb {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 22px;
  height: 22px;
  background: #fff;
  border-radius: 50%;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.18);
  transition: transform 0.18s ease;
}

.pi-consent__switch input:checked + .pi-consent__switch-track {
  background: var(--pi-accent);
}

.pi-consent__switch input:checked + .pi-consent__switch-track .pi-consent__switch-thumb {
  transform: translateX(20px);
}

.pi-consent__switch input:focus-visible + .pi-consent__switch-track {
  outline: 2px solid var(--pi-accent);
  outline-offset: 3px;
}

.pi-consent__switch input:disabled + .pi-consent__switch-track {
  opacity: 0.55;
}

.pi-consent__panel-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  margin-top: 1.25rem;
}

@media (max-width: 540px) {
  .pi-consent__actions .pi-consent__btn {
    flex: 1 1 calc(50% - 0.35rem);
    min-width: calc(50% - 0.35rem);
  }

  .pi-consent__btn--ghost {
    flex: 1 1 100%;
  }

  .pi-consent__panel-head {
    flex-direction: column-reverse;
    align-items: center;
    text-align: center;
  }

  .pi-consent__panel-head-text {
    text-align: center;
  }
}
