/* ==========================================================================
   Perfect Vision — Cookie Consent Banner
   GDPR-compliant, unintrusive, matches the design system.
   Slides in from the bottom. No overlay. No dark backdrop.
   ========================================================================== */

/* ── Wrapper ─────────────────────────────────────────────────────────────── */
.pv-cc {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: var(--z-modal, 1050);
  background: #ffffff;
  border-top: 1px solid var(--card-border, #eaecf0);
  box-shadow:
    0px -4px 16px -4px rgba(16, 24, 40, 0.08),
    0px -2px 6px -2px rgba(16, 24, 40, 0.04);
  transform: translateY(100%);
  transition: transform 0.4s cubic-bezier(0.33, 1, 0.68, 1);
  will-change: transform;
}

.pv-cc--visible {
  transform: translateY(0);
}

.pv-cc[hidden] {
  display: none;
}

/* ── Inner container ─────────────────────────────────────────────────────── */
.pv-cc__inner {
  max-width: var(--container-width, 1440px);
  margin: 0 auto;
  padding: var(--space-4, 1rem) var(--space-6, 1.5rem);
}

/* ── Main content row ────────────────────────────────────────────────────── */
.pv-cc__content {
  display: flex;
  flex-direction: column;
  gap: var(--space-4, 1rem);
  align-items: flex-start;
}

@media (min-width: 768px) {
  .pv-cc__content {
    flex-direction: row;
    align-items: center;
    gap: var(--space-8, 2rem);
  }
}

/* ── Text ────────────────────────────────────────────────────────────────── */
.pv-cc__text {
  flex: 1;
  min-width: 0;
}

.pv-cc__title {
  display: flex;
  align-items: center;
  gap: var(--space-2, 0.5rem);
  font-family: var(--font-family-system, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif);
  font-size: var(--font-size-base, 1rem);
  font-weight: 600;
  color: var(--color-tertiary-900, #101828);
  margin: 0 0 var(--space-1, 0.25rem);
  line-height: 1.4;
}

.pv-cc__icon {
  color: var(--color-primary-500, #5ab5b2);
  flex-shrink: 0;
  width: 1.125rem;
  height: 1.125rem;
}

.pv-cc__description {
  font-family: var(--font-family-system, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif);
  font-size: var(--font-size-sm, 0.875rem);
  color: var(--color-tertiary-600, #475467);
  margin: 0;
  line-height: 1.6;
}

.pv-cc__privacy-link {
  color: var(--color-primary-600, #4a9a98);
  text-decoration: underline;
  text-decoration-color: transparent;
  transition: text-decoration-color var(--transition-fast, 150ms ease-in-out);
  margin-left: var(--space-1, 0.25rem);
}

.pv-cc__privacy-link:hover,
.pv-cc__privacy-link:focus-visible {
  text-decoration-color: currentColor;
}

/* ── Actions ─────────────────────────────────────────────────────────────── */
.pv-cc__actions {
  display: flex;
  flex-shrink: 0;
  gap: var(--space-3, 0.75rem);
  align-items: center;
  flex-wrap: wrap;
}

@media (max-width: 767px) {
  .pv-cc__actions {
    width: 100%;
    justify-content: flex-end;
  }
}

/* ── Buttons ─────────────────────────────────────────────────────────────── */
.pv-cc__btn {
  font-family: var(--font-family-system, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif);
  font-size: var(--font-size-sm, 0.875rem);
  font-weight: 500;
  line-height: 1.4;
  border-radius: var(--radius-xl, 1rem);
  padding: var(--space-2, 0.5rem) var(--space-5, 1.25rem);
  cursor: pointer;
  white-space: nowrap;
  border-width: 1px;
  border-style: solid;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition:
    background-color var(--transition-fast, 150ms ease-in-out),
    border-color var(--transition-fast, 150ms ease-in-out),
    box-shadow var(--transition-fast, 150ms ease-in-out),
    opacity var(--transition-fast, 150ms ease-in-out);
}

/* Accept — primary teal */
.pv-cc__btn--accept {
  background-color: var(--color-primary-500, #5ab5b2);
  background-image: var(--btn-primary-bg, linear-gradient(180deg, #7cc4c2 14.725%, #6bbcba 100%));
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.68);
  box-shadow:
    0px 5px 15px 0px rgba(25, 33, 61, 0.11),
    0px 0px 0px 1px #5ab5b2;
}

.pv-cc__btn--accept:hover {
  background-image: var(--btn-primary-bg-hover, linear-gradient(180deg, #449795 14.725%, #8ecccb 100%));
  box-shadow:
    0px 5px 15px 0px rgba(25, 33, 61, 0.18),
    0px 0px 0px 1px #5ab5b2;
}

.pv-cc__btn--accept:focus-visible {
  outline: 2px solid var(--color-primary-300, #9fe5e9);
  outline-offset: 2px;
}

/* Decline — neutral outline */
.pv-cc__btn--decline {
  background-color: #ffffff;
  color: var(--color-tertiary-600, #475467);
  border-color: var(--card-border, #eaecf0);
  box-shadow: var(--shadow-xs, 0px 1px 2px 0px rgba(16, 24, 40, 0.05));
}

.pv-cc__btn--decline:hover {
  background-color: var(--color-gray-50, #f9fafb);
  border-color: var(--color-gray-300, #d1d5db);
}

.pv-cc__btn--decline:focus-visible {
  outline: 2px solid var(--color-primary-300, #9fe5e9);
  outline-offset: 2px;
}

/* Settings — text link */
.pv-cc__btn--settings {
  background: none;
  border-color: transparent;
  color: var(--color-primary-600, #4a9a98);
  box-shadow: none;
  padding-left: var(--space-2, 0.5rem);
  padding-right: var(--space-2, 0.5rem);
  text-decoration: underline;
  text-decoration-color: transparent;
}

.pv-cc__btn--settings:hover {
  background: none;
  text-decoration-color: currentColor;
}

.pv-cc__btn--settings:focus-visible {
  outline: 2px solid var(--color-primary-300, #9fe5e9);
  outline-offset: 2px;
  border-radius: var(--radius-sm, 0.25rem);
}

/* ── Settings panel ──────────────────────────────────────────────────────── */
.pv-cc__panel {
  border-top: 1px solid var(--card-border, #eaecf0);
  margin-top: var(--space-4, 1rem);
  padding-top: var(--space-4, 1rem);
  display: flex;
  flex-direction: column;
  gap: var(--space-3, 0.75rem);
}

.pv-cc__panel[hidden] {
  display: none;
}

/* ── Cookie category row ─────────────────────────────────────────────────── */
.pv-cc__category {
  padding: var(--space-3, 0.75rem) var(--space-4, 1rem);
  border: 1px solid var(--card-border, #eaecf0);
  border-radius: var(--radius-lg, 0.75rem);
  background: var(--color-gray-50, #f9fafb);
}

.pv-cc__category-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-4, 1rem);
}

.pv-cc__category-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
  min-width: 0;
}

.pv-cc__category-name {
  font-family: var(--font-family-system, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif);
  font-size: var(--font-size-sm, 0.875rem);
  font-weight: 600;
  color: var(--color-tertiary-800, #1d2939);
}

label.pv-cc__category-name {
  cursor: pointer;
}

.pv-cc__category-desc {
  font-family: var(--font-family-system, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif);
  font-size: var(--font-size-xs, 0.75rem);
  color: var(--color-tertiary-500, #667085);
  line-height: 1.5;
}

.pv-cc__always-active {
  font-family: var(--font-family-system, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif);
  font-size: var(--font-size-xs, 0.75rem);
  font-weight: 500;
  color: var(--color-primary-700, #3b7f7e);
  white-space: nowrap;
  padding: 2px var(--space-2, 0.5rem);
  background: var(--color-primary-50, #f0fbfb);
  border-radius: var(--radius-full, 9999px);
  border: 1px solid var(--color-primary-200, #bfeef0);
  flex-shrink: 0;
}

/* ── Toggle switch ───────────────────────────────────────────────────────── */
.pv-cc__toggle {
  position: relative;
  display: inline-flex;
  align-items: center;
  cursor: pointer;
  flex-shrink: 0;
}

.pv-cc__toggle input[type="checkbox"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
  pointer-events: none;
}

.pv-cc__toggle-track {
  display: inline-block;
  width: 2.5rem;
  height: 1.375rem;
  background-color: var(--color-gray-200, #e5e7eb);
  border-radius: var(--radius-full, 9999px);
  transition: background-color var(--transition-fast, 150ms ease-in-out);
  position: relative;
  flex-shrink: 0;
}

.pv-cc__toggle-track::before {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 1.125rem;
  height: 1.125rem;
  background: #ffffff;
  border-radius: 50%;
  transition: transform var(--transition-fast, 150ms ease-in-out);
  box-shadow: var(--shadow-xs, 0px 1px 2px 0px rgba(16, 24, 40, 0.05));
}

.pv-cc__toggle input:checked + .pv-cc__toggle-track {
  background-color: var(--color-primary-500, #5ab5b2);
}

.pv-cc__toggle input:checked + .pv-cc__toggle-track::before {
  transform: translateX(1.125rem);
}

.pv-cc__toggle:focus-within .pv-cc__toggle-track {
  outline: 2px solid var(--color-primary-300, #9fe5e9);
  outline-offset: 2px;
}

/* ── Panel footer (save button) ──────────────────────────────────────────── */
.pv-cc__panel-footer {
  display: flex;
  justify-content: flex-end;
  padding-top: var(--space-1, 0.25rem);
}

/* ── Consent withdrawal / reopen button ─────────────────────────────────── */
/*
 * Required by ZZPL Art.12 / GDPR Art.7(3): consent must be withdrawable
 * as easily as it was given. This small persistent link appears after the
 * user makes their first consent choice and lets them reopen the settings.
 * Positioned bottom-left to avoid overlapping page content.
 */
.pv-cc-reopen {
  position: fixed;
  bottom: var(--space-3, 0.75rem);
  left: var(--space-4, 1rem);
  z-index: 999; /* below modal, above page content */
  font-family: var(--font-family-system, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif);
  font-size: 0.6875rem; /* 11px — deliberately small and unobtrusive */
  color: var(--color-tertiary-400, #98a2b3);
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  opacity: 0.65;
  transition: opacity var(--transition-fast, 150ms ease-in-out), color var(--transition-fast, 150ms ease-in-out);
  text-decoration: underline;
  text-decoration-color: transparent;
  text-underline-offset: 2px;
  line-height: 1;
}

.pv-cc-reopen[hidden] {
  display: none;
}

.pv-cc-reopen:hover,
.pv-cc-reopen:focus-visible {
  opacity: 1;
  color: var(--color-tertiary-500, #667085);
  text-decoration-color: currentColor;
}

.pv-cc-reopen:focus-visible {
  outline: 2px solid var(--color-primary-300, #9fe5e9);
  outline-offset: 3px;
  border-radius: 2px;
}

/* ── Accessibility ───────────────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  .pv-cc,
  .pv-cc__btn,
  .pv-cc__toggle-track,
  .pv-cc__toggle-track::before {
    transition: none !important;
  }
}

@media (prefers-contrast: high) {
  .pv-cc {
    border-top-width: 2px;
    border-color: #000000;
  }

  .pv-cc__btn--decline {
    border-color: #000000;
    color: #000000;
  }
}
