/* ============================================================
   Cookie Consent Widget — Styles
   Banner + Cookie Preferences modal.
   The modal behaves like the ESDS Bootstrap modal
   (.modal.fade + .modal-xl + .modal-dialog-scrollable):
   blurred/dimmed backdrop, fade + slide-down, locked page scroll,
   fixed header/footer with a scrolling middle.
   ============================================================ */

:root {
  /* Placeholder ESDS-style palette — swap for the real brand hex codes when available */
  --cc-primary: #eb5b2a;
  --cc-primary-dark: #cc4a1e;
  --cc-panel-bg: #1A2B4A;
  --cc-panel-text: #c7ccd6;
  --cc-panel-label: #8a90a0;
  --cc-text: #1f2430;
  --cc-text-light: #5b6472;
  --cc-bg: #ffffff;
  --cc-bg-soft: #f6f7f9;
  --cc-border: #e2e5ea;
  --cc-radius: 14px;
  --cc-shadow: 0 12px 40px rgba(0, 0, 0, 0.18);
  --cc-font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;

  /* Modal backdrop (match your site's .modal-backdrop if different) */
  --cc-overlay: rgba(10, 14, 24, 0.55);
  --cc-backdrop-blur: 6px;
  --cc-modal-margin: 1.75rem; /* Bootstrap desktop modal margin */
}

/* ============================================================
   Backdrop behind the banner (blur + dim, like .modal-backdrop)
   The page behind can't be clicked while it's shown.
   ============================================================ */
#cc-backdrop {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 100%;
  height: 100vh;
  height: 100dvh;
  inset: 0; /* modern shorthand; top/right/bottom/left above cover older phones */
  -webkit-transform: translateZ(0); /* helps iOS Safari paint the blur */
  transform: translateZ(0);
  z-index: 2147483645;
  background: var(--cc-overlay);
  -webkit-backdrop-filter: blur(var(--cc-backdrop-blur));
  backdrop-filter: blur(var(--cc-backdrop-blur));
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s linear, visibility 0s linear 0.3s;
}

#cc-backdrop.cc-show {
  opacity: 1;
  visibility: visible;
  transition: opacity 0.3s linear, visibility 0s;
}

/* Page behind can't be touch-scrolled through the blurred layers (mobile) */
#cc-backdrop,
#cc-overlay {
  touch-action: none;
  overscroll-behavior: contain;
}
#cc-overlay .cc-modal-body,
#cc-overlay .cc-modal-brand {
  touch-action: pan-y;
}

/* ============================================================
   Banner (first design — shown on page load)
   ============================================================ */
#cc-banner {
  position: fixed;
  left: 24px;
  right: 24px;
  bottom: 24px;
  max-width: 1040px;
  margin: 0 auto;
  z-index: 2147483646;
  background: var(--cc-bg);
  border: 1px solid var(--cc-border);
  border-radius: var(--cc-radius);
  box-shadow: var(--cc-shadow);
  font-family: var(--cc-font);
  color: var(--cc-text);
  padding: 26px 32px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 20px;
  outline: 0;
  transform: translateY(140%);
  visibility: hidden; /* not focusable/clickable while hidden */
  transition: transform 0.35s ease, visibility 0s linear 0.35s;
}

#cc-banner.cc-show {
  transform: translateY(0);
  visibility: visible;
  transition: transform 0.35s ease, visibility 0s;
}

/* Small "bounce" when the visitor clicks outside or presses Esc
   (same idea as Bootstrap's static backdrop) */
#cc-banner.cc-show.cc-bounce {
  animation: cc-bounce 0.3s ease;
}

@keyframes cc-bounce {
  0%   { transform: translateY(0) scale(1); }
  50%  { transform: translateY(0) scale(1.02); }
  100% { transform: translateY(0) scale(1); }
}

#cc-banner .cc-text {
  flex: 1 1 420px;
  font-size: 14.5px;
  line-height: 1.55;
  color: var(--cc-text);
  margin: 0;
}

#cc-banner .cc-text a {
  color: var(--cc-primary);
  font-weight: 600;
  text-decoration: underline;
}

#cc-banner .cc-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  flex: 0 0 auto;
}

/* ============================================================
   Buttons (pill, ESDS es-btn-light / es-btn-outline style)
   ============================================================ */
.cc-btn {
  font-family: var(--cc-font);
  font-size: 14px;
  font-weight: 700;
  padding: 13px 26px;
  border-radius: 999px;
  border: 2px solid var(--cc-primary);
  cursor: pointer;
  background: var(--cc-bg);
  color: var(--cc-primary);
  transition: background 0.15s ease, color 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
  white-space: nowrap;
}

.cc-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.15);
}

.cc-btn:active {
  transform: translateY(0);
  box-shadow: none;
}

