/**
 * Puzzle Interact — Law 25 cookie consent (vanilla drop-in)
 * Theme: dark (#1a1a1a / #ffffff)
 */

#pi-consent-root {
  --pi-bg: #1a1a1a;
  --pi-text: #ffffff;
  --pi-muted: rgba(255, 255, 255, 0.72);
  --pi-border: #333333;
  --pi-accent: #5b9bd5;
  --pi-accent-hover: #7cb3e8;
  --pi-danger: #e57373;
  --pi-danger-hover: #ef9a9a;
  --pi-shadow: 0 -8px 32px rgba(0, 0, 0, 0.45);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Ubuntu, Cantarell, "Noto Sans", sans-serif;
  font-size: 15px;
  line-height: 1.45;
  box-sizing: border-box;
}

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

.pi-consent__backdrop {
  position: fixed;
  inset: 0;
  z-index: 99998;
  background: rgba(0, 0, 0, 0.55);
  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);
  color: var(--pi-text);
  border-top: 1px solid var(--pi-border);
  box-shadow: var(--pi-shadow);
  padding: 1.25rem 1.25rem 1.5rem;
  transform: translateY(110%);
  transition: transform 0.28s cubic-bezier(0.22, 1, 0.36, 1);
}

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

.pi-consent__inner {
  max-width: 1120px;
  margin: 0 auto;
}

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

.pi-consent__title {
  font-size: 1.15rem;
  font-weight: 650;
  margin: 0 0 0.5rem;
}

.pi-consent__text {
  margin: 0 0 1rem;
  color: var(--pi-muted);
  max-width: 72ch;
}

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

/**
 * 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;
}

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

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

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

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

.pi-consent__btn--reject:hover {
  background: rgba(229, 115, 115, 0.12);
  border-color: var(--pi-danger-hover);
}

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

.pi-consent__btn--ghost:hover {
  border-color: var(--pi-muted);
  background: rgba(255, 255, 255, 0.06);
}

.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, 560px);
  overflow: auto;
  background: var(--pi-bg);
  color: var(--pi-text);
  border: 1px solid var(--pi-border);
  border-radius: 12px;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.55);
  padding: 1.35rem 1.35rem 1.25rem;
  margin-bottom: env(safe-area-inset-bottom, 0);
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 0.22s ease, transform 0.22s ease;
}

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

.pi-consent__panel h2 {
  margin: 0 0 0.35rem;
  font-size: 1.1rem;
}

.pi-consent__panel-desc {
  margin: 0 0 1rem;
  color: var(--pi-muted);
  font-size: 0.9rem;
}

.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;
}

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

.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: #3a3a3a;
  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%;
  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.45;
}

.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%;
  }
}
