/* Cookie Consent - visitor UI.
   Every colour, radius and font is a custom property on .cc-root, set by
   the plugin from its settings (or by the admin preview). Nothing here
   styles anything outside .cc-root, and nothing outside it is relied on. */

.cc-root {
  --cc-bg: #ffffff;
  --cc-text: #222222;
  --cc-heading: #111111;
  --cc-primary: #111111;
  --cc-primary-text: #ffffff;
  --cc-secondary: #f2f2f2;
  --cc-secondary-text: #222222;
  --cc-border: #dddddd;
  --cc-link: #111111;
  --cc-toggle-on: #2f6bff;
  --cc-toggle-off: #c9c9c9;
  --cc-overlay: rgba(0, 0, 0, .5);
  --cc-close: #555555;
  --cc-radius: 6px;
  --cc-shadow: 0 10px 40px rgba(0, 0, 0, .18);
  --cc-font: inherit;
  /* containers never go full pill, whatever the button radius is */
  --cc-radius-box: min(var(--cc-radius), 14px);
  --cc-z: 99990;

  font-family: var(--cc-font);
  font-size: 15px;
  line-height: 1.5;
  color: var(--cc-text);
  -webkit-font-smoothing: antialiased;
  box-sizing: border-box;
}
.cc-root *, .cc-root *::before, .cc-root *::after { box-sizing: inherit; }
.cc-root p { margin: 0; }
.cc-root a { color: var(--cc-link); text-decoration: underline; text-underline-offset: 2px; }
.cc-root a:hover { text-decoration: none; }
.cc-root[hidden], .cc-root [hidden] { display: none !important; }

/* ---------- buttons: three equal choices ---------- */
.cc-btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 44px; padding: 10px 18px; margin: 0;
  border: 1px solid transparent; border-radius: var(--cc-radius);
  font: inherit; font-size: 15px; font-weight: 600; line-height: 1.2; text-align: center;
  cursor: pointer; text-decoration: none; white-space: nowrap;
  transition: filter .15s, background-color .15s, color .15s;
}
.cc-btn--primary { background: var(--cc-primary); color: var(--cc-primary-text); border-color: var(--cc-primary); }
.cc-btn--secondary { background: var(--cc-secondary); color: var(--cc-secondary-text); border-color: var(--cc-border); }
.cc-btn:hover { filter: brightness(.94); }
.cc-btn:focus-visible, .cc-modal__close:focus-visible, .cc-floating:focus-visible, .cc-root a:focus-visible {
  outline: 3px solid var(--cc-toggle-on); outline-offset: 3px;
}

/* ---------- banner ---------- */
.cc-banner {
  position: fixed; left: 0; right: 0; z-index: var(--cc-z);
  background: var(--cc-bg); color: var(--cc-text);
  box-shadow: var(--cc-shadow);
}
.cc-banner.cc-pos-bottom { bottom: 0; border-top: 1px solid var(--cc-border); }
.cc-banner.cc-pos-top { top: 0; border-bottom: 1px solid var(--cc-border); }
.cc-banner__inner {
  max-width: 1240px; margin: 0 auto; padding: 18px 20px;
  display: flex; align-items: center; justify-content: space-between; gap: 24px;
}
.cc-banner__text { flex: 1 1 auto; min-width: 0; }
.cc-banner__heading { font-size: 17px; font-weight: 700; color: var(--cc-heading); margin-bottom: 4px; }
.cc-banner__desc { font-size: 14.5px; }
.cc-banner__links { margin-top: 6px; font-size: 13.5px; display: flex; flex-wrap: wrap; gap: 4px 14px; }
.cc-banner__actions { display: flex; flex-wrap: wrap; gap: 10px; flex: 0 0 auto; }

/* boxed: a centred card with margins */
.cc-banner.cc-layout-boxed { left: 16px; right: 16px; max-width: 1240px; margin: 0 auto; border: 1px solid var(--cc-border); border-radius: var(--cc-radius-box); }
.cc-banner.cc-layout-boxed.cc-pos-bottom { bottom: 16px; }
.cc-banner.cc-layout-boxed.cc-pos-top { top: 16px; }

/* floating: a card in the corner, actions stacked */
.cc-banner.cc-layout-floating { left: auto; right: 20px; width: min(420px, calc(100% - 40px)); border: 1px solid var(--cc-border); border-radius: var(--cc-radius-box); }
.cc-banner.cc-layout-floating.cc-pos-bottom { bottom: 20px; }
.cc-banner.cc-layout-floating.cc-pos-top { top: 20px; }
.cc-banner.cc-layout-floating .cc-banner__inner { flex-direction: column; align-items: stretch; padding: 22px; gap: 16px; }
.cc-banner.cc-layout-floating .cc-banner__actions { flex-direction: column; }
.cc-banner.cc-layout-floating .cc-btn { width: 100%; }

/* entrance */
@media (prefers-reduced-motion: no-preference) {
  .cc-banner { animation: cc-in .35s ease both; }
  .cc-banner.cc-pos-top { animation-name: cc-in-top; }
  @keyframes cc-in { from { transform: translateY(16px); opacity: 0; } }
  @keyframes cc-in-top { from { transform: translateY(-16px); opacity: 0; } }
}