.cc-btn:focus-visible {
  outline: 3px solid rgba(235, 91, 42, 0.35);
  outline-offset: 2px;
}

.cc-btn-primary {
  background: var(--cc-primary);
  color: #fff;
}

.cc-btn-primary:hover {
  background: var(--cc-primary-dark);
  border-color: var(--cc-primary-dark);
}

.cc-btn-outline:hover {
  background: var(--cc-bg-soft);
}

.cc-btn-text {
  border: none;
  background: none;
  color: var(--cc-primary);
  text-decoration: underline;
  padding: 12px 8px;
  border-radius: 0;
}

/* ============================================================
   Page scroll lock while the modal is open (like body.modal-open)
   ============================================================ */
html.cc-modal-open,
body.cc-modal-open {
  overflow: hidden !important;
}

/* ============================================================
   Overlay (backdrop): dim + blur + fade
   display (none/block) is controlled by cookie-consent.js
   ============================================================ */
#cc-overlay {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 100%;
  height: 100vh;
  height: 100dvh;
  inset: 0; /* modern shorthand; top/right/bottom/left above cover older phones */
  -webkit-transform: translateZ(0); /* helps iOS Safari paint the blur */
  transform: translateZ(0);
  z-index: 2147483647;
  display: none;
  overflow-x: hidden;
  overflow-y: auto;
  background: var(--cc-overlay);
  -webkit-backdrop-filter: blur(var(--cc-backdrop-blur));
  backdrop-filter: blur(var(--cc-backdrop-blur));
  opacity: 0;
  transition: opacity 0.15s linear;
}

#cc-overlay.cc-show {
  opacity: 1;
}

/* ============================================================
   Modal dialog: slide down from -50px, sized like .modal-xl
   ============================================================ */
#cc-modal {
  position: relative;
  display: flex;
  flex-direction: row;
  width: auto;
  margin: 0.5rem;
  max-height: calc(100vh - 1rem);
  max-height: calc(100dvh - 1rem);
  background: var(--cc-bg);
  border-radius: var(--cc-radius);
  box-shadow: var(--cc-shadow);
  font-family: var(--cc-font);
  color: var(--cc-text);
  overflow: hidden;
  outline: 0;
  transform: translate(0, -50px);
  transition: transform 0.3s ease-out;
}

#cc-overlay.cc-show #cc-modal {
  transform: none;
}

/* Bootstrap .modal-xl breakpoints */
@media (min-width: 576px) {
  #cc-modal {
    max-width: 500px;
    margin: var(--cc-modal-margin) auto;
    max-height: calc(100vh - (var(--cc-modal-margin) * 2));
    max-height: calc(100dvh - (var(--cc-modal-margin) * 2));
  }
}

@media (min-width: 992px) {
  #cc-modal {
    max-width: 800px;
  }
}

@media (min-width: 1200px) {
  #cc-modal {
    max-width: 1140px;
  }
}

/* ---------- Left brand panel (ESDS modal__left, col-lg-4, d-none d-lg-block) ---------- */
#cc-modal .cc-modal-brand {
  flex: 0 0 33.3333%;
  max-width: 33.3333%;
  background: var(--cc-panel-bg);
  color: var(--cc-panel-text);
  padding: 40px 30px;
  display: none;
  flex-direction: column;
  box-sizing: border-box;
  overflow-y: auto;
}

@media (min-width: 992px) {
  #cc-modal .cc-modal-brand {
    display: flex;
  }
}

#cc-modal .cc-modal-brand .cc-brand-mark {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: 0.5px;
  color: #fff;
  margin-bottom: 24px;
}

#cc-modal .cc-modal-brand .cc-brand-mark span {
  color: var(--cc-primary);
}

#cc-modal .cc-modal-brand p {
  font-size: 14px;
  line-height: 1.7;
  margin: 0 0 28px;
}

#cc-modal .cc-brand-info {
  display: flex;
  flex-direction: column;
  gap: 18px;
  margin-top: auto;
}

#cc-modal .cc-brand-info-row {
  display: flex;
  gap: 12px;
  align-items: flex-start;
}

#cc-modal .cc-brand-info-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
}

#cc-modal .cc-brand-info-label {
  display: block;
  font-size: 11px;
  letter-spacing: 1px;
  color: var(--cc-panel-label);
  text-transform: uppercase;
}

#cc-modal .cc-brand-info-value {
  display: block;
  font-size: 13.5px;
  font-weight: 600;
  color: #fff;
}

/* ---------- Right panel (col-lg-8): fixed header/footer, scrolling body ---------- */
#cc-modal .cc-modal-main {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
}

#cc-modal .cc-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 24px 28px 0;
  flex: 0 0 auto;
}

