/**
 * Privacy Choices — Consent banner + preference center styles.
 *
 * Custom properties (injected via wp_add_inline_style on #pc-banner,#pc-prefs,#pc-reopen):
 *   --pc-bg               e.g. #000000  (banner & modal background)
 *   --pc-text             e.g. #ffffff  (body / paragraph text)
 *   --pc-accent           e.g. #C9A24B  (headings, links, borders, toggle fill)
 *   --pc-btn-text         e.g. #000000  (text on filled buttons)
 *   --pc-btn-hover        e.g. #ffffff  (button hover background)
 *   --pc-btn-hover-text   e.g. #000000  (button hover text)
 */

/* ─── Reset within our scope ─────────────────────────────────────── */
/* NOTE: do NOT reset `padding` here. `#pc-banner *` / `#pc-prefs *` carry id
   specificity (1,0,0) and would override every `.pc-*` class padding rule
   (0,1,0), collapsing the modal/banner spacing. All our elements set their
   own padding explicitly, so omitting padding:0 is safe. */
#pc-banner *,
#pc-prefs * {
  box-sizing: border-box;
  margin: 0;
}

/* ─── Banner — fixed bottom bar ──────────────────────────────────── */
#pc-banner {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 2147483646; /* one below max so the prefs modal can sit on top */
  background: var(--pc-bg, #000);
  color: var(--pc-text, #fff);
  padding: 1.25rem 1.5rem;
  box-shadow: 0 -2px 12px rgba(0,0,0,0.35);
  font-family: inherit;
  font-size: 0.9375rem;
  line-height: 1.5;
}

#pc-banner.pc-hidden {
  display: none;
}

.pc-banner-inner {
  display: flex;
  align-items: center;
  gap: 0.85rem 1.5rem;
  flex-wrap: wrap;
}

.pc-banner-text {
  /* Grows to fill on one row (pushing the buttons to the right edge). When the
     buttons wrap to a second row, this is alone on row 1 and stretches full
     width; the buttons then sit left on row 2 (no auto margin). */
  flex: 1 1 600px;
  min-width: 0;
}

.pc-banner-text h2 {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--pc-accent, #C9A24B);
  margin-bottom: 0.35rem;
}

.pc-banner-text p {
  font-size: 0.875rem;
  color: var(--pc-text, #fff);
}

.pc-banner-text a {
  color: var(--pc-accent, #C9A24B);
  text-decoration: underline;
}

.pc-banner-text a:hover,
.pc-banner-text a:focus {
  text-decoration: none;
}

/* ─── Banner close (×) button — top-right corner ─────────────────── */
/* Scoped under #pc-banner (and background pinned across states) so a host-theme
   `button` / `button:hover` rule can't drop a box behind the × icon. */
#pc-banner .pc-close {
  position: absolute;
  top: 0.6rem;
  right: 0.75rem;
  background: transparent;
  border: 2px solid transparent;
  border-radius: 4px;
  color: var(--pc-text, rgba(255,255,255,0.7));
  font-size: 1.25rem;
  line-height: 1;
  padding: 0.2rem 0.4rem;
  cursor: pointer;
  font-family: inherit;
  box-shadow: none;
  transition: color 0.15s ease, border-color 0.15s ease;
}

#pc-banner .pc-close:hover {
  background: transparent;
  color: var(--pc-text, #fff);
}

#pc-banner .pc-close:focus-visible {
  background: transparent;
  outline: 3px solid var(--pc-accent, #C9A24B);
  outline-offset: 2px;
  border-color: var(--pc-accent, #C9A24B);
  color: var(--pc-text, #fff);
}

@media (prefers-reduced-motion: reduce) {
  #pc-banner .pc-close {
    transition: none;
  }
}

/* ─── Banner buttons — three equal ───────────────────────────────── */
/* Selectors scoped under #pc-banner so host-theme `button` rules (often set
   via higher-specificity attribute selectors) can't override our fills. */
#pc-banner .pc-banner-actions {
  display: flex;
  gap: 0.625rem;
  flex-wrap: wrap;
  flex-shrink: 0;
  /* No auto margin: the text's flex-grow pushes the buttons right on a single
     row, and on a wrapped second row they stay left-aligned. */
}

#pc-banner .pc-banner-actions button {
  flex: 1 1 auto;
  min-width: 130px;
  padding: 0.7rem 1rem;
  font-size: 1rem;
  font-weight: 700;
  font-family: inherit;
  line-height: 1.2;
  border: 2px solid var(--pc-accent, #C9A24B);
  border-radius: 4px;
  cursor: pointer;
  white-space: nowrap;
  text-align: center;
  transition: background 0.15s ease, color 0.15s ease;
}

@media (prefers-reduced-motion: reduce) {
  #pc-banner .pc-banner-actions button {
    transition: none;
  }
}

