/**
 * Nexus Site Manager — Privacy module banner styles.
 * Accent colour is driven by the --nsm-accent CSS variable, injected
 * inline from the admin setting (defaults to #1a56db).
 */
:root { --nsm-accent: #1a56db; }

/* ── Flash fix ────────────────────────────────────────────────
   The banner + overlay are HIDDEN by default and only shown when the
   JS adds .is-open (i.e. when there is no stored decision). Returning
   visitors who already chose never get a painted frame of the banner.
   If JS fails to load, the banner stays hidden AND GA4 never loads —
   the safe, no-tracking-without-consent direction. */
#nsm-overlay, #nsm-banner { display: none; }
#nsm-overlay.is-open { display: block; }
#nsm-banner.is-open { display: block; }

body.nsm-body-locked { overflow: hidden !important; pointer-events: none !important; }
#nsm-banner, #nsm-overlay, #nsm-reopen { pointer-events: auto !important; }

#nsm-overlay {
  position: fixed; inset: 0; z-index: 99998;
  background: rgba(0,0,0,0.50);
  backdrop-filter: blur(2px); -webkit-backdrop-filter: blur(2px);
}

#nsm-banner {
  position: fixed; z-index: 99999; background: #fff;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 15px; line-height: 1.65; color: #1f2937; box-sizing: border-box;
}

/* Bottom bar */
#nsm-banner.nsm-banner--bottom {
  top: auto; bottom: 0; left: 0; right: 0;
  border-top: 3px solid var(--nsm-accent);
  box-shadow: 0 -4px 28px rgba(0,0,0,0.14);
  padding: 22px 32px 26px;
}

/* Center modal — uses inset:0 + margin:auto centering, which survives
   theme transform/animation conflicts more reliably than translate(). */
#nsm-banner.nsm-banner--center {
  top: 0; bottom: 0; left: 0; right: 0;
  margin: auto;
  width: calc(100% - 40px); max-width: 560px;
  height: -moz-fit-content; height: fit-content; max-height: 90vh; overflow-y: auto;
  border-radius: 12px;
  border-top: 4px solid var(--nsm-accent);
  box-shadow: 0 8px 48px rgba(0,0,0,0.22);
  padding: 32px 36px 36px;
  transform: none;
}

.nsm-banner__inner { max-width: 860px; margin: 0 auto; }
/* Heading — scoped under #nsm-banner and forced past theme frameworks
   (ACSS / Bricks h2 styles), mirroring the button rules below. --h2 is the
   ACSS heading-scale token, with a rem fallback for non-ACSS sites. (v1.1.1) */
