.wpet-widget {
  --wpet-radius: 14px;
  background-color: transparent;
}

.wpet-card {
  border-radius: 18px !important;
  border: 0 !important;
  background: #fff !important;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08) !important;
  overflow: hidden !important;
  transition: transform 0.2s ease, box-shadow 0.2s ease !important;
}

.wpet-card:hover {
  transform: translateY(-4px) !important;
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.12) !important;
}

.wpet-events-row .btn-primary {
  background: var(--wpet-primary) !important;
  border-color: var(--wpet-primary) !important;
}

.wpet-btn-submit {
  background: var(--wpet-popup-btn-bg, #212529) !important;
  border-color: var(--wpet-popup-btn-bg, #212529) !important;
  color: var(--wpet-popup-btn-text, #fff) !important;
  border-radius: 12px !important;
  font-weight: 600 !important;
  padding: 0.85rem 1rem !important;
}

.wpet-modal-content .modal-header {
  border-bottom: 0 !important;
}

.wpet-soldout-badge {
  font-weight: 800;
  background: #dc3545;
  color: #fff;
  border-radius: 999px;
  padding: 6px 12px;
  display: inline-block;
}

/* Card evento orizzontale (stile Bootstrap-like) */
.wpet-event-card {
  border: none;
  border-radius: 18px !important;
  overflow: hidden;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  background: var(--wpet-card-bg, #fff);
}

.wpet-event-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.12);
}

.wpet-event-media {
  background: #f3f4f6;
}

.wpet-event-img {
  width: 100%;
  height: 240px;
  object-fit: cover;
  min-height: 240px;
  display: block;
}

.wpet-event-img-placeholder {
  width: 100%;
  height: 240px;
  min-height: 240px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #6c757d;
  font-size: 14px;
  padding: 16px;
  text-align: center;
}

.wpet-event-card-body {
  padding: 1.5rem 1.5rem;
  display: flex;
  flex-direction: column;
}

.wpet-event-title {
  font-weight: 800;
  font-size: var(--wpet-card-title-size, 1.25rem);
  color: var(--wpet-card-title-color, #212529);
  margin-bottom: 10px;
}

.wpet-event-date {
  font-size: 0.95rem;
  color: #6c757d;
}

.wpet-event-description {
  font-size: var(--wpet-card-text-size, 0.98rem);
  color: var(--wpet-card-desc-color, #495057);
  line-height: 1.45;
  margin-top: 10px;
  margin-bottom: 12px;
}

.wpet-event-footer {
  gap: 12px;
}

.wpet-event-badges-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.wpet-event-chip {
  display: inline-flex;
  align-items: center;
  padding: 6px 10px;
  border-radius: 999px;
  background: var(--wpet-card-chip-bg, #f1f3f5);
  color: var(--wpet-card-chip-text, #495057);
  font-size: 0.85rem;
  font-weight: 600;
}

.wpet-event-chip-price {
  background: color-mix(in srgb, var(--wpet-card-price-color, #198754) 14%, #ffffff);
  color: var(--wpet-card-price-color, #198754);
}

.wpet-event-price {
  font-size: 1.3rem;
  font-weight: 800;
  color: var(--wpet-card-price-color, #198754);
}

.wpet-event-availability {
  font-size: 0.95rem;
  color: #6c757d;
}

.wpet-btn-ticket {
  border-radius: 12px !important;
  font-weight: 700 !important;
  padding: 12px 14px !important;
  background: var(--wpet-card-btn-bg, #212529) !important;
  border: 1px solid var(--wpet-card-btn-bg, #212529) !important;
  color: var(--wpet-card-btn-text, #fff) !important;
}

/* Lista eventi con card orizzontali */
.wpet-event-list-item {
  margin-bottom: 16px;
}

.wpet-card-inner {
  display: flex;
  flex-direction: row;
  align-items: stretch;
}

.wpet-card-media {
  flex: 0 0 220px;
  background: #f3f4f6;
  position: relative;
}

.wpet-image-price-badge {
  position: absolute;
  top: 12px;
  left: 12px;
  z-index: 3;
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 10px 15px;
  background: rgba(255, 255, 255, 0.95);
  border: 1px solid rgba(0, 0, 0, 0.06);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.14);
  color: var(--wpet-popup-price-color, var(--wpet-card-price-color, #198754));
  font-weight: 900;
  font-size: 1.2rem;
  line-height: 1.2;
  max-width: calc(100% - 24px);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  backdrop-filter: blur(3px);
}

.wpet-event-image {
  width: 100%;
  height: 100%;
  min-height: 170px;
  object-fit: cover;
  display: block;
}

.wpet-event-image-placeholder {
  width: 100%;
  height: 220px;
  min-height: 220px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #6b7280;
  font-size: 14px;
  padding: 0;
  border-radius: 14px;
  overflow: hidden;
  background: transparent;
  position: relative;
}

.wpet-card-body {
  flex: 1 1 auto;
  padding: 18px 18px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.wpet-card-top-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.wpet-card-info {
  min-width: 0;
}

.wpet-card-title {
  font-size: 1.1rem;
  font-weight: 800;
  color: #212529;
  margin-bottom: 6px;
}

.wpet-card-date {
  font-size: 0.95rem;
  color: #6c757d;
  margin-bottom: 10px;
}

.wpet-card-short-desc,
.wpet-card-short-desc {
  color: #495057;
  font-size: 0.98rem;
  line-height: 1.45;
  margin-top: 6px;
}

.wpet-card-action {
  flex: 0 0 auto;
  display: flex;
  align-items: flex-start;
}

.wpet-card-bottom-row {
  margin-top: 12px;
}

.wpet-card-price-availability {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 18px;
  align-items: center;
}

.wpet-card-price {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--wpet-primary, #2271b1);
}

.wpet-card-availability {
  font-size: 0.95rem;
  color: #6c757d;
}

/* coesione dei pulsanti e pillole */
.wpet-btn-open,
.btn-primary,
.btn-outline-primary {
  border-radius: 12px !important;
  font-weight: 700 !important;
  padding: 0.7rem 1rem !important;
}

.badge.bg-danger.wpet-soldout-badge,
.wpet-soldout-badge {
  background: #dc3545;
  color: #fff;
  border: 1px solid rgba(0, 0, 0, 0.08);
}

/* Layout responsivo popup (solo per il modal del widget). */
.wpet-modal-dialog {
  width: 100%;
  max-width: 920px;
}

.wpet-modal-content {
  border: none;
  border-radius: 20px;
  overflow: hidden;
  box-shadow: 0 18px 45px rgba(0, 0, 0, 0.12);
  background: var(--wpet-popup-bg, #fff);
}

/*
 * Isolamento dal tema: tipografia, label e campi nel popup usano le variabili del plugin.
 * Specificità elevata + !important dove i temi sovrascrivono spesso .modal / .form-control.
 */
.wpet-modal .wpet-modal-content,
.wpet-modal .wpet-modal-content .modal-body {
  font-family: var(--wpet-font-body, system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif) !important;
  color: #212529 !important;
}

.wpet-modal .wpet-modal-content .wpet-modal-heading,
.wpet-modal .wpet-modal-content .modal-title {
  font-family: var(--wpet-font-heading, var(--wpet-font-body, system-ui, sans-serif)) !important;
  font-size: var(--wpet-popup-title-size, 1.25rem) !important;
  font-weight: 700 !important;
  color: var(--wpet-popup-title-color, #212529) !important;
  line-height: 1.25 !important;
}

.wpet-modal .wpet-modal-content .event-title {
  font-family: var(--wpet-font-heading, var(--wpet-font-body, system-ui, sans-serif)) !important;
}

.wpet-modal .wpet-modal-content .wpet-form-label,
.wpet-modal .wpet-modal-content label.form-label {
  font-family: var(--wpet-font-body, system-ui, sans-serif) !important;
  font-size: var(--wpet-popup-text-size, 0.95rem) !important;
  font-weight: 600 !important;
  color: var(--wpet-popup-title-color, #212529) !important;
  margin-bottom: 0.35rem !important;
}

.wpet-modal .wpet-modal-content .wpet-section-title,
.wpet-modal .wpet-modal-content .section-title {
  font-family: var(--wpet-font-heading, var(--wpet-font-body, sans-serif)) !important;
  font-size: 1rem !important;
  font-weight: 600 !important;
  color: var(--wpet-popup-title-color, #212529) !important;
}

.wpet-modal .wpet-modal-content .wpet-form-input,
.wpet-modal .wpet-modal-content input.form-control,
.wpet-modal .wpet-modal-content textarea.form-control {
  font-family: var(--wpet-font-body, system-ui, sans-serif) !important;
  font-size: 1rem !important;
  line-height: 1.5 !important;
  color: #212529 !important;
  background-color: #fff !important;
  background-image: none !important;
  border: 1px solid #ced4da !important;
  border-radius: 10px !important;
  padding: 0.6rem 0.85rem !important;
  box-shadow: none !important;
  -webkit-appearance: none;
  appearance: none;
}

.wpet-modal .wpet-modal-content .wpet-form-input:focus,
.wpet-modal .wpet-modal-content input.form-control:focus,
.wpet-modal .wpet-modal-content textarea.form-control:focus {
  color: #212529 !important;
  background-color: #fff !important;
  border-color: #86b7fe !important;
  outline: 0 !important;
  box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.2) !important;
}

.wpet-modal .wpet-modal-content .wpet-form-input::placeholder {
  color: #6c757d !important;
  opacity: 1 !important;
}

.wpet-modal .wpet-modal-content .form-check-label {
  font-family: var(--wpet-font-body, system-ui, sans-serif) !important;
  font-size: var(--wpet-popup-text-size, 0.95rem) !important;
  color: var(--wpet-popup-title-color, #212529) !important;
}

.wpet-modal .wpet-modal-content .wpet-popup-event-desc,
.wpet-modal .wpet-modal-content .wpet-popup-event-desc p,
.wpet-modal .wpet-modal-content .wpet-popup-event-desc li,
.wpet-modal .wpet-modal-content .wpet-popup-event-desc a {
  font-family: var(--wpet-font-body, system-ui, sans-serif) !important;
  font-size: var(--wpet-popup-text-size, 0.95rem) !important;
  line-height: 1.55 !important;
  color: var(--wpet-popup-desc-color, #6c757d) !important;
}

.wpet-modal .wpet-modal-content .wpet-popup-event-desc a {
  text-decoration: underline;
}

.wpet-modal .wpet-modal-content .wpet-slot-info-text {
  font-family: var(--wpet-font-body, system-ui, sans-serif) !important;
  color: var(--wpet-popup-meta-color, #6c757d) !important;
}

.wpet-modal .wpet-modal-content .wpet-status {
  font-family: var(--wpet-font-body, system-ui, sans-serif) !important;
  font-size: var(--wpet-popup-text-size, 0.95rem) !important;
}

/* Modal: comportamento coerente su mobile (no "start from center", scroll interno). */
.wpet-modal .modal-dialog {
  margin-left: auto;
  margin-right: auto;
}

.wpet-modal .modal-content {
  max-height: calc(100dvh - 2rem);
}

.wpet-modal .modal-body {
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}

.wpet-event-full-desc {
  font-size: var(--wpet-popup-text-size, 0.95rem);
  color: var(--wpet-popup-desc-color, #6c757d);
  margin-bottom: 0;
}

.wpet-event-image-placeholder {
  width: 100%;
  height: 220px;
  border-radius: 14px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #6c757d;
  background: transparent;
  position: relative;
}

.wpet-event-image-placeholder img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: none;
}

/* Popup: stile "come il tuo esempio" */
.event-image {
  width: 100%;
  height: 220px;
  border-radius: 14px;
  overflow: hidden;
}

.event-title {
  font-size: var(--wpet-popup-title-size, 1.4rem);
  font-weight: 700;
  color: var(--wpet-popup-title-color, #212529);
  margin-bottom: 0.5rem;
}

.event-meta {
  color: var(--wpet-popup-meta-color, #6c757d);
  font-size: var(--wpet-popup-text-size, 0.95rem);
  margin-bottom: 0.4rem;
}

.event-price {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--wpet-popup-price-color, #198754);
  margin-bottom: 0.75rem;
}

/* Popup: allineato alla riga badge della card */
.wpet-modal .modal-body .wpet-event-badges-row {
  margin-bottom: 0.75rem;
}

.wpet-modal .modal-body .wpet-event-chip {
  background: var(--wpet-popup-chip-bg, #f1f3f5);
  color: var(--wpet-popup-chip-text, #495057);
}

.section-title {
  font-weight: 600;
  margin-bottom: 0.75rem;
  font-size: 1rem;
}

.payment-box {
  border: 1px solid var(--wpet-popup-payment-box-border, #dee2e6);
  border-radius: 12px;
  padding: 0.9rem 1rem;
  background: var(--wpet-popup-payment-box-bg, #fff);
  transition: all 0.2s ease;
}

.payment-box:hover {
  border-color: #adb5bd;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.04);
}

.payment-logos img {
  height: 24px;
  width: auto;
  object-fit: contain;
}

.wpet-slot-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.wpet-slot-pill {
  border: 1px solid var(--wpet-popup-payment-box-border, #dee2e6);
  background: var(--wpet-popup-slot-bg, #fff);
  color: var(--wpet-popup-slot-text, #495057);
  border-radius: 12px;
  padding: 10px 12px;
  min-width: 110px;
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 2px;
  transition: all 0.2s ease;
  position: relative;
  overflow: hidden;
}

.wpet-slot-pill:hover {
  border-color: #adb5bd;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.04);
}

.wpet-slot-pill.is-active {
  border-color: var(--wpet-popup-slot-active-bg, #212529);
  background: var(--wpet-popup-slot-active-bg, #212529);
  color: var(--wpet-popup-slot-active-text, #fff);
}

.wpet-slot-pill.is-disabled {
  opacity: 1;
  cursor: not-allowed;
}

.wpet-slot-pill.is-disabled::before {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(255, 255, 255, 0.38);
  backdrop-filter: blur(1px);
  z-index: 1;
}

.wpet-slot-pill.is-disabled::after {
  content: "ESAURITO";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
  font-size: 0.74rem;
  line-height: 1;
  font-weight: 800;
  letter-spacing: 0.1em;
  color: #dc3545;
  text-shadow: 0 1px 2px rgba(255, 255, 255, 0.55);
  z-index: 2;
}

.wpet-slot-pill.is-disabled .wpet-slot-time {
  filter: blur(0.35px);
  opacity: 0.75;
}

.wpet-slot-time {
  font-weight: 700;
  font-size: 0.95rem;
}

.wpet-slot-info {
  color: var(--wpet-popup-meta-color, #6c757d);
}

.wpet-qty-wrap {
  margin-bottom: 1rem;
}

.wpet-qty-stepper {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--wpet-popup-payment-box-border, #dee2e6);
  border-radius: 12px;
  overflow: hidden;
  background: var(--wpet-popup-slot-bg, #fff);
}

.wpet-qty-btn {
  width: 44px;
  height: 44px;
  border: 0 !important;
  background: transparent !important;
  color: var(--wpet-popup-title-color, #212529) !important;
  font-size: 1.35rem !important;
  font-weight: 700 !important;
  line-height: 1 !important;
  cursor: pointer;
  padding: 0 !important;
  border-radius: 0 !important;
  box-shadow: none !important;
}

.wpet-qty-btn:hover:not(:disabled) {
  background: rgba(0, 0, 0, 0.04);
}

.wpet-qty-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.wpet-qty-value {
  min-width: 48px;
  text-align: center;
  font-weight: 800;
  font-size: 1.15rem;
  color: var(--wpet-popup-title-color, #212529);
  user-select: none;
}

.wpet-qty-hint {
  color: var(--wpet-popup-meta-color, #6c757d);
}

.wpet-qty-total {
  font-weight: 800;
  color: var(--wpet-popup-price-color, var(--wpet-card-price-color, #198754));
  font-size: 0.98rem;
}

.wpet-offer-wrap .wpet-offer-amount {
  max-width: 220px;
}

.wpet-offer-hint {
  color: var(--wpet-popup-meta-color, #6c757d);
}

.wpet-onsite-note .payment-box {
  background: color-mix(in srgb, var(--wpet-popup-price-color, #198754) 8%, #ffffff);
}

.wpet-single-order-wrap .wpet-qty-stepper {
  border-color: #dee2e6;
}

.wpet-slot-rem {
  font-size: 0.82rem;
  color: var(--wpet-popup-meta-color, #6c757d);
}

.wpet-slot-pill.is-active .wpet-slot-rem {
  color: color-mix(in srgb, var(--wpet-popup-slot-active-text, #fff) 85%, transparent);
}

.btn-buy {
  border-radius: 12px;
  font-weight: 600;
  padding: 0.85rem 1rem;
}

@media (max-width: 576px) {
  .wpet-modal-dialog {
    max-width: calc(100vw - 24px) !important;
  }

  /* Su mobile è meglio partire dall'alto: evita l'effetto "centrato" e migliora lo scroll. */
  .wpet-modal .modal-dialog-centered {
    align-items: flex-start;
    min-height: calc(100% - 24px);
  }

  .wpet-modal .modal-dialog {
    margin: 12px auto;
  }

  .wpet-modal .modal-content {
    max-height: calc(100dvh - 24px);
  }

  /* Evita testi/descrizioni troppo lunghi che rovinano l'UI su mobile. */
  .wpet-event-full-desc {
    max-height: 42vh;
  }

  .wpet-event-image-placeholder {
    height: 150px;
    min-height: 150px;
  }

  .wpet-card-inner {
    flex-direction: column;
  }

  .wpet-card-media {
    flex: 0 0 auto;
  }

  .wpet-event-image,
  .wpet-event-image-placeholder {
    height: 150px;
    min-height: 150px;
  }

  .wpet-card-body {
    padding: 14px 14px;
  }

  /* Spazio tra blocco testi (titolo/descrizione) e pulsanti: usa gap così non si rompe mt-auto. */
  .wpet-event-card-body.d-flex.flex-column {
    gap: 0.85rem;
  }
}

