/* Cookie consent banner — the same card the marketing site shows, in plain CSS.

   It is a deliberate copy, not a shared component: the site's banner is a React
   component inside the Next.js build and cannot be loaded into a static report, while
   this is ~100 lines with no framework. What the two share is the contract (the cookie
   name, the stored values, the domain) and the look. If you change one, change the
   other: apps/landing-portal/src/components/common/analytics/cookie-consent-banner.style.ts
   in the ES-Website repo.

   Tokens, from the site's Tailwind theme: navy #0B192E ground, white/85 text,
   white/15 hairline, accent #F86F24 for the primary action. */
.es-consent {
  position: fixed;
  left: 50%;
  bottom: 1rem;
  transform: translateX(-50%);
  width: min(calc(100% - 2rem), 600px);
  /* Above the report, below nothing else: the email gate uses the maximum, and this sits
     just under it so the two never fight for the same pixel — see position() in
     consent.js, which also lifts this card clear of the gate when both are on screen. */
  z-index: 2147483646;
  box-sizing: border-box;
  /* position() pushes this up by the gate's height, and "Manage options" makes it taller
     still, so on a phone with a locked preview the card could reach past the top of the
     viewport — taking the per-category toggles with it, since the action row is the last
     child and stays put. Bounded by what is on screen, and scrollable, so whatever the
     gate's height the toggles remain reachable. --es-consent-offset is set by position(). */
  max-height: calc(100vh - var(--es-consent-offset, 1rem) - 1rem);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding: 1rem;
  border-radius: 0.5rem;
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: #0b192e;
  color: rgba(255, 255, 255, 0.85);
  box-shadow: 0 24px 60px -20px rgba(0, 0, 0, 0.55);
  font-family: "Open Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 0.875rem;
  line-height: 1.5;
}

@media (min-width: 640px) {
  .es-consent {
    padding: 1.25rem;
  }
}

.es-consent__message {
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
}

.es-consent__message p {
  margin: 0;
}

.es-consent a {
  width: fit-content;
  color: inherit;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.es-consent a:hover {
  color: #f86f24;
}

/* Per-purpose toggles, revealed by "Manage options". A native checkbox: it carries
   keyboard and screen-reader behaviour for free, and it is what the site uses too. */
/* [hidden] has to be restated: the UA stylesheet's `[hidden] { display: none }` loses to
   ANY author-origin display declaration, regardless of specificity, so the `display: flex`
   below would otherwise leave the toggles expanded from first paint — visible and
   tickable while the "Save choices" button that commits them is still hidden. */
.es-consent__options[hidden] {
  display: none;
}

.es-consent__options {
  list-style: none;
  margin: 0;
  padding: 0.75rem 0 0;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.es-consent__option {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
}

.es-consent__option input {
  margin: 0.125rem 0 0;
  width: 1rem;
  height: 1rem;
  flex-shrink: 0;
  cursor: pointer;
  accent-color: #f86f24;
}

.es-consent__option label {
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
  cursor: pointer;
}

.es-consent__option strong {
  font-size: 0.875rem;
  font-weight: 600;
  color: #fff;
}

.es-consent__option span {
  font-size: 0.75rem;
  line-height: 1.4;
  color: rgba(255, 255, 255, 0.7);
}

.es-consent__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 0.75rem;
}

/* A text control, not a third button: the two decisions stay visually equal — which is
   what a regulator looks at — and fine-tuning is there for whoever goes looking. */
.es-consent__manage {
  margin-right: auto;
  padding: 0;
  border: 0;
  background: none;
  font: inherit;
  color: rgba(255, 255, 255, 0.85);
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
}

.es-consent__manage:hover {
  color: #f86f24;
}

.es-consent button.es-consent__btn {
  height: 2.25rem;
  padding: 0 1rem;
  border-radius: 0.5rem;
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}

.es-consent__btn--secondary {
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

.es-consent__btn--secondary:hover {
  border-color: rgba(255, 255, 255, 0.3);
  background: rgba(255, 255, 255, 0.2);
}

.es-consent__btn--accent {
  border: 1px solid #f86f24;
  background: #f86f24;
  color: #fff;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.es-consent__btn--accent:hover {
  border-color: #e8621a;
  background: #e8621a;
}

.es-consent :focus-visible {
  outline: 2px solid #f86f24;
  outline-offset: 2px;
}