#nsm-banner .nsm-banner__heading {
  margin: 15px 0 !important;
  font-size: var(--h2, 1.5rem) !important;
  font-weight: inherit !important;
  color: #282828;
  line-height: 1.3;
}
.nsm-banner__message { margin: 0 0 14px; color: #374151; font-size: 14px; }
/* Policy links sit in a row by default. (v1.1.1) */
.nsm-banner__links { display: flex; flex-direction: row; flex-wrap: wrap; font-size: 13px; margin-bottom: 18px; color: #6b7280; }
.nsm-banner__links a { color: var(--nsm-accent); text-decoration: underline; margin-right: 16px; }
.nsm-banner__links a:hover { opacity: 0.85; }
.nsm-banner__buttons { display: flex; gap: 12px; flex-wrap: wrap; align-items: stretch; }

/* ── Category switches (granular mode) ───────────────────────── */
.nsm-cats { margin: 4px 0 18px; border-top: 1px solid #e5e7eb; }
.nsm-cat { padding: 14px 0; border-bottom: 1px solid #e5e7eb; }
.nsm-cat__head { display: flex; align-items: center; gap: 12px; }
.nsm-cat__name { font-size: 14px; font-weight: 600; color: #111827; }
.nsm-cat__always { font-size: 11px; font-weight: 600; color: #6b7280; text-transform: uppercase; letter-spacing: .04em; margin-left: auto; }
.nsm-cat__desc { margin: 8px 0 0 52px; font-size: 13px; color: #6b7280; line-height: 1.5; }

/* The switch control (frontend). Off = grey, On = accent. */
.nsm-switch { position: relative; display: inline-block; flex-shrink: 0; width: 40px; height: 22px; cursor: pointer; }
.nsm-switch input { position: absolute; opacity: 0; width: 0; height: 0; margin: 0; }
.nsm-switch__track { position: absolute; inset: 0; background: #cbd5e1; border-radius: 11px; transition: background .2s; }
.nsm-switch__track::after { content: ''; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.25); transition: transform .2s; }
.nsm-switch input:checked + .nsm-switch__track { background: var(--nsm-accent); }
.nsm-switch input:checked + .nsm-switch__track::after { transform: translateX(18px); }
.nsm-switch input:focus-visible + .nsm-switch__track { outline: 2px solid var(--nsm-accent); outline-offset: 2px; }
/* Locked (Necessary / Do Not Sell): on, not interactive. */
.nsm-switch--locked { cursor: not-allowed; }
.nsm-switch--locked .nsm-switch__track { background: var(--nsm-accent); opacity: .55; }

/* ── "Do Not Sell" informational notice ──────────────────────── */
.nsm-dns { display: flex; align-items: flex-start; gap: 12px; margin: 0 0 18px; padding: 12px 14px; background: #f8fafc; border: 1px solid #e5e7eb; border-radius: 8px; }
.nsm-dns__text { display: flex; flex-direction: column; gap: 2px; }
.nsm-dns__label { font-size: 13px; font-weight: 600; color: #111827; }
.nsm-dns__desc { font-size: 12px; color: #6b7280; line-height: 1.5; }

/* Equal-choice buttons: same size and prominence (GDPR — no dark patterns).
   Scoped under #nsm-banner and forced so theme frameworks (Automatic.css,
   Bricks, etc.) cannot override the accent fill. */
#nsm-banner .nsm-btn {
  display: inline-flex !important; align-items: center; justify-content: center;
  min-width: 150px; padding: 11px 26px; border-radius: 6px !important;
  font-size: 14px; font-weight: 600; cursor: pointer; line-height: 1.4;
  text-decoration: none; box-shadow: none;
  transition: background .15s, border-color .15s, color .15s, opacity .15s;
}
#nsm-banner .nsm-btn--accept {
  background: var(--nsm-accent) !important;
  color: #fff !important;
  border: 2px solid var(--nsm-accent) !important;
}
#nsm-banner .nsm-btn--accept:hover { opacity: 0.9; color: #fff !important; }
#nsm-banner .nsm-btn--decline {
  background: #fff !important;
  color: #111827 !important;
  border: 2px solid #111827 !important;
}
#nsm-banner .nsm-btn--decline:hover { background: #111827 !important; color: #fff !important; }
/* Secondary "Save choices" — neutral, equal footprint, not a dark pattern. */
#nsm-banner .nsm-btn--secondary {
  background: #fff !important;
  color: var(--nsm-accent) !important;
  border: 2px solid var(--nsm-accent) !important;
}
#nsm-banner .nsm-btn--secondary:hover { background: var(--nsm-accent) !important; color: #fff !important; }

/* Floating "Cookie settings" withdrawal control (custom cookie icon) */
.nsm-reopen {
  position: fixed; left: 16px; bottom: 16px; z-index: 99997;
  display: inline-flex; align-items: center; justify-content: center;
  width: 44px; height: 44px; padding: 0;
  background: #fff; color: #374151;
  border: 1px solid #d1d5db; border-radius: 50%;
  cursor: pointer; box-shadow: 0 2px 10px rgba(0,0,0,0.14);
  transition: border-color .15s, color .15s, transform .15s, box-shadow .15s;
}
.nsm-reopen:hover {
  border-color: var(--nsm-accent); color: var(--nsm-accent);
  transform: translateY(-1px); box-shadow: 0 4px 14px rgba(0,0,0,0.18);
}
.nsm-reopen:focus-visible {
  outline: 2px solid var(--nsm-accent); outline-offset: 2px;
}
.nsm-reopen[hidden] { display: none; }
.nsm-reopen__icon { width: 24px; height: 24px; display: block; }

@media (max-width: 560px) {
  #nsm-banner.nsm-banner--bottom { padding: 18px 16px 22px; }
  #nsm-banner.nsm-banner--center {
    top: auto; bottom: 0; left: 0; right: 0; margin: 0;
    width: 100%; max-width: 100%; max-height: 85vh;
    border-radius: 12px 12px 0 0; padding: 24px 20px 28px;
  }
  #nsm-banner .nsm-btn { flex: 1 1 auto; width: 100%; }
  .nsm-cat__desc { margin-left: 0; }
}
