/* ---------- Product card (SnappPay anatomy): picture, 4-installment strip over its edge, store, title, prices ---------- */
.ap-product {
  position: relative; display: flex; flex-direction: column; width: 100%; min-width: 0; padding: 6px;
  border: 1px solid var(--ap-line); border-radius: 20px; background: #fff; box-shadow: var(--ap-elev-1);
  color: var(--ap-ink); text-decoration: none;
  transition: transform 300ms var(--ap-ease), box-shadow 300ms var(--ap-ease), border-color 300ms ease;
}
.ap-product__media { position: relative; aspect-ratio: 1; border-radius: 16px; overflow: hidden; background: var(--ap-media); }
.ap-product__media > img { width: 100%; height: 100%; padding: 6%; object-fit: contain; mix-blend-mode: multiply; transition: transform 500ms var(--ap-ease); }
.ap-product__cashback, .ap-store__cashback, .ap-store-tile__cashback, .ap-mdp__cashback {
  display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px 2px 5px; border-radius: 999px;
  background: #f1edff; color: #5f4aff; font-weight: 700; white-space: nowrap; direction: rtl;
}
.ap-product__cashback img, .ap-store__cashback img, .ap-store-tile__cashback img, .ap-mdp__cashback img { order: 1; width: 14px; height: 14px; flex: none; }
.ap-product__cashback { position: absolute; z-index: 1; top: 7px; right: 7px; font-size: .625rem; line-height: 1.8; box-shadow: 0 1px 4px #2a1b8a14; }
.ap-grid__more { grid-column: 1 / -1; height: 1px; }
/* The 4-installment strip sits over the picture's bottom edge, in the hero art's sunny. */
.ap-product__installment {
  position: relative; z-index: 1; display: flex; align-items: center; justify-content: space-between; gap: 6px;
  margin: -16px 6px 0; padding: 6px 10px; border-radius: 12px; background: #fff7e6; box-shadow: 0 0 0 3px #fff;
  color: var(--ap-accent); font-size: .6875rem; line-height: 1.6; white-space: nowrap;
}
.ap-product__installment-badge { font-weight: 800; }
.ap-product__installment-amount { display: inline-flex; align-items: baseline; gap: 3px; font-weight: 800; color: #9a4a06; }
.ap-product__installment-amount small { color: #a64b05; font-size: .5625rem; font-weight: 400; }
.ap-product__body { display: flex; flex: 1; flex-direction: column; min-width: 0; padding: 10px 6px 4px; }
.ap-product__merchant { display: flex; align-items: center; gap: 5px; min-width: 0; min-height: 20px; margin-bottom: 4px;
  color: var(--ap-muted); font-size: .625rem; line-height: 1.8; }
.ap-product__merchant > span:last-child { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.ap-product__logo { flex: 0 0 18px; width: 18px; height: 18px; border-radius: 5px; overflow: hidden; background: #fff; }
.ap-product__logo img { width: 100%; height: 100%; object-fit: cover; }
.ap-product__title {
  margin-bottom: 8px; font-size: .75rem; font-weight: 700; line-height: 1.75; height: 3.5em;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere;
}
.ap-product__prices { display: flex; flex-direction: column; justify-content: flex-end; gap: 2px; min-height: 44px; margin-top: auto; }
.ap-product__was { display: flex; align-items: center; gap: 6px; min-height: 18px; color: var(--ap-subtle); font-size: .625rem; }
.ap-product__off { display: inline-flex; justify-content: center; min-width: 30px; padding: 0 6px; border-radius: 7px;
  background: #e7254b; color: #fff; font-size: .625rem; font-weight: 800; line-height: 1.9; }
.ap-product__price { display: flex; align-items: baseline; gap: 4px; font-size: .9375rem; font-weight: 800; white-space: nowrap; }
.ap-product__price small { color: var(--ap-muted); font-size: .625rem; font-weight: 400; }
.ap-product__pending { font-size: .75rem; color: var(--ap-brand-ink); }
a.ap-product:active { transform: scale(.98); }
@media (hover: hover) and (pointer: fine) {
  a.ap-product:hover { transform: translateY(-4px); box-shadow: var(--ap-elev-2); border-color: #e3e8ef; }
  a.ap-product:hover .ap-product__media > img { transform: scale(1.05); }
}

/* ---------- List (search results) ---------- */
.ap-list { display: grid; gap: 10px; }

/* ---------- Brand tile (ایرانی / خارجی) ---------- */
.ap-brand-tile {
  display: flex; flex-direction: column; overflow: hidden; height: 100%;
  border: 1px solid var(--ap-line); border-radius: var(--ap-radius-l); background: #fff; box-shadow: var(--ap-elev-1);
  color: var(--ap-ink); text-decoration: none; transition: transform 300ms var(--ap-ease), box-shadow 300ms var(--ap-ease);
}
.ap-brand-tile__media { aspect-ratio: 1301 / 1367; overflow: hidden; }
.ap-brand-tile__media img { width: 100%; height: 100%; object-fit: cover; transition: transform 600ms var(--ap-ease); }
.ap-brand-tile__body { display: flex; align-items: center; justify-content: space-between; gap: 6px; min-height: 48px; padding: 8px 12px; }
.ap-brand-tile__title { font-size: .875rem; font-weight: 700; }
.ap-brand-tile__go { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: var(--ap-surface); color: var(--ap-ink); }
.ap-brand-tile__go svg { width: 16px; height: 16px; }
.ap-brand-tile:active { transform: scale(.98); }
@media (hover: hover) and (pointer: fine) {
  .ap-brand-tile:hover { transform: translateY(-4px); box-shadow: var(--ap-elev-2); }
  .ap-brand-tile:hover .ap-brand-tile__media img { transform: scale(1.04); }
}

/* ---------- Coupon ---------- */
.ap-coupon {
  position: relative; display: flex; flex-direction: column; width: 100%; overflow: hidden;
  border: 1px solid var(--ap-line); border-radius: var(--ap-radius-l); background: #fff; box-shadow: var(--ap-elev-1);
}
.ap-coupon__top { position: relative; }
.ap-coupon__art { aspect-ratio: 1080 / 400; }
.ap-coupon__art img { width: 100%; height: 100%; object-fit: cover; }
.ap-coupon__logo { position: absolute; top: 10px; right: 10px; width: 40px; height: 40px; padding: 3px; border-radius: 12px;
  background: #fff; overflow: hidden; box-shadow: 0 2px 8px #172b4d1a; }
.ap-coupon__logo img { width: 100%; height: 100%; object-fit: contain; }
.ap-coupon__value { position: absolute; left: 10px; bottom: 10px; padding: 3px 10px; border-radius: 10px;
  background: var(--ap-danger); color: #fff; font-size: .6875rem; font-weight: 700; }
.ap-coupon__body { position: relative; display: flex; flex: 1; flex-direction: column; gap: 6px; padding: 12px 12px 10px; }
.ap-coupon__title { font-size: .8125rem; font-weight: 700; line-height: 1.7; }
.ap-coupon__terms { display: flex; flex-wrap: wrap; gap: 0 10px; color: var(--ap-muted); font-size: .6875rem; line-height: 1.8; }
.ap-coupon__terms span + span::before { content: '•'; margin-inline-end: 10px; color: #c3cad6; }
.ap-coupon__code {
  display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 46px; margin-top: 4px; padding: 6px 12px;
  border: 1.5px dashed #9fd0f7; border-radius: var(--ap-radius-s); background: var(--ap-brand-soft); color: var(--ap-brand-ink);
}
.ap-coupon__code code { font: 700 .9375rem/1 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; letter-spacing: .08em; color: var(--ap-ink); }
.ap-coupon__copy { display: inline-flex; align-items: center; gap: 4px; font-size: .75rem; font-weight: 700; }
.ap-coupon__copy svg { width: 16px; height: 16px; }
.ap-coupon__code.is-copied { border-style: solid; border-color: #9ad8b5; background: #ecf9f1; color: var(--ap-success); }
.ap-coupon__foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 44px; margin-top: auto; }
.ap-coupon__expiry { display: inline-flex; align-items: center; gap: 4px; color: var(--ap-subtle); font-size: .6875rem; }
.ap-coupon__expiry svg { width: 14px; height: 14px; }
.ap-coupon__shop { display: inline-flex; align-items: center; gap: 2px; min-height: 44px; margin-inline-start: auto;
  color: var(--ap-link); font-size: .75rem; text-decoration: none; }
.ap-coupon__shop svg { width: 16px; height: 16px; }