/* Accept all — filled */
#pc-banner .pc-accept-all {
  background: var(--pc-accent, #C9A24B);
  color: var(--pc-btn-text, #000);
}

#pc-banner .pc-accept-all:hover,
#pc-banner .pc-accept-all:focus {
  background: var(--pc-btn-hover, #fff);
  border-color: var(--pc-btn-hover, #fff);
  color: var(--pc-btn-hover-text, #000);
}

/* Reject all — outline */
#pc-banner .pc-reject-all {
  background: transparent;
  color: var(--pc-accent, #C9A24B);
}

#pc-banner .pc-reject-all:hover,
#pc-banner .pc-reject-all:focus {
  background: var(--pc-btn-hover, #fff);
  border-color: var(--pc-btn-hover, #fff);
  color: var(--pc-btn-hover-text, #000);
}

/* Manage preferences — outline same weight */
#pc-banner .pc-manage {
  background: transparent;
  color: var(--pc-accent, #C9A24B);
}

#pc-banner .pc-manage:hover,
#pc-banner .pc-manage:focus {
  background: var(--pc-btn-hover, #fff);
  border-color: var(--pc-btn-hover, #fff);
  color: var(--pc-btn-hover-text, #000);
}

/* ─── Modal overlay ──────────────────────────────────────────────── */
#pc-prefs {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 2147483647; /* max 32-bit signed int — the highest valid z-index */
  background: rgba(0,0,0,0.6);
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

#pc-prefs.pc-open {
  display: flex;
}

.pc-prefs-dialog {
  background: var(--pc-bg, #000);
  color: var(--pc-text, #fff);
  border-radius: 8px;
  max-width: 560px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 8px 32px rgba(0,0,0,0.45);
  display: flex;
  flex-direction: column;
}

/* scrollbar hint for inner content */
.pc-prefs-dialog::-webkit-scrollbar {
  width: 6px;
}
.pc-prefs-dialog::-webkit-scrollbar-thumb {
  background: var(--pc-accent, #C9A24B);
  border-radius: 3px;
}

.pc-prefs-header {
  padding: 1.5rem 1.75rem 1rem;
  border-bottom: 1px solid rgba(255,255,255,0.12);
}

.pc-prefs-header h2 {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--pc-accent, #C9A24B);
}

.pc-prefs-body {
  padding: 1.25rem 1.75rem;
  flex: 1;
}

.pc-prefs-body > p {
  font-size: 0.875rem;
  color: var(--pc-text, #fff);
  margin-bottom: 1rem;
}

/* ─── Category rows ──────────────────────────────────────────────── */
.pc-category {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.875rem 0;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

.pc-category:last-child {
  border-bottom: none;
}

.pc-category-info {
  flex: 1 1 auto;
  min-width: 0;
}

.pc-category-info strong {
  display: block;
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--pc-text, #fff);
  margin-bottom: 0.2rem;
}

.pc-category-info span {
  font-size: 0.8125rem;
  color: var(--pc-text, #fff);
  opacity: 0.75;
  line-height: 1.4;
}

/* ─── Toggle switch ──────────────────────────────────────────────── */
.pc-toggle {
  flex-shrink: 0;
  position: relative;
  width: 48px;
  height: 26px;
  display: inline-block;
}

.pc-toggle input[type="checkbox"] {
  opacity: 0;
  width: 0;
  height: 0;
  position: absolute;
}

.pc-toggle-track {
  position: absolute;
  inset: 0;
  background: rgba(255,255,255,0.2);
  border-radius: 13px;
  cursor: pointer;
  transition: background 0.2s ease;
}

.pc-toggle-track::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  background: #fff;
  border-radius: 50%;
  transition: transform 0.2s ease;
}

@media (prefers-reduced-motion: reduce) {
  .pc-toggle-track,
  .pc-toggle-track::after {
    transition: none;
  }
}

.pc-toggle input:checked + .pc-toggle-track {
  background: var(--pc-accent, #C9A24B);
}

.pc-toggle input:checked + .pc-toggle-track::after {
  transform: translateX(22px);
}

.pc-toggle input:focus-visible + .pc-toggle-track {
  outline: 3px solid var(--pc-accent, #C9A24B);
  outline-offset: 2px;
}

/* Locked / disabled toggle */
.pc-toggle.pc-locked .pc-toggle-track {
  cursor: not-allowed;
  opacity: 0.75;
}

/* Always-on badge */
.pc-always-on {
  display: inline-flex;
  align-items: center;
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--pc-btn-text, #000);
  background: var(--pc-accent, #C9A24B);
  border-radius: 3px;
  padding: 2px 6px;
  white-space: nowrap;
  line-height: 1.4;
}

/* ─── Modal footer ───────────────────────────────────────────────── */
.pc-prefs-footer {
  padding: 1.25rem 1.75rem 1.5rem;
  border-top: 1px solid rgba(255,255,255,0.12);
  display: block;
}

/* Scoped under #pc-prefs so host-theme `button` rules can't strip the fill/text. */
#pc-prefs .pc-confirm {
  display: block;
  width: 100%;
  margin: 0.25rem 0 0;
  padding: 0.85rem 1.5rem;
  font-size: 1rem;
  font-weight: 700;
  font-family: inherit;
  border: 2px solid var(--pc-accent, #C9A24B);
  border-radius: 4px;
  cursor: pointer;
  background: var(--pc-accent, #C9A24B);
  color: var(--pc-btn-text, #000);
  transition: background 0.15s ease, color 0.15s ease;
}

#pc-prefs .pc-confirm:hover,
#pc-prefs .pc-confirm:focus {
  background: var(--pc-btn-hover, #fff);
  border-color: var(--pc-btn-hover, #fff);
  color: var(--pc-btn-hover-text, #000);
}

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

/* ─── Re-open cookie-bite icon button ────────────────────────────── */
#pc-reopen {
  position: fixed;
  bottom: 85px;
  left: 1rem;
  z-index: 2147483645; /* just below the banner/modal, still above all site content */
  width: 46px;
  height: 46px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  background: var(--pc-bg, #000);
  color: var(--pc-accent, #C9A24B);
  border: 2px solid var(--pc-accent, #C9A24B);
  border-radius: 50%;
  cursor: pointer;
  opacity: 0.85;
  transition: opacity 0.15s ease, background 0.15s ease, color 0.15s ease;
}

#pc-reopen svg {
  width: 24px;
  height: 24px;
  display: block;
  flex-shrink: 0;
}

#pc-reopen:hover,
#pc-reopen:focus {
  opacity: 1;
  background: var(--pc-accent, #C9A24B);
  color: var(--pc-bg, #000);
}

@media (prefers-reduced-motion: reduce) {
  #pc-reopen {
    transition: none;
  }
}

/* ─── CPRA "Your Privacy Choices" named opt-out link ─────────────── */
/* Fixed fallback placement (bottom-left, below the re-open icon). For a
   real footer/menu link use the [privacy_choices_link] shortcode. */
#pc-dns-link {
  position: fixed;
  bottom: 38px;
  left: 1rem;
  z-index: 2147483645;
  max-width: calc(100vw - 2rem);
  padding: 4px 10px;
  font-size: 12px;
  line-height: 1.3;
  font-weight: 600;
  text-decoration: underline;
  color: var(--pc-accent, #C9A24B);
  background: var(--pc-bg, #000);
  border: 1px solid var(--pc-accent, #C9A24B);
  border-radius: 4px;
  opacity: 0.85;
  cursor: pointer;
  transition: opacity 0.15s ease, background 0.15s ease, color 0.15s ease;
}

#pc-dns-link:hover,
#pc-dns-link:focus {
  opacity: 1;
  color: var(--pc-bg, #000);
  background: var(--pc-accent, #C9A24B);
}

/* Inline shortcode variant — inherits the surrounding text styling. */
.pc-dns-link-inline {
  cursor: pointer;
}

@media (prefers-reduced-motion: reduce) {
  #pc-dns-link {
    transition: none;
  }
}

/* ─── Responsive — stack on small screens ────────────────────────── */
@media (max-width: 640px) {
  .pc-banner-inner {
    flex-direction: column;
    align-items: stretch;
    gap: 1rem;
  }

  /* Prevent the absolutely-positioned × button from overlapping the heading */
  .pc-banner-text {
    /* In the column layout the row's `flex: 1 1 320px` would treat 320px as a
       HEIGHT basis and grow vertically, reserving dead space above the buttons
       when the copy is short. Pin to content height instead. */
    flex: 0 0 auto;
    padding-right: 2.5rem;
  }

  #pc-banner .pc-banner-actions {
    flex-direction: column;
    margin-left: 0; /* full-width stack on mobile — no right push */
  }

  .pc-banner-actions button {
    width: 100%;
    min-width: 0;
  }

  .pc-prefs-header,
  .pc-prefs-body,
  .pc-prefs-footer {
    padding-left: 1rem;
    padding-right: 1rem;
  }

  .pc-confirm {
    width: 100%;
    text-align: center;
  }

  .pc-prefs-footer {
    justify-content: stretch;
  }
}
