/**
 * BrunnerPopupManager — stili front (stile V2, fallback se i token tema mancano).
 * Caricato SOLO quando la pagina ha campagne candidate.
 */

/* ------------------------------------------------------------------ */
/* Base                                                               */
/* ------------------------------------------------------------------ */

.bp-root {
  --bp-accent: #164c26;
  --bp-bg: #ffffff;
  --bp-text: #212529;
  --bp-radius: 12px;
  --bp-padding: 24px;
  font-family: inherit;
  color: var(--bp-text);
}

.bp-root *,
.bp-root *::before,
.bp-root *::after {
  box-sizing: border-box;
}

.bp-hidden {
  display: none !important;
}

.bp-img {
  display: block;
  max-width: 100%;
  height: auto;
}

.bp-img--mobile {
  display: none;
}

/* ------------------------------------------------------------------ */
/* Modali                                                             */
/* ------------------------------------------------------------------ */

.bp-root--modal {
  position: fixed;
  inset: 0;
  z-index: 2147482000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.bp-overlay {
  position: absolute;
  inset: 0;
  background: rgba(9, 41, 18, calc(var(--bp-overlay-opacity, 55) / 100));
}

.bp-modal {
  position: relative;
  z-index: 1;
  width: min(var(--bp-width, 640px), 100%);
  max-height: calc(100vh - 32px);
  overflow: auto;
  background: var(--bp-bg);
  border-radius: var(--bp-radius);
  box-shadow: 0 24px 64px rgba(9, 41, 18, .35);
  display: flex;
  flex-direction: column;
}

.bp-modal--media-left,
.bp-modal--media-right {
  flex-direction: row;
}

.bp-modal--media-left .bp-modal__media { order: 0; }
.bp-modal--media-left .bp-modal__body { order: 1; }
.bp-modal--media-right .bp-modal__media { order: 1; }
.bp-modal--media-right .bp-modal__body { order: 0; }

.bp-modal__media {
  flex: 1 1 46%;
  min-width: 0;
}

.bp-modal__media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.bp-modal__body {
  flex: 1 1 54%;
  min-width: 0;
  padding: var(--bp-padding);
  position: relative;
}

.bp-modal--bg .bp-modal__bg {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
}

.bp-modal--bg .bp-modal__body {
  position: relative;
  z-index: 1;
  background: color-mix(in srgb, var(--bp-bg) 88%, transparent);
}

.bp-modal--minimal .bp-modal__body {
  text-align: left;
}

.bp-align-center .bp-modal__body {
  text-align: center;
}

.bp-modal--countdown .bp-modal__media {
  max-height: 220px;
}

/* ------------------------------------------------------------------ */
/* Contenuti                                                          */
/* ------------------------------------------------------------------ */

.bp-badge {
  display: inline-block;
  background: var(--bp-accent);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  padding: 4px 10px;
  border-radius: 999px;
  margin-bottom: 12px;
}

.bp-title {
  margin: 0 0 8px;
  font-size: 24px;
  line-height: 1.25;
  font-weight: 700;
  color: var(--bp-text);
}

.bp-subtitle {
  margin: 0 0 8px;
  font-size: 16px;
  color: color-mix(in srgb, var(--bp-text) 75%, #ffffff);
}

.bp-desc {
  margin: 0 0 16px;
  font-size: 15px;
  line-height: 1.6;
}

.bp-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 16px;
}

.bp-align-center .bp-actions {
  justify-content: center;
}

/* ------------------------------------------------------------------ */
/* Bottoni                                                            */
/* ------------------------------------------------------------------ */

.bp-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 10px 20px;
  border: 1px solid transparent;
  border-radius: calc(var(--bp-radius) / 1.5);
  font-size: 15px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: background-color .2s ease, color .2s ease, border-color .2s ease;
}

.bp-btn--primary {
  background: var(--bp-accent);
  color: #fff;
}

.bp-btn--primary:hover {
  background: color-mix(in srgb, var(--bp-accent) 82%, #000);
  color: #fff;
}

.bp-btn--secondary {
  background: transparent;
  border-color: var(--bp-accent);
  color: var(--bp-accent);
}

.bp-btn--secondary:hover {
  background: color-mix(in srgb, var(--bp-accent) 8%, transparent);
}

.bp-btn--link {
  background: transparent;
  color: var(--bp-accent);
  padding-inline: 4px;
  text-decoration: underline;
}

.bp-btn--sm {
  min-height: 36px;
  padding: 6px 14px;
  font-size: 14px;
}

.bp-btn[disabled] {
  opacity: .6;
  cursor: wait;
}

/* ------------------------------------------------------------------ */
/* Chiusura                                                           */
/* ------------------------------------------------------------------ */

.bp-close {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 2;
  width: 40px;
  height: 40px;
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, .9);
  color: #212529;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0, 0, 0, .12);
}

.bp-close:hover {
  background: #ffffff;
}

.bp-close .material-icons {
  font-size: 20px;
}

.bp-close--compact {
  width: 32px;
  height: 32px;
  min-height: 32px;
  top: 6px;
  right: 6px;
}

.bp-close--inline {
  position: static;
  width: 36px;
  height: 36px;
  min-height: 36px;
  background: transparent;
  color: inherit;
  box-shadow: none;
  flex: 0 0 auto;
}

.bp-close--inline:hover {
  background: rgba(0, 0, 0, .06);
}

/* ------------------------------------------------------------------ */
/* Form newsletter                                                    */
/* ------------------------------------------------------------------ */

.bp-form {
  margin-top: 14px;
}