#cc-modal .cc-modal-header h2 {
  font-size: 19px;
  margin: 0;
  color: var(--cc-text);
}

#cc-modal .cc-close {
  background: none;
  border: none;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  color: var(--cc-text-light);
  padding: 4px 8px;
}

#cc-modal .cc-close:hover {
  color: var(--cc-text);
}

#cc-modal .cc-modal-body {
  padding: 16px 28px;
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

#cc-modal .cc-intro {
  font-size: 13.5px;
  line-height: 1.6;
  color: var(--cc-text-light);
  margin: 0 0 14px;
}

#cc-modal .cc-intro a {
  color: var(--cc-primary);
  font-weight: 600;
}

#cc-modal .cc-meta {
  font-size: 12px;
  color: var(--cc-text-light);
  margin-bottom: 18px;
  line-height: 1.6;
  word-break: break-all;
}

#cc-modal .cc-meta strong {
  color: var(--cc-text);
}

/* ============================================================
   Category accordion
   ============================================================ */
.cc-category {
  border: 1px solid var(--cc-border);
  border-radius: 8px;
  margin-bottom: 10px;
  overflow: hidden;
}

.cc-category-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  cursor: pointer;
  background: var(--cc-bg);
  user-select: none;
}

.cc-category-head .cc-cat-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.cc-category-title {
  font-size: 14.5px;
  font-weight: 700;
  color: var(--cc-text);
}

.cc-cat-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 0 0 auto;
}

.cc-category-status {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--cc-primary);
}

.cc-toggle-sign {
  font-size: 18px;
  color: var(--cc-text-light);
  width: 20px;
  text-align: center;
  flex: 0 0 auto;
}

.cc-category-body {
  padding: 0 16px 16px 16px;
  font-size: 13px;
  line-height: 1.6;
  color: var(--cc-text-light);
  background: var(--cc-bg-soft);
  display: none;
}

.cc-category.cc-open .cc-category-body {
  display: block;
  padding-top: 12px;
}

/* ---------- Checkbox ---------- */
.cc-checkbox {
  appearance: none;
  -webkit-appearance: none;
  width: 22px;
  height: 22px;
  flex: 0 0 auto;
  border: 2px solid #b9c0cc;
  border-radius: 6px;
  background: #fff;
  cursor: pointer;
  position: relative;
  margin: 0;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.cc-checkbox:checked {
  background: var(--cc-primary);
  border-color: var(--cc-primary);
}

.cc-checkbox:checked::after {
  content: "";
  position: absolute;
  left: 6px;
  top: 2px;
  width: 6px;
  height: 11px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

/* Locked "Strictly Necessary" checkbox: always ticked, greyed, not clickable.
   pointer-events:none lets a click fall through to the header (opens the description). */
.cc-checkbox:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  pointer-events: none;
}

/* ============================================================
   Modal footer + status message
   ============================================================ */
#cc-modal .cc-modal-footer {
  display: flex;
  gap: 12px;
  padding: 16px 28px 28px;
  flex: 0 0 auto;
  flex-wrap: wrap;
  border-top: 1px solid var(--cc-border);
}

#cc-modal .cc-modal-footer .cc-btn {
  flex: 1 1 auto;
  text-align: center;
}

.cc-status-msg {
  font-size: 12.5px;
  padding: 0 28px 12px;
  margin: 0;
  flex: 0 0 auto;
  color: var(--cc-text-light);
}

.cc-status-msg.cc-error {
  color: #b3261e;
}

.cc-status-msg.cc-success {
  color: #1b7a3d;
}

/* ============================================================
   Small screens
   ============================================================ */
@media (max-width: 560px) {
  #cc-banner {
    padding: 18px;
  }
  #cc-banner .cc-actions {
    width: 100%;
    justify-content: stretch;
  }
  #cc-banner .cc-actions .cc-btn {
    flex: 1 1 auto;
    text-align: center;
  }
  #cc-modal .cc-modal-header {
    padding: 18px 18px 0;
  }
  #cc-modal .cc-modal-body {
    padding: 14px 18px;
  }
  #cc-modal .cc-modal-footer {
    padding: 14px 18px 18px;
  }
  #cc-modal .cc-modal-footer .cc-btn {
    flex: 1 1 100%;
  }
}

/* Respect reduced-motion settings (Bootstrap does the same) */
@media (prefers-reduced-motion: reduce) {
  #cc-banner,
  #cc-backdrop,
  #cc-overlay,
  #cc-modal {
    transition: none;
  }
  #cc-banner.cc-bounce {
    animation: none;
  }
}

/* Phones/browsers without blur support: use a darker solid layer instead */
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  #cc-backdrop,
  #cc-overlay {
    background: rgba(10, 14, 24, 0.8);
  }
}