/*
  Shared design for the live Cookiebot banner and preferences modal.
  Existing preview class names are retained to preserve the approved design.
*/

#cookiebanner-preview {
  position: fixed;
  z-index: 2147483645;
  right: 20px;
  bottom: 20px;
  left: 20px;
  box-sizing: border-box;
  --foreground-color: #000;
  --border-color: rgb(0 0 0 / 0.2);
  color: var(--foreground-color);
  background: linear-gradient(to bottom, var(--highlights-start-color), var(--background-color) var(--highlights-gradient-height, 50px));
  border: 0;
  border-radius: var(--border-radius, 3px);
  font-family: 'FK Grotesk Neue', Arial, sans-serif;
}

#cookiebanner-preview[hidden] {
  display: none;
}

#cookiebanner-preview .cookiebanner-preview__inner {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto auto;
  align-items: start;
  align-content: space-between;
  gap: 10px;
  width: 100%;
  max-width: 1480px;
  height: 100%;
  margin: 0 auto;
  padding: 16px;
  background: transparent;
}

#cookiebanner-preview #c-left {
  max-width: none;
}

#cookiebanner-preview p {
  margin: 0;
}

#cookiebanner-preview .c-message {
  max-width: none;
  color: var(--foreground-color);
  font-size: var(--type-reg, 14px);
  font-weight: var(--font-weight-regular, 400);
  line-height: 1.3;
}

#cookiebanner-preview .c-message a {
  color: inherit;
}

#cookiebanner-preview .c-manage-cookies {
  appearance: none;
  padding: 0;
  color: inherit;
  background: transparent;
  border: 0;
  font: inherit;
  text-decoration: underline;
  cursor: pointer;
}

#cookiebanner-preview #c-right {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
}

#cookiebanner-preview .c-button {
  justify-content: center;
  white-space: nowrap;
}

#cookiebanner-preview .c-button:focus-visible {
  outline: 2px solid var(--foreground-color);
  outline-offset: 3px;
}

#cookiebanner-preview.is-bottom-fixed {
  top: auto;
  right: 0;
  bottom: 0;
  left: 0;
  width: auto;
  height: auto;
  border-radius: 0;
}

#cookiebanner-preview.is-bottom-fixed .cookiebanner-preview__inner {
  width: min(1080px, calc(150% - 435px), calc(100vw - 40px));
  height: auto;
  padding-inline: 0;
}

@media (min-width: 768px) and (max-width: 1023px) {
  #cookiebanner-preview.is-bottom-fixed .cookiebanner-preview__inner {
    width: min(1080px, calc(150% - 435px), calc(100% - 40px));
  }
}

@media (max-width: 767px) {
  #cookiebanner-preview.is-bottom-fixed .cookiebanner-preview__inner {
    width: calc(100vw - 40px);
  }
}

.cookie-settings-options {
  width: 100%;
  margin-top: 4px;
}

.cookie-settings-option {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  min-height: 34px;
  font-size: var(--type-sm, 12px);
  cursor: pointer;
}

.cookie-settings-option span {
  min-width: 0;
}

.cookie-settings-option input {
  position: relative;
  width: 28px;
  height: 16px;
  appearance: none;
  border: var(--border);
  border-radius: var(--button-border-radius, 999px);
  background: transparent;
  cursor: pointer;
}

.cookie-settings-option input::after {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--foreground-color);
  content: "";
  transition: transform 120ms ease;
}

.cookie-settings-option input:checked {
  background: var(--foreground-color);
}

.cookie-settings-option input:checked::after {
  background: var(--background-color);
  transform: translateX(12px);
}

.cookie-settings-option input:focus-visible {
  outline: var(--stroke-weight) solid var(--focus-color);
  outline-offset: 2px;
}

.cookie-settings-option input:disabled {
  cursor: default;
  opacity: 0.45;
}

.cookie-settings-save {
  margin-top: 12px;
}

.cookie-settings-status {
  margin: 8px 0 0;
  color: var(--text-subtle);
  font-size: var(--type-xs, 10px);
  line-height: 1.4;
}

html.cookie-settings-modal-open {
  overflow: hidden;
  scrollbar-gutter: auto;
  padding-right: var(--cookie-scrollbar-gap, 0px);
}

.cookie-settings-modal {
  position: fixed;
  inset: 0;
  z-index: 2147483646;
  display: grid;
  place-items: center;
  padding: 20px;
  --foreground-color: #000;
  --background-color: #fff;
  color: var(--foreground-color);
  isolation: isolate;
  --cookie-modal-backdrop: rgb(0 0 0 / 0.1);
}

.cookie-settings-modal::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: var(--cookie-modal-viewport-width, 100vw);
  z-index: -1;
  background: var(--cookie-modal-backdrop);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  opacity: 0;
  transition: opacity 180ms ease;
}

.cookie-settings-modal.is-open::before { opacity: 1; }
.cookie-settings-modal:not(.is-open) .cookie-settings-modal__dialog { visibility: hidden; }
@media (prefers-reduced-motion: reduce) {
  .cookie-settings-modal::before { transition: none; }
}

.cookie-settings-modal[hidden] {
  display: none;
}

.cookie-settings-modal__dialog {
  width: min(100%, 420px);
  max-height: calc(100vh - 40px);
  padding: 20px;
  overflow-y: auto;
  background: var(--background-color);
  border-radius: var(--border-radius, 3px);
  box-shadow: 0 12px 40px rgb(0 0 0 / 0.2);
}

.cookie-settings-modal__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 12px;
}

.cookie-settings-modal__header h2 {
  margin: 0;
  font-size: var(--type-reg, 14px);
  font-weight: var(--font-weight-bold, 500);
}

.cookie-settings-modal__dialog > p {
  margin: 0;
  color: var(--text-subtle);
  font-size: var(--type-sm, 12px);
  line-height: 1.4;
}

html.has-bottom-cookie-banner body {
  padding-bottom: var(--cookie-banner-height, 0px);
}

html.has-bottom-cookie-banner .dev-controls {
  bottom: calc(16px + var(--cookie-banner-height, 0px));
}

#cookiebanner-preview .button-dark,
.cookie-settings-modal .button-dark {
  background: var(--foreground-color);
  color: var(--background-color);
}
.cookie-settings-modal { --focus-color: currentColor; }

@media screen and (max-width: 767px) {
  #cookiebanner-preview .cookiebanner-preview__inner {
    grid-template-columns: 1fr;
    gap: 16px;
    padding: 16px;
  }

  #cookiebanner-preview .c-message {
    font-size: var(--type-reg, 14px);
  }

  #cookiebanner-preview #c-right {
    flex-direction: column;
    align-items: stretch;
  }

  #cookiebanner-preview .c-button {
    width: 100%;
    min-height: 52px;
    padding: 13px 20px 11px;
    font-size: var(--type-lg);
    text-align: center;
    white-space: normal;
  }
}

@media (prefers-color-scheme: dark) {
  #cookiebanner-preview {
    --foreground-color: #fff;
    --border-color: rgb(255 255 255 / 0.22);
  }

  .cookie-settings-modal {
    --foreground-color: #fff;
    --background-color: #000;
    --cookie-modal-backdrop: rgb(255 255 255 / 0.1);
  }
}
