/*
 * Debt Guardians Cookie Consent — banner styles
 *
 * Plain CSS: edit, save, upload. No build step.
 * Debt Guardians colours: yellow #fdc540, pale yellow #f9e3b2, green #28a745, dark #343a40.
 *
 * Layout: a card at the bottom-left on desktop, a compact full-width bar at the bottom on mobile.
 * "Accept all" and "Reject all" are deliberately identical: UK guidance expects
 * rejecting to be as easy and as prominent as accepting.
 */

.dgc {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1035; /* above the sticky header (1000) and the phone bar (1030); below slide-up panels (1045) so their buttons stay tappable */
  padding: 0;
  font-family: var(--bs-body-font-family, system-ui, sans-serif);
  font-size: 0.95rem;
  line-height: 1.45;
  color: #444;
}

.dgc[hidden] {
  display: none;
}

.dgc__box {
  background: #fff;
  border-top: 4px solid #fdc540;
  box-shadow: 0 -0.25rem 1.5rem rgba(0, 0, 0, 0.18);
  padding: 1rem 1rem calc(1rem + env(safe-area-inset-bottom, 0px));
  max-height: 85vh;
  overflow-y: auto;
}

/* Desktop: a card in the bottom-left corner */
@media (min-width: 768px) {
  .dgc {
    left: 1.25rem;
    right: auto;
    bottom: 1.25rem;
    max-width: 34rem;
  }

  .dgc__box {
    border-top: 0;
    border: 3px solid #fdc540;
    border-radius: 14px;
    padding: 1.25rem 1.5rem;
  }
}

.dgc__title {
  margin: 0 0 0.35rem;
  font-weight: 600;
  font-size: 1.15rem;
  color: #343a40;
}

.dgc__text {
  margin: 0 0 0.85rem;
}

.dgc__text a {
  color: #28a745;
  font-weight: 600;
  border-bottom: 1px dashed #28a745;
  text-decoration: none;
}

/* Preference toggles */
.dgc__prefs {
  margin: 0 0 0.85rem;
  padding: 0.75rem;
  background: #f9e3b2;
  border-radius: 0.5rem;
}

.dgc__prefs[hidden] {
  display: none;
}

.dgc__option {
  display: flex;
  gap: 0.6rem;
  align-items: flex-start;
  margin: 0 0 0.6rem;
  cursor: pointer;
}

.dgc__option:last-child {
  margin-bottom: 0;
}

.dgc__option input {
  flex: 0 0 auto;
  width: 1.15rem;
  height: 1.15rem;
  margin-top: 0.15rem;
  accent-color: #28a745;
}

.dgc__option strong {
  display: block;
}

/* Buttons */
.dgc__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.dgc__btn {
  flex: 1 1 8rem;
  padding: 0.55rem 1rem;
  border: 0;
  border-radius: 0.5rem;
  background: #28a745;
  color: #fff;
  font-weight: 700;
  font-size: 1rem;
  cursor: pointer;
}

.dgc__btn:hover {
  filter: brightness(1.08);
}

.dgc__btn[hidden],
.dgc__link[hidden] {
  display: none;
}

.dgc__link {
  flex: 1 0 100%;
  padding: 0.25rem 0;
  border: 0;
  background: none;
  color: #343a40;
  font-weight: 600;
  text-decoration: underline;
  cursor: pointer;
}

.dgc__btn:focus-visible,
.dgc__link:focus-visible,
.dgc__option input:focus-visible {
  outline: 3px solid #343a40;
  outline-offset: 2px;
}

/*
 * Mobile: a compact bar rather than a large panel, so the hero and quote form stay visible.
 * The heading is hidden visually but kept for screen readers (the dialog is labelled by it).
 * Reject and Accept stay side by side and identical in size and colour.
 */
@media (max-width: 767.98px) {
  .dgc {
    font-size: 0.85rem;
    line-height: 1.35;
    /* Sits above a fixed bottom bar if the theme has one: the Debt Guardians theme sets
       --dgc-offset to the height of its mobile WhatsApp/Call bar (0 while the bar is hidden). */
    bottom: var(--dgc-offset, 0px);
    transition: bottom 0.2s ease;
  }

  .dgc__box {
    border-top-width: 3px;
    padding: 0.65rem 0.85rem calc(0.5rem + env(safe-area-inset-bottom, 0px));
  }

  .dgc__title {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
  }

  .dgc__text {
    margin-bottom: 0.55rem;
  }

  .dgc__prefs {
    margin-bottom: 0.55rem;
    padding: 0.6rem;
  }

  .dgc__actions {
    gap: 0.4rem;
  }

  .dgc__btn {
    flex: 1 1 0;
    min-height: 2.75rem; /* comfortable tap target */
    padding: 0.45rem 0.75rem;
    font-size: 0.95rem;
  }

  .dgc__link {
    padding: 0.15rem 0 0;
    font-size: 0.8rem;
  }
}

/* Keep the back-to-top button out of the way while the banner is open on mobile */
@media (max-width: 767.98px) {
  .dgc-open #backToTop {
    visibility: hidden;
  }
}