.bp-form__row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.bp-form__row input[type="email"] {
  flex: 1 1 200px;
  min-height: 46px;
  padding: 10px 14px;
  border: 1px solid #c9cdd1;
  border-radius: calc(var(--bp-radius) / 1.5);
  font-size: 15px;
  color: #212529;
}

.bp-form__row input[type="email"]:focus-visible {
  outline: 2px solid var(--bp-accent);
  outline-offset: 1px;
}

.bp-form__privacy {
  margin: 10px 0 0;
  font-size: 12px;
  line-height: 1.5;
  color: #6c757d;
}

.bp-form__privacy a {
  color: var(--bp-accent);
}

.bp-form__feedback {
  margin: 10px 0 0;
  font-size: 14px;
  font-weight: 600;
}

.bp-form__feedback.is-error { color: #b3261e; }
.bp-form__feedback.is-success { color: #237a3d; }

/* ------------------------------------------------------------------ */
/* Countdown                                                          */
/* ------------------------------------------------------------------ */

.bp-countdown {
  margin: 12px 0;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.bp-countdown__value {
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  font-size: 18px;
  color: var(--bp-accent);
}

.bp-countdown__label {
  font-size: 14px;
}

/* ------------------------------------------------------------------ */
/* Barre                                                              */
/* ------------------------------------------------------------------ */

.bp-bar {
  background: var(--bp-bg);
  color: var(--bp-text);
  width: 100%;
}

.bp-bar--above {
  position: relative;
  z-index: 999;
}

.bp-bar--header {
  position: relative;
}

.bp-bar--fixed {
  position: fixed;
  left: 0;
  right: 0;
  z-index: 2147481000;
}

.bp-bar--bottom.bp-bar--fixed {
  bottom: 0;
  box-shadow: 0 -8px 24px rgba(9, 41, 18, .08);
}

.bp-bar__inner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: 8px 16px;
  font-size: 14px;
  max-width: 1600px;
  margin: 0 auto;
}

.bp-bar__icon {
  width: 22px;
  height: 22px;
  object-fit: contain;
}

.bp-bar__msg {
  font-weight: 600;
}

.bp-bar__rotate {
  display: inline-flex;
  position: relative;
}

.bp-bar__countdown {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

/* ------------------------------------------------------------------ */
/* Banner flottanti                                                   */
/* ------------------------------------------------------------------ */

.bp-root--float {
  position: fixed;
  z-index: 2147481500;
}

.bp-float--bl { left: 16px; bottom: 16px; }
.bp-float--br { right: 16px; bottom: 16px; }
.bp-float--tl { left: 16px; top: 16px; }
.bp-float--tr { right: 16px; top: 16px; }

.bp-float {
  position: relative;
  display: flex;
  gap: 12px;
  align-items: center;
  width: min(360px, calc(100vw - 32px));
  background: var(--bp-bg);
  border-radius: var(--bp-radius);
  box-shadow: 0 12px 32px rgba(9, 41, 18, .25);
  padding: 14px;
}

.bp-float__media img {
  width: 64px;
  height: 64px;
  object-fit: cover;
  border-radius: calc(var(--bp-radius) / 1.5);
}

.bp-float__title {
  margin: 0 0 4px;
  font-weight: 700;
  font-size: 15px;
}

.bp-float__desc {
  font-size: 13px;
  line-height: 1.5;
}

/* ------------------------------------------------------------------ */
/* Animazioni + accessibilità                                         */
/* ------------------------------------------------------------------ */

.bp-visible .bp-modal,
.bp-visible .bp-float {
  animation-duration: .28s;
  animation-fill-mode: both;
}

.bp-anim-fade .bp-modal,
.bp-anim-fade .bp-float { animation-name: bpFadeIn; }
.bp-anim-slide-up .bp-modal,
.bp-anim-slide-up .bp-float { animation-name: bpSlideUp; }
.bp-anim-zoom .bp-modal,
.bp-anim-zoom .bp-float { animation-name: bpZoomIn; }
.bp-anim-none .bp-modal,
.bp-anim-none .bp-float { animation-name: none; }

@keyframes bpFadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes bpSlideUp { from { opacity: 0; transform: translateY(24px); } to { opacity: 1; transform: none; } }
@keyframes bpZoomIn { from { opacity: 0; transform: scale(.96); } to { opacity: 1; transform: none; } }

body.bp-no-scroll {
  overflow: hidden;
}

.bp-root :focus-visible {
  outline: 2px solid var(--bp-accent);
  outline-offset: 2px;
}

/* ------------------------------------------------------------------ */
/* Responsive                                                         */
/* ------------------------------------------------------------------ */

@media (max-width: 767.98px) {
  .bp-hide-mobile { display: none !important; }

  .bp-modal--media-left,
  .bp-modal--media-right {
    flex-direction: column;
  }

  .bp-modal--media-left .bp-modal__media,
  .bp-modal--media-right .bp-modal__media {
    order: 0;
    max-height: 200px;
  }

  .bp-modal--media-left .bp-modal__body,
  .bp-modal--media-right .bp-modal__body {
    order: 1;
  }

  .bp-img--desktop { display: none; }
  .bp-img--mobile { display: block; }

  .bp-title { font-size: 20px; }

  .bp-actions .bp-btn { width: 100%; }

  .bp-float { width: calc(100vw - 32px); }
}

@media (min-width: 768px) {
  .bp-hide-desktop { display: none !important; }
}

@media (prefers-reduced-motion: reduce) {
  .bp-root *,
  .bp-root *::before,
  .bp-root *::after {
    animation: none !important;
    transition: none !important;
  }
}
