/* Base (desktop/tablet) */
.bottom-popup {
  position: fixed;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  bottom: 20px;
  width: min(680px, calc(100% - 32px));
  background: #fff;
  color: #000;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.12);
  padding: 16px 56px 16px 16px;
  z-index: 9999;
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s ease, transform .25s ease;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
}

/* Stato visibile */
.bottom-popup.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
  pointer-events: auto;
}

/* Pulsante X (desktop default) */
.popup-close {
  position: absolute;
  top: 8px;
  right: 10px;
  border: none;
  background: transparent;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  color: #111;
}

/* Contenuto */
.popup-content {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
}

.popup-text {
  margin: 0;
  flex: 1 1 auto;
  font-size: 15px;
}

/* Pulsante azione */
.popup-btn {
  flex: 0 0 auto;
  border: 1px solid #111;
  background: #111;
  color: #fff;
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 14px;
  cursor: pointer;
}
.popup-btn:hover { filter: brightness(1.05); }

/* 🎯 Mobile: bottom sheet full-width */
@media (max-width: 640px) {
  .bottom-popup {
    left: 0;
    right: 0;
    bottom: max(8px, env(safe-area-inset-bottom)); /* spazio per notch */
    transform: translateX(0) translateY(12px);
    margin: 0 8px;
    width: auto;
    border-radius: 12px;
    padding: 14px 14px 14px 14px;
  }
  .bottom-popup.show {
    transform: translateX(0) translateY(0);
  }

  /* Layout verticale, testo sopra, bottone sotto */
  .popup-content {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }
  .popup-text {
    font-size: 16px;
    line-height: 1.35;
  }
  .popup-btn {
    width: 100%;
    padding: 14px 16px;
    font-size: 16px;
    border-radius: 12px;
  }

  /* X più grande con area clic ampia (min 44x44) */
  .popup-close {
    top: 6px;
    right: 6px;
    font-size: 24px;
    padding: 12px;
    line-height: 1;
  }
}

/* Accessibilità: riduci animazioni se richiesto */
@media (prefers-reduced-motion: reduce) {
  .bottom-popup {
    transition: none;
  }
}