/* ---------- modal ---------- */
.cc-modal { position: fixed; inset: 0; z-index: calc(var(--cc-z) + 1); display: flex; align-items: center; justify-content: center; padding: 20px; }
.cc-modal__overlay { position: absolute; inset: 0; background: var(--cc-overlay); }
.cc-modal__dialog {
  position: relative; width: 100%; max-width: 560px; max-height: calc(100vh - 40px); max-height: calc(100dvh - 40px);
  overflow-y: auto; -webkit-overflow-scrolling: touch;
  background: var(--cc-bg); color: var(--cc-text);
  border: 1px solid var(--cc-border); border-radius: var(--cc-radius-box); box-shadow: var(--cc-shadow);
  padding: 24px 24px 22px;
}
.cc-modal__dialog:focus { outline: none; }
.cc-modal__head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 6px; }
.cc-modal__heading { font-size: 20px; font-weight: 700; line-height: 1.25; color: var(--cc-heading); margin: 0; }
.cc-modal__close {
  flex: 0 0 auto; width: 36px; height: 36px; margin: -6px -8px 0 0; padding: 0;
  display: inline-flex; align-items: center; justify-content: center;
  background: transparent; border: 0; border-radius: var(--cc-radius-box); color: var(--cc-close); cursor: pointer;
}
.cc-modal__close:hover { background: var(--cc-secondary); }
.cc-modal__desc { font-size: 14.5px; margin-bottom: 18px; }
.cc-modal__links { font-size: 13.5px; display: flex; flex-wrap: wrap; gap: 4px 14px; margin: 16px 0 0; }
.cc-modal__actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 10px; margin-top: 20px; }

/* ---------- categories ---------- */
.cc-categories { display: flex; flex-direction: column; border-top: 1px solid var(--cc-border); }
.cc-category { padding: 14px 0; border-bottom: 1px solid var(--cc-border); }
.cc-category__row { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.cc-category__name { font-weight: 600; color: var(--cc-heading); cursor: pointer; }
.cc-category--required .cc-category__name { cursor: default; }
.cc-category__status { display: block; font-size: 12.5px; opacity: .75; margin-top: 2px; }
.cc-category__desc { font-size: 13.5px; margin-top: 6px; opacity: .9; }

/* switch: a real checkbox, visually a toggle; 44px hit area */
.cc-switch { position: relative; display: inline-block; flex: 0 0 auto; width: 46px; height: 26px; }
.cc-switch__input { position: absolute; inset: -9px; width: calc(100% + 18px); height: calc(100% + 18px); margin: 0; opacity: 0; cursor: pointer; }
.cc-switch__input:disabled { cursor: not-allowed; }
.cc-switch__track { position: absolute; inset: 0; background: var(--cc-toggle-off); border-radius: 26px; transition: background .2s; pointer-events: none; }
.cc-switch__thumb { position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; background: #fff; border-radius: 50%; box-shadow: 0 1px 3px rgba(0,0,0,.3); transition: transform .2s; }
.cc-switch__input:checked + .cc-switch__track { background: var(--cc-toggle-on); }
.cc-switch__input:checked + .cc-switch__track .cc-switch__thumb { transform: translateX(20px); }
.cc-switch__input:disabled + .cc-switch__track { opacity: .6; }
.cc-switch__input:focus-visible + .cc-switch__track { outline: 3px solid var(--cc-toggle-on); outline-offset: 3px; }

/* ---------- floating "Cookie Settings" button ---------- */
.cc-floating {
  position: fixed; left: 16px; bottom: 16px; z-index: calc(var(--cc-z) - 1);
  min-height: 40px; padding: 8px 14px; border: 1px solid var(--cc-border); border-radius: var(--cc-radius);
  background: var(--cc-bg); color: var(--cc-text); font: inherit; font-size: 13.5px; font-weight: 600; cursor: pointer;
  box-shadow: var(--cc-shadow);
}

/* shortcode / block / menu link */
.cc-settings-link { cursor: pointer; }
button.cc-settings-link { font: inherit; background: none; border: 0; padding: 0; color: inherit; text-decoration: underline; text-underline-offset: 2px; }
button.cc-settings-link:hover { text-decoration: none; }
.wp-block-cookie-consent-settings.is-style-button .cc-settings-link,
.cc-settings-link.cc-btn { text-decoration: none; }

/* ---------- small screens ---------- */
@media (max-width: 760px) {
  .cc-banner__inner { flex-direction: column; align-items: stretch; padding: 18px 16px; gap: 14px; }
  .cc-banner__actions { flex-direction: column; }
  .cc-btn { width: 100%; }
  .cc-banner.cc-layout-boxed { left: 10px; right: 10px; }
  .cc-banner.cc-layout-boxed.cc-pos-bottom { bottom: 10px; }
  .cc-banner.cc-layout-floating { right: 10px; width: calc(100% - 20px); }
  .cc-banner.cc-layout-floating.cc-pos-bottom { bottom: 10px; }
  .cc-modal { padding: 12px; align-items: flex-end; }
  .cc-modal__dialog { max-height: calc(100vh - 24px); max-height: calc(100dvh - 24px); padding: 20px 18px 18px; }
  .cc-modal__actions { flex-direction: column-reverse; }
  .cc-modal__actions .cc-btn { width: 100%; }
}

/* the admin preview is not fixed to the viewport */
.cc-preview .cc-banner { position: relative; inset: auto; }
.cc-preview .cc-modal { position: relative; inset: auto; padding: 24px; }
.cc-preview .cc-modal__overlay { border-radius: var(--cc-radius-box); }
.cc-preview .cc-modal__dialog { max-height: none; }
