/* ==========================================================================
   WP Cookie Consent — Public Banner Styles
   All colours are applied via inline styles by JS; this file handles
   layout, positioning, and animation only.
   ========================================================================== */

/* --------------------------------------------------------------------------
   Base reset
   -------------------------------------------------------------------------- */
#wcc-banner *,
#wcc-modal * {
  box-sizing: border-box;
}


/* ==========================================================================
   BANNER
   ========================================================================== */

#wcc-banner {
  position: fixed;
  z-index: 999999;
  left: 0;
  right: 0;
  display: none; /* JS sets display when shown */
  font-family: inherit;
}

/* --------------------------------------------------------------------------
   Force-decision lock — blocks browsing until the visitor chooses
   -------------------------------------------------------------------------- */
html.wcc-locked,
body.wcc-locked {
  overflow: hidden !important;
}

#wcc-backdrop {
  position: fixed;
  inset: 0;
  z-index: 999990; /* below the banner (999999) / modal (1000000) */
  background: rgba(0, 0, 0, 0.45);
}


/* --------------------------------------------------------------------------
   Layout variants
   -------------------------------------------------------------------------- */

/* Full-width strip — bottom */
#wcc-banner.wcc-pos-bottom {
  bottom: 0;
  left: 0;
  right: 0;
  animation: wcc-slide-up 0.3s ease;
}

/* Full-width strip — top */
#wcc-banner.wcc-pos-top {
  top: 0;
  left: 0;
  right: 0;
  animation: wcc-slide-down 0.3s ease;
}

/* Floating box — compact card anchored to a corner */
#wcc-banner.wcc-layout-box {
  width: 360px;
  max-width: calc(100vw - 32px);
  max-height: 70vh;
  overflow-y: auto;
  /* override the full-width bar positioning */
  left: auto !important;
  right: 16px;
  bottom: 16px;
  top: auto !important;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.18), 0 2px 8px rgba(0, 0, 0, 0.08);
  animation: wcc-fade-in 0.25s ease;
}

/* Box pinned to top-right when position = top */
#wcc-banner.wcc-layout-box.wcc-pos-top {
  top: 16px !important;
  bottom: auto;
}

/* Vertical stack with comfortable padding */
#wcc-banner.wcc-layout-box .wcc-banner-inner {
  flex-direction: column;
  align-items: stretch;
  max-width: 100%;
  padding: 20px;
  gap: 14px;
}

#wcc-banner.wcc-layout-box .wcc-banner-text {
  min-width: 0;
}

/* Buttons stacked full-width — looks clean in a compact card */
#wcc-banner.wcc-layout-box .wcc-buttons {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

#wcc-banner.wcc-layout-box .wcc-btn {
  width: 100%;
  justify-content: center;
}

/* Full-screen modal overlay */
#wcc-banner.wcc-layout-modal {
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.55);
  animation: wcc-fade-in 0.2s ease;
}

/* Modal inner card — background/colour/radius set via inline style by JS */
.wcc-modal-overlay {
  max-width: 480px;
  width: calc(100% - 48px);
  max-height: 80vh;
  overflow-y: auto;
  border-radius: 8px; /* JS overrides with the container_radius setting */
  padding: 28px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.wcc-modal-overlay .wcc-banner-inner {
  flex-direction: column;
  align-items: stretch;
  max-width: 100%;
  padding: 0;
}

.wcc-modal-overlay .wcc-banner-text {
  min-width: 0;
}

.wcc-modal-overlay .wcc-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
}


/* --------------------------------------------------------------------------
   Inner container
   -------------------------------------------------------------------------- */

.wcc-banner-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 16px 24px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 16px;
}


/* --------------------------------------------------------------------------
   Text block
   -------------------------------------------------------------------------- */

.wcc-banner-text {
  flex: 1;
  min-width: 200px;
}

.wcc-banner-heading {
  font-weight: 600;
  margin: 0 0 4px;
  font-size: inherit;
}

.wcc-banner-body {
  margin: 0;
  opacity: 0.9;
  line-height: 1.5;
}


/* --------------------------------------------------------------------------
   Action buttons
   -------------------------------------------------------------------------- */

.wcc-banner-actions,
.wcc-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.wcc-btn {
  display: inline-flex;
  align-items: center;
  padding: 10px 20px;
  border-radius: inherit; /* comes from inline style on the element */
  font-size: inherit;
  font-weight: 500;
  cursor: pointer;
  border: 2px solid transparent;
  text-decoration: none;
  white-space: nowrap;
  transition: opacity 0.15s;
}

.wcc-btn:hover {
  opacity: 0.85;
}

/* Reject / secondary — border colour comes from inline style */
.wcc-btn-reject {
  border-width: 2px;
}

/* Accept and Reject must be equally prominent — PECR requires that refusing
   consent is as easy as accepting it. Same size, weight and emphasis. */
