/* ==========================================================================
   MVMP Community Deals — listing tiles, pop-out, and the submit form.
   Uses the theme's design tokens when present (--mvmp-*) and falls back to
   sensible light values, so it also works with any other theme.
   ========================================================================== */
.mvmp-deals, .mvmp-deals-form {
  --d-primary: var(--mvmp-primary, #15803d);
  --d-ink:     var(--mvmp-ink, #0f172a);
  --d-muted:   var(--mvmp-muted, #64748b);
  --d-border:  var(--mvmp-border, #e2e8f0);
  --d-card:    var(--mvmp-card-bg, #ffffff);
  --d-bg:      var(--mvmp-bg, #f8fafc);
  --d-danger:  #dc2626;
  color: var(--d-ink);
  max-width: 1180px; margin: 0 auto; padding: 24px 16px 48px;
  box-sizing: border-box;
}
.mvmp-deals *, .mvmp-deals-form * { box-sizing: border-box; }
.mvmp-deals [hidden], .mvmp-deals-form [hidden], .mvmp-deal-modal[hidden] { display: none !important; }

/* ---------- buttons ---------- */
.mvmp-df-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 11px 20px; border-radius: 12px; border: 1.5px solid transparent; cursor: pointer;
  font: inherit; font-weight: 800; text-decoration: none; line-height: 1.2;
}
.mvmp-df-btn--primary { background: var(--d-primary); color: #fff; }
.mvmp-df-btn--primary:hover { filter: brightness(1.08); }
.mvmp-df-btn--primary[disabled] { opacity: .6; cursor: progress; }
.mvmp-df-btn--ghost { background: transparent; color: var(--d-primary); border-color: var(--d-primary); }
.mvmp-df-btn--ghost[disabled] { opacity: .45; cursor: not-allowed; }

/* ==========================================================================
   LISTING
   ========================================================================== */
.mvmp-deals__hero { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }
.mvmp-deals__hero h2 { margin: 0 0 4px; font-size: clamp(1.5rem, 3vw, 2rem); font-weight: 900; letter-spacing: -.01em; }
.mvmp-deals__hero p { margin: 0; color: var(--d-muted); max-width: 52ch; }

.mvmp-deals__tabs { display: flex; gap: 6px; border-bottom: 1px solid var(--d-border); margin-bottom: 14px; overflow-x: auto; }
.mvmp-deals__tab {
  background: none; border: 0; border-bottom: 3px solid transparent; padding: 10px 14px; cursor: pointer;
  font: inherit; font-weight: 700; color: var(--d-muted); white-space: nowrap;
}
.mvmp-deals__tab span { margin-left: 4px; font-size: .78rem; background: var(--d-border); color: var(--d-ink); border-radius: 999px; padding: 1px 8px; }
.mvmp-deals__tab.is-on { color: var(--d-primary); border-bottom-color: var(--d-primary); }
.mvmp-deals__tab.is-on span { background: var(--d-primary); color: #fff; }

.mvmp-deals__filters { display: grid; grid-template-columns: minmax(180px, 2fr) repeat(auto-fit, minmax(130px, 1fr)); gap: 10px; margin-bottom: 12px; }
.mvmp-deals__filters input, .mvmp-deals__filters select,
.mvmp-deals-form input[type="text"], .mvmp-deals-form input[type="number"], .mvmp-deals-form input[type="date"],
.mvmp-deals-form select, .mvmp-deals-form textarea {
  width: 100%; padding: 10px 12px; border: 1px solid var(--d-border); border-radius: 10px;
  background: var(--d-card); color: var(--d-ink); font: inherit; min-width: 0;
}
.mvmp-deals-form input[type="file"] { width: 100%; font: inherit; color: var(--d-ink); }
.mvmp-deals__filters input:focus, .mvmp-deals__filters select:focus,
.mvmp-deals-form input:focus, .mvmp-deals-form select:focus, .mvmp-deals-form textarea:focus {
  outline: 2px solid var(--d-primary); outline-offset: 1px;
}

.mvmp-deals__chips { display: flex; gap: 8px; overflow-x: auto; padding: 2px 0 12px; margin-bottom: 6px; }
.mvmp-deals__chip {
  flex: 0 0 auto; padding: 6px 14px; border-radius: 999px; border: 1px solid var(--d-border);
  background: var(--d-card); color: var(--d-ink); font: inherit; font-size: .85rem; font-weight: 700; cursor: pointer;
}
.mvmp-deals__chip.is-on { background: var(--d-ink); color: var(--d-card); border-color: var(--d-ink); }

.mvmp-deals__grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(215px, 1fr)); gap: 16px; }
.mvmp-deals__empty { text-align: center; color: var(--d-muted); padding: 40px 0; }

/* ---------- flyer tile ---------- */
.mvmp-deal-card {
  --tile: hsl(var(--h, 140) 70% 40%);
  position: relative; display: flex; flex-direction: column; overflow: hidden; cursor: pointer;
  background: var(--d-card); border: 1px solid var(--d-border); border-radius: 18px;
  transition: transform .15s ease, box-shadow .15s ease;
}
.mvmp-deal-card:hover, .mvmp-deal-card:focus-visible { transform: translateY(-3px); box-shadow: 0 10px 24px rgba(15, 23, 42, .14); outline: none; }
.mvmp-deal-card:focus-visible { box-shadow: 0 0 0 3px var(--d-primary); }
.mvmp-deal-card__media { position: relative; aspect-ratio: 4 / 3; display: flex; align-items: center; justify-content: center; overflow: hidden;
  background: linear-gradient(135deg, hsl(var(--h, 140) 70% 38%), hsl(calc(var(--h, 140) + 35) 78% 52%)); }
.mvmp-deal-card__media img { width: 100%; height: 100%; object-fit: cover; display: block; }
.mvmp-deal-card__badge {
  position: absolute; top: 10px; left: 10px; background: var(--tile); color: #fff; font-weight: 900; font-size: .8rem;
  letter-spacing: .02em; padding: 5px 10px; border-radius: 999px; box-shadow: 0 2px 6px rgba(0, 0, 0, .25);
}
.mvmp-deal-card__bigbadge { color: #fff; font-weight: 900; font-size: clamp(1.5rem, 4vw, 2rem); line-height: 1.05; text-align: center; padding: 10px 14px; text-shadow: 0 2px 8px rgba(0, 0, 0, .25); text-transform: uppercase; }
/* perforated "coupon" edge between picture and text */
.mvmp-deal-card__body { position: relative; padding: 16px 14px 14px; display: flex; flex-direction: column; gap: 3px; flex: 1; border-top: 2px dashed var(--d-border); }
.mvmp-deal-card__body::before, .mvmp-deal-card__body::after {
  content: ""; position: absolute; top: -11px; width: 20px; height: 20px; border-radius: 50%; background: var(--d-bg); border: 1px solid var(--d-border);
}
.mvmp-deal-card__body::before { left: -11px; }
.mvmp-deal-card__body::after  { right: -11px; }
.mvmp-deal-card__store { font-size: .72rem; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; color: var(--tile); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mvmp-deal-card__title { margin: 0; font-size: 1rem; line-height: 1.25; font-weight: 800; }
.mvmp-deal-card__sub { margin: 0; font-size: .8rem; color: var(--d-muted); min-height: 1em; }
.mvmp-deal-card__price { margin: 4px 0 0; font-size: 1.35rem; font-weight: 900; color: var(--d-primary); }
.mvmp-deal-card__price s { font-size: .85rem; font-weight: 600; color: var(--d-muted); margin-left: 6px; }
.mvmp-deal-card__when { margin-top: auto; padding-top: 8px; font-size: .78rem; font-weight: 700; color: var(--d-muted); }
.mvmp-deal-card.is-active .mvmp-deal-card__when { color: var(--d-primary); }
.mvmp-deal-card.is-expired { filter: grayscale(1); opacity: .72; }
.mvmp-deal-card__stamp {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%) rotate(-12deg);
  border: 3px solid var(--d-danger); color: var(--d-danger); background: rgba(255, 255, 255, .88);
  font-weight: 900; letter-spacing: .12em; text-transform: uppercase; padding: 4px 14px; border-radius: 8px; font-size: 1.1rem;
}

/* ---------- pop-out ---------- */
.mvmp-deal-modal-open { overflow: hidden; }
.mvmp-deal-modal { position: fixed; inset: 0; z-index: 99999; display: flex; align-items: center; justify-content: center; padding: 16px; }
.mvmp-deal-modal__overlay { position: absolute; inset: 0; background: rgba(15, 23, 42, .62); backdrop-filter: blur(2px); }
.mvmp-deal-modal__panel {
  position: relative; width: 100%; max-width: 560px; max-height: calc(100vh - 32px); overflow-y: auto; overscroll-behavior: contain;
  background: var(--d-card, #fff); color: var(--d-ink, #0f172a); border-radius: 22px; box-shadow: 0 24px 60px rgba(0, 0, 0, .35); outline: none;
  animation: mvmpDealPop .18s ease-out;
}
@keyframes mvmpDealPop { from { transform: translateY(14px) scale(.98); opacity: 0; } to { transform: none; opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .mvmp-deal-modal__panel { animation: none; } }
.mvmp-deal-modal__top { position: sticky; top: 0; z-index: 3; display: flex; justify-content: flex-end; padding: 10px 12px; background: var(--d-card, #fff); border-bottom: 1px solid var(--d-border, #e2e8f0); }
.mvmp-deal-modal__bottom { display: flex; justify-content: center; padding: 14px 16px 18px; border-top: 1px solid var(--d-border, #e2e8f0); }
.mvmp-deal-modal__close {
  border: 1.5px solid var(--d-border, #cbd5e1); background: var(--d-card, #fff); color: var(--d-ink, #0f172a); font: inherit; font-weight: 800;
  padding: 8px 18px; border-radius: 999px; cursor: pointer;
}
.mvmp-deal-modal__close:hover { background: var(--d-ink, #0f172a); color: var(--d-card, #fff); }
.mvmp-deal-modal__content { padding: 0 20px 20px; }
.mvmp-dm-hero { position: relative; margin: 16px 0 14px; border-radius: 16px; overflow: hidden; background: linear-gradient(135deg, #15803d, #65a30d); min-height: 90px; }
.mvmp-dm-hero img { display: block; width: 100%; max-height: 280px; object-fit: cover; }
.mvmp-dm-badge { position: absolute; left: 12px; bottom: 12px; background: #fff; color: #14532d; font-weight: 900; padding: 7px 14px; border-radius: 999px; box-shadow: 0 3px 10px rgba(0, 0, 0, .3); }
.mvmp-dm-status { display: inline-block; font-size: .75rem; font-weight: 800; padding: 3px 11px; border-radius: 999px; background: #dcfce7; color: #166534; }
.mvmp-dm-status.is-upcoming { background: #dbeafe; color: #1e40af; }
.mvmp-dm-status.is-expired  { background: #fee2e2; color: #991b1b; }
.mvmp-dm-title { margin: 8px 0 2px; font-size: 1.5rem; line-height: 1.2; font-weight: 900; }
.mvmp-dm-sub { margin: 0 0 6px; color: var(--d-muted, #64748b); }
.mvmp-dm-price { margin: 8px 0; font-size: 2rem; font-weight: 900; color: var(--d-primary, #15803d); }
.mvmp-dm-price s { font-size: 1rem; font-weight: 600; color: var(--d-muted, #64748b); margin-left: 8px; }
.mvmp-dm-coupon { display: flex; align-items: center; gap: 10px; margin: 10px 0; padding: 10px 14px; border: 2px dashed var(--d-primary, #15803d); border-radius: 12px; }
.mvmp-dm-coupon span { font-size: .72rem; font-weight: 800; text-transform: uppercase; color: var(--d-muted, #64748b); }
.mvmp-dm-coupon code { flex: 1; font-size: 1.2rem; font-weight: 800; letter-spacing: .08em; background: none; }
.mvmp-dm-copy, button.mvmp-dm-link { border: 1px solid var(--d-border, #cbd5e1); background: var(--d-card, #fff); color: var(--d-ink, #0f172a); border-radius: 8px; padding: 5px 12px; font: inherit; font-size: .82rem; font-weight: 700; cursor: pointer; }
.mvmp-dm-facts { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 12px 0; padding: 12px 14px; background: var(--d-bg, #f8fafc); border-radius: 12px; }
.mvmp-dm-facts dt { color: var(--d-muted, #64748b); font-size: .85rem; }
.mvmp-dm-facts dd { margin: 0; font-weight: 700; }
.mvmp-dm-details { white-space: pre-line; margin: 10px 0; line-height: 1.5; }
.mvmp-dm-where { display: flex; flex-direction: column; gap: 3px; margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--d-border, #e2e8f0); }
.mvmp-dm-where em { color: var(--d-primary, #15803d); font-style: normal; font-weight: 700; font-size: .85rem; }
.mvmp-dm-where span { color: var(--d-muted, #64748b); font-size: .9rem; }
.mvmp-dm-links { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
a.mvmp-dm-link { border: 1px solid var(--d-border, #cbd5e1); border-radius: 8px; padding: 5px 12px; font-size: .82rem; font-weight: 700; color: var(--d-primary, #15803d); text-decoration: none; background: var(--d-card, #fff); }
.mvmp-dm-foot { margin: 14px 0 0; font-size: .8rem; color: var(--d-muted, #64748b); }
.mvmp-dm-disclaimer { margin: 12px 0 0; padding: 10px 12px; border-left: 4px solid #d99a00; border-radius: 8px; background: #fff8e6; color: #5c4300; font-size: .8rem; line-height: 1.45; }
@media (max-width: 560px) {
  .mvmp-deal-modal { padding: 0; align-items: flex-end; }
  .mvmp-deal-modal__panel { max-height: 94vh; border-radius: 22px 22px 0 0; }
}

/* ==========================================================================
   SUBMIT FORM
   ========================================================================== */
.mvmp-deals-form { max-width: 760px; }
.mvmp-deals-form__head h2 { margin: 0 0 6px; font-size: 1.7rem; font-weight: 900; }
.mvmp-deals-form__head p { margin: 0 0 18px; color: var(--d-muted); }
.mvmp-deals-step { background: var(--d-card); border: 1px solid var(--d-border); border-radius: 18px; padding: 18px; margin-bottom: 16px; }
.mvmp-deals-step__title { display: flex; align-items: center; gap: 10px; margin: 0 0 14px; font-size: 1.05rem; font-weight: 800; }
.mvmp-deals-step__title span { display: inline-flex; width: 26px; height: 26px; align-items: center; justify-content: center; border-radius: 50%; background: var(--d-primary); color: #fff; font-size: .85rem; }
.mvmp-deals-step__title em { font-style: normal; font-weight: 600; color: var(--d-muted); }

.mvmp-df-field { margin-bottom: 12px; min-width: 0; }
.mvmp-df-field > label, .mvmp-df-field label { display: block; font-weight: 700; font-size: .9rem; }
.mvmp-df-field label > input, .mvmp-df-field label > select, .mvmp-df-field label > textarea { margin-top: 5px; font-weight: 400; }
.mvmp-df-field .req { color: var(--d-danger); }
.mvmp-df-field .opt { font-weight: 400; color: var(--d-muted); font-size: .8rem; }
.mvmp-df-hint { margin: 5px 0 0; font-size: .8rem; color: var(--d-muted); }
.mvmp-df-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.mvmp-df-numbers { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
@media (max-width: 520px) { .mvmp-df-row, .mvmp-df-numbers { grid-template-columns: 1fr; } }
.mvmp-df-check { display: flex; align-items: center; gap: 10px; margin: 2px 0 12px; font-weight: 600; cursor: pointer; }
.mvmp-df-check input { width: 18px; height: 18px; }

/* Store address (Google Places element) — always white, even in dark mode */
.mvmp-deals-form gmp-place-autocomplete {
  color-scheme: light; background: #fff; color: #1f2937; border: 1px solid #cbd5e1; border-radius: 10px;
  --gmp-mat-color-surface: #ffffff; --gmp-mat-color-on-surface: #1f2937; --gmp-mat-color-on-surface-variant: #475569;
  --gmp-mat-color-outline-decorative: #cbd5e1; --gmp-mat-color-outline: #94a3b8;
}
#df_store_name { background: var(--d-bg); }

.mvmp-df-item { position: relative; border: 1px solid var(--d-border); border-left: 4px solid var(--d-primary); border-radius: 14px; padding: 14px; margin-bottom: 14px; background: var(--d-bg); }
.mvmp-df-item__bar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.mvmp-df-item__remove { border: 0; background: none; color: var(--d-muted); font-size: 1.6rem; line-height: 1; cursor: pointer; padding: 0 6px; }
.mvmp-df-item__remove:hover { color: var(--d-danger); }

.mvmp-df-error { margin-top: 5px; padding: 6px 10px; font-size: .82rem; font-weight: 600; color: #b91c1c; background: #fef2f2; border-left: 3px solid var(--d-danger); border-radius: 6px; }
.mvmp-df-invalid, .mvmp-df-invalid:focus { border-color: var(--d-danger) !important; background: #fef2f2 !important; box-shadow: 0 0 0 3px rgba(220, 38, 38, .18) !important; outline: none !important; }
.mvmp-df-field--invalid > label { color: #b91c1c; }

.mvmp-df-submit { text-align: center; margin-top: 6px; }
.mvmp-df-notices { margin-top: 16px; }
.mvmp-df-notice { padding: 12px 16px; border-radius: 12px; border-left: 4px solid; }
.mvmp-df-notice p { margin: 0; }
.mvmp-df-notice--error   { background: #fef2f2; border-color: var(--d-danger); color: #7f1d1d; }
.mvmp-df-notice--success { background: #f0fdf4; border-color: #16a34a; color: #14532d; }
.mvmp-df-notice--info    { background: #eff6ff; border-color: #2563eb; color: #1e3a8a; }
.mvmp-deals-notice { max-width: 520px; margin: 40px auto; padding: 14px 18px; border-radius: 12px; background: #eff6ff; border-left: 4px solid #2563eb; color: #1e3a8a; }
.mvmp-deals-notice p { margin: 0; }
