/* Iubenda cookie banner, restyled as a card (desktop) / bottom sheet (mobile).
 *
 * The banner markup belongs to Iubenda and is injected at runtime; this file
 * only restyles it, HomeToGo-like: white rounded card bottom-right, one big
 * accept pill, the reject button rendered as a quiet "Continue without
 * accepting" link at the top-right, the preferences button as a text link
 * under the pill. Purpose toggles are turned off in _iub.csConfiguration
 * (head.blade.php), not here.
 *
 * Iubenda writes background/text color and font-size as inline !important
 * styles; those are steered from the same csConfiguration block. Everything
 * here must survive their stylesheet, hence the heavy !important use. */

#iubenda-cs-banner#iubenda-cs-banner {
  bottom: 24px !important;
  right: 24px !important;
  left: auto !important;
  width: min(440px, calc(100vw - 32px)) !important;
  max-width: 440px !important;
  /* Chatbase parks its launcher and its greeting at 2147483645/46, so the
   * banner's own 99999998 lost: on a phone the greeting sat right on top of
   * the accept button. Consent comes before the chat. */
  z-index: 2147483647 !important;
}

/* And take the chat out of the way entirely while consent is pending — the
 * launcher shares the bottom-right corner with the card, and its greeting
 * covers the buttons. Both come back on their own once the banner is gone:
 * Iubenda removes the element rather than hiding it, so the rule stops
 * matching. Same idea as the GTM snippet that hides the widget while the
 * mobile search mask is open. */
body:has(#iubenda-cs-banner) #chatbase-message-bubbles,
body:has(#iubenda-cs-banner) #chatbase-bubble-button {
  display: none !important;
}

#iubenda-cs-banner#iubenda-cs-banner .iubenda-cs-container {
  width: 100% !important;
}

#iubenda-cs-banner#iubenda-cs-banner .iubenda-cs-content {
  border-radius: 20px !important;
  padding: 24px !important;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.22) !important;
  font-family: 'Nunito', -apple-system, sans-serif !important;
}

#iubenda-cs-banner#iubenda-cs-banner .iubenda-cs-rationale {
  position: relative !important;
  max-width: none !important;
  margin: 0 !important;
}

/* Room for the "Continue without accepting" link above the title. */
#iubenda-cs-banner#iubenda-cs-banner #iubenda-cs-title {
  margin: 30px 0 12px !important;
  padding: 0 !important;
  font-size: 20px !important;
  font-weight: 800 !important;
  line-height: 1.25 !important;
  color: #222222 !important;
}

#iubenda-cs-banner#iubenda-cs-banner #iubenda-cs-paragraph {
  margin-top: 0 !important;
  line-height: 1.55 !important;
}

/* The reject button, dressed as the quiet top-right link. */
#iubenda-cs-banner#iubenda-cs-banner .iubenda-cs-reject-btn {
  position: absolute !important;
  top: -4px !important;
  right: 0 !important;
  width: auto !important;
  background: none !important;
  border: none !important;
  color: #6d6a6a !important;
  font-weight: 700 !important;
  font-size: 12px !important;
  padding: 4px 0 !important;
  margin: 0 !important;
  text-decoration: none !important;
}

#iubenda-cs-banner#iubenda-cs-banner .iubenda-cs-reject-btn:hover {
  text-decoration: underline !important;
}

/* Buttons area: accept pill first, preferences link under it. The DOM order
 * is customize-then-consent, so the two groups swap via explicit order. */
#iubenda-cs-banner#iubenda-cs-banner .iubenda-cs-opt-group {
  display: flex !important;
  flex-direction: column !important;
  gap: 4px !important;
  margin-top: 18px !important;
  float: none !important;
}

#iubenda-cs-banner#iubenda-cs-banner .iubenda-cs-opt-group > div {
  margin: 0 !important;
  float: none !important;
  width: 100% !important;
}

#iubenda-cs-banner#iubenda-cs-banner .iubenda-cs-opt-group-consent {
  order: 1 !important;
}

#iubenda-cs-banner#iubenda-cs-banner .iubenda-cs-opt-group-custom {
  order: 2 !important;
}

#iubenda-cs-banner#iubenda-cs-banner .iubenda-cs-accept-btn {
  display: block !important;
  width: 100% !important;
  border-radius: 999px !important;
  padding: 14px 24px !important;
  font-size: 16px !important;
  font-weight: 700 !important;
  text-align: center !important;
  margin: 0 !important;
}

#iubenda-cs-banner#iubenda-cs-banner .iubenda-cs-customize-btn {
  display: block !important;
  width: 100% !important;
  background: none !important;
  border: none !important;
  color: #484848 !important;
  font-weight: 700 !important;
  font-size: 14px !important;
  text-align: center !important;
  padding: 12px 0 4px !important;
  margin: 0 !important;
}

#iubenda-cs-banner#iubenda-cs-banner .iubenda-cs-customize-btn:hover {
  text-decoration: underline !important;
}

/* No Iubenda badge on the card. */
#iubenda-cs-banner#iubenda-cs-banner .iubenda-cs-brand {
  display: none !important;
}

/* Mobile: full-width bottom sheet, rounded top corners only. */
@media (max-width: 767px) {
  #iubenda-cs-banner#iubenda-cs-banner {
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100% !important;
    max-width: none !important;
  }

  #iubenda-cs-banner#iubenda-cs-banner .iubenda-cs-content {
    border-radius: 24px 24px 0 0 !important;
    padding: 24px 20px calc(20px + env(safe-area-inset-bottom)) !important;
    box-shadow: 0 -8px 40px rgba(0, 0, 0, 0.25) !important;
  }
}