.wcc-btn-accept,
.wcc-btn-reject {
  min-width: 150px;
  justify-content: center;
  font-weight: 600;
}

/* Manage preferences — rendered as a button (border/colour come from inline style) */
.wcc-btn-manage {
  text-decoration: none;
}


/* ==========================================================================
   ANIMATIONS
   ========================================================================== */

@keyframes wcc-slide-up {
  from {
    transform: translateY(100%);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

@keyframes wcc-slide-down {
  from {
    transform: translateY(-100%);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

@keyframes wcc-fade-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}


/* ==========================================================================
   PREFERENCES MODAL
   ========================================================================== */

#wcc-modal {
  position: fixed;
  inset: 0;
  z-index: 1000000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.5);
  animation: wcc-fade-in 0.2s ease;
}

.wcc-modal-box {
  max-width: 480px;
  width: 90%;
  max-height: 80vh;
  overflow-y: auto;
  border-radius: 12px;
  padding: 28px;
  position: relative;
}

.wcc-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.wcc-modal-close {
  background: none;
  border: none;
  font-size: 20px;
  cursor: pointer;
  color: inherit;
  opacity: 0.6;
}

.wcc-modal-close:hover {
  opacity: 1;
}

.wcc-modal-body {
  margin-bottom: 20px;
}

.wcc-modal-footer {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

/* Second-layer link to the full cookie/privacy policy */
.wcc-modal-policy {
  margin: 14px 0 0;
  font-size: 0.85em;
  opacity: 0.9;
}

.wcc-modal-policy a {
  color: inherit;
}


/* --------------------------------------------------------------------------
   Consent categories
   -------------------------------------------------------------------------- */

.wcc-category {
  padding: 12px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.wcc-category:last-child {
  border-bottom: none;
}

.wcc-category-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.wcc-category-name {
  font-weight: 600;
  margin-bottom: 4px;
}

.wcc-category-desc {
  font-size: 0.85em;
  opacity: 0.8;
}


/* --------------------------------------------------------------------------
   CSS-only toggle switch
   -------------------------------------------------------------------------- */

.wcc-cat-toggle {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
}

.wcc-cat-toggle input {
  opacity: 0;
  width: 0;
  height: 0;
}

.wcc-cat-slider {
  position: absolute;
  inset: 0;
  /* Colours are set per-modal via CSS variables computed from the background
     lightness (see buildModal). Fallbacks suit a dark background. */
  background: var(--wcc-track-off, rgba(255, 255, 255, 0.3));
  border-radius: 24px;
  transition: background 0.2s;
  cursor: pointer;
}

.wcc-cat-slider::before {
  content: '';
  position: absolute;
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background: var(--wcc-knob, #ffffff);
  border-radius: 50%;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
  transition: transform 0.2s;
}

.wcc-cat-toggle input:checked + .wcc-cat-slider {
  background: var(--wcc-track-on, rgba(255, 255, 255, 0.8));
}

.wcc-cat-toggle input:checked + .wcc-cat-slider::before {
  transform: translateX(20px);
}

.wcc-cat-toggle input:disabled + .wcc-cat-slider {
  opacity: 0.5;
  cursor: not-allowed;
}


/* ==========================================================================
   REOPEN BUTTON — draggable cookie-settings pill
   ========================================================================== */

#wcc-reopen {
  position: fixed;
  bottom: 20px;
  left: 20px;
  z-index: 999998;
  display: none;           /* JS sets to flex when consent is given */
  align-items: center;
  gap: 5px;
  padding: 7px 12px 7px 9px;
  border-radius: 20px;
  border: none;
  font-family: inherit;
  font-size: 12px;
  font-weight: 500;
  line-height: 1;
  white-space: nowrap;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.22);
  opacity: 0.72;
  cursor: grab;
  user-select: none;
  -webkit-user-select: none;
  transition: opacity 0.2s ease, transform 0.15s ease, box-shadow 0.15s ease;
}

#wcc-reopen:hover {
  opacity: 1;
  transform: scale(1.05);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.3);
}

#wcc-reopen.wcc-dragging {
  cursor: grabbing;
  opacity: 1;
  transition: none;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.35);
}

.wcc-reopen-icon {
  font-size: 15px;
  line-height: 1;
  display: inline-block;
  pointer-events: none;
}

.wcc-reopen-label {
  pointer-events: none;
}


/* ==========================================================================
   RESPONSIVE — narrow screens
   ========================================================================== */

@media (max-width: 600px) {
  .wcc-banner-inner {
    flex-direction: column;
    align-items: flex-start;
  }

  .wcc-banner-actions {
    width: 100%;
  }

  .wcc-btn {
    flex: 1;
    justify-content: center;
  }

  .wcc-modal-box {
    width: 95%;
    padding: 20px;
  }
}
