/* ---------- Stores (data/merchants.json): small wave carousel, «مشاهده همه» grid, MDP ---------- */
:root { --ap-cashback: #5b3fd6; --ap-cashback-soft: #efeaff; }

/* Carousel: small square cards; every other card sits a little lower, so the row reads like a gentle wave. */
.ap-section--stores .ap-swiper > .swiper-wrapper { padding-bottom: 14px; }
/* Room above the cards inside the rail's clip box, so the hover lift and its shadow never cut off at the top. */
.ap-section--stores .ap-swiper { margin-top: -22px; padding-top: 22px; }
.ap-swiper .ap-slide--store { width: clamp(118px, calc((100vw - 64px) / 2.9), 140px); }
.ap-slide--store:nth-child(even) > .ap-store { transform: translateY(12px); }
.ap-store {
  position: relative; display: flex; flex-direction: column; gap: 8px; color: var(--ap-ink); text-decoration: none;
  transition: transform 420ms var(--ap-ease);
}
.ap-store__media {
  position: relative; display: block; aspect-ratio: 1; border-radius: 22px; overflow: visible; isolation: isolate;
}
.ap-store__media > img {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; border-radius: inherit; background: var(--ap-media);
  box-shadow: 0 10px 22px -14px #1b1235aa; transition: transform 600ms var(--ap-ease), filter 600ms ease;
}
.ap-store__media::after { /* soft light sweep on hover / first view */
  content: ''; position: absolute; inset: 0; z-index: 1; border-radius: inherit; pointer-events: none;
  background: linear-gradient(115deg, #fff0 35%, #ffffff59 50%, #fff0 65%) -160% 0 / 250% 100% no-repeat;
}
.ap-store__logo {
  position: absolute; z-index: 2; bottom: -10px; right: 10px; display: grid; place-items: center; width: 36px; height: 36px;
  border-radius: 12px; background: #fff; box-shadow: 0 0 0 3px #fff, 0 6px 14px -6px #1d243366; overflow: hidden;
}
.ap-store__logo img { width: 100%; height: 100%; object-fit: contain; padding: 4px; }
.ap-store__cashback { position: absolute; z-index: 2; top: 8px; left: 8px; font-size: .5625rem; line-height: 1.9; box-shadow: 0 2px 8px -2px #1b123540; }
.ap-store__body { display: grid; gap: 2px; padding: 8px 4px 0; }
.ap-store__name { overflow: hidden; font-size: .8125rem; font-weight: 700; line-height: 1.6; white-space: nowrap; text-overflow: ellipsis; }
.ap-store__channel { display: inline-flex; align-items: center; gap: 3px; color: var(--ap-muted); font-size: .625rem; line-height: 1.6; white-space: nowrap; }
.ap-store__channel svg { width: 11px; height: 11px; flex: none; }
.ap-store__channel--instore, .ap-store__channel--both { color: var(--ap-instore); }
.ap-store:active .ap-store__media > img { transform: scale(.97); }
@media (hover: hover) and (pointer: fine) {
  .ap-store:hover .ap-store__media > img { transform: translateY(-3px) rotate(-.8deg) scale(1.02); filter: saturate(1.08); }
  .ap-store:hover .ap-store__media::after { background-position: 160% 0; transition: background-position 900ms var(--ap-ease); }
}
.ap-store:focus-visible { outline: none; }
.ap-store:focus-visible .ap-store__media > img { box-shadow: 0 0 0 3px var(--ap-brand); }

/* «مشاهده همه» card at the end: a fanned stack of the next logos + count. */
.ap-swiper .ap-slide--store.ap-slide--after { width: clamp(118px, calc((100vw - 64px) / 2.9), 140px); }
.ap-store-more {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; aspect-ratio: 1; align-self: flex-start;
  border-radius: 22px; background: linear-gradient(160deg, var(--ap-cashback-soft), #fff 70%); border: 1px dashed #cfc4ff;
  color: var(--ap-ink); text-decoration: none; text-align: center;
}
.ap-store-more__stack { position: relative; width: 74px; height: 34px; margin-bottom: 4px; }
.ap-store-more__logo {
  position: absolute; top: 0; right: calc(var(--k) * 20px); width: 34px; height: 34px; border-radius: 11px; background: #fff; overflow: hidden;
  box-shadow: 0 0 0 2px #fff, 0 4px 10px -4px #1d243355; transform: rotate(calc((var(--k) - 1) * 8deg));
}
.ap-store-more__logo img { width: 100%; height: 100%; object-fit: contain; padding: 3px; }
.ap-store-more__count { color: var(--ap-cashback); font-size: 1rem; font-weight: 800; line-height: 1.2; }
.ap-store-more__label { color: var(--ap-muted); font-size: .625rem; }
.ap-store-more__cta { display: inline-flex; align-items: center; gap: 2px; margin-top: 2px; color: var(--ap-link); font-size: .6875rem; font-weight: 700; }
.ap-store-more__cta svg { width: 14px; height: 14px; }
.ap-skeleton--store { width: clamp(118px, calc((100vw - 64px) / 2.9), 140px); aspect-ratio: 1; border-radius: 22px; }

/* ---------- «مشاهده همه» panel: tall cards like the cashback landing ---------- */
.ap-store-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin: 0; padding: 0; list-style: none; }
.ap-store-grid > li { min-width: 0; }
.ap-store-tile {
  position: relative; display: block; aspect-ratio: 624 / 1024; border-radius: var(--ap-radius-l); overflow: hidden; isolation: isolate;
  background: var(--ap-media); color: #fff; text-decoration: none; box-shadow: var(--ap-elev-1);
  transition: transform 320ms var(--ap-ease), box-shadow 320ms var(--ap-ease);
}
.ap-store-tile__media, .ap-store-tile__media img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.ap-store-tile__media::after { content: ''; position: absolute; inset: 40% 0 0; background: linear-gradient(#0000, #000000b8); }
.ap-store-tile__info { position: absolute; z-index: 1; inset: auto 10px 10px; display: grid; justify-items: start; gap: 2px; }
.ap-store-tile__logo { width: 40px; height: 40px; margin-bottom: 4px; border-radius: 12px; background: #fff; overflow: hidden; }
.ap-store-tile__logo img { width: 100%; height: 100%; object-fit: contain; padding: 4px; }
.ap-store-tile__name { font-size: 1rem; font-weight: 800; line-height: 1.5; text-shadow: 0 1px 6px #0006; }
.ap-store-tile__channel { font-size: .75rem; opacity: .92; }
.ap-store-tile__cashback { margin-top: 6px; font-size: .6875rem; line-height: 2; background: #fff; }
.ap-store-tile:active { transform: scale(.985); }
@media (hover: hover) and (pointer: fine) { .ap-store-tile:hover { transform: translateY(-3px); box-shadow: var(--ap-elev-2); } }

/* ---------- MDP ---------- */
.ap-mdp { display: grid; gap: 14px; }
.ap-mdp__cover { position: relative; margin: -4px calc(-1 * var(--ap-gutter)) 0; aspect-ratio: 4 / 3; overflow: hidden; background: var(--ap-media); }
.ap-mdp__cover img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 30%; }
.ap-mdp__card {
  position: relative; z-index: 1; display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 4px 12px;
  margin-top: -48px; padding: 14px; border-radius: var(--ap-radius-l); background: #fff; box-shadow: var(--ap-elev-2);
}
.ap-mdp__logo { grid-row: span 2; width: 60px; height: 60px; border-radius: 16px; overflow: hidden; background: #fff; box-shadow: 0 0 0 1px var(--ap-line); }
.ap-mdp__logo img { width: 100%; height: 100%; object-fit: contain; padding: 6px; }
.ap-mdp__title h2 { margin: 0; font-size: 1.125rem; line-height: 1.6; }
.ap-mdp__chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 2px; }
.ap-mdp__chip { display: inline-flex; align-items: center; gap: 4px; padding: 1px 8px; border-radius: 999px; background: var(--ap-surface); color: var(--ap-muted); font-size: .6875rem; line-height: 1.9; }
.ap-mdp__chip svg { width: 13px; height: 13px; }
.ap-mdp__cashback { grid-column: 2; justify-self: start; font-size: .75rem; line-height: 2; }
.ap-mdp__online { display: grid; gap: 8px; padding: 14px; border-radius: var(--ap-radius-l); background: var(--ap-brand-soft); }
.ap-mdp__online p { margin: 0; color: var(--ap-muted); font-size: .75rem; }
.ap-mdp__site {
  display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 0 16px; border-radius: 14px;
  background: var(--ap-brand); color: #fff; font-weight: 700; font-size: .875rem; text-decoration: none;
  transition: background 200ms ease, transform 200ms var(--ap-ease);
}
.ap-mdp__site svg { width: 18px; height: 18px; }
.ap-mdp__site:hover { background: var(--ap-brand-strong); }
.ap-mdp__site:active { transform: scale(.98); }
.ap-mdp__heading { display: flex; align-items: center; gap: 8px; margin: 6px 0 4px; font-size: 1rem; }
.ap-mdp__heading span { padding: 0 8px; border-radius: 999px; background: var(--ap-instore-soft); color: var(--ap-instore); font-size: .75rem; line-height: 1.8; }
.ap-branches { display: grid; gap: 10px; margin: 0; padding: 0; list-style: none; }
.ap-branch { display: grid; gap: 8px; padding: 12px; border: 1px solid var(--ap-line); border-radius: var(--ap-radius-m); background: #fff; }
.ap-branch__head { display: flex; gap: 10px; align-items: flex-start; }
.ap-branch__pin { display: grid; place-items: center; width: 32px; height: 32px; flex: none; border-radius: 10px; background: var(--ap-instore-soft); color: var(--ap-instore); }
.ap-branch__pin svg { width: 18px; height: 18px; }
.ap-branch__name { margin: 0; font-size: .875rem; line-height: 1.6; }
.ap-branch__meta { margin: 0; color: var(--ap-muted); font-size: .6875rem; }
.ap-branch__address { margin: 0; color: var(--ap-ink); font-size: .75rem; line-height: 1.9; }
.ap-branch__hours summary { display: inline-flex; align-items: center; gap: 4px; color: var(--ap-muted); font-size: .6875rem; cursor: pointer; list-style: none; }
.ap-branch__hours summary::-webkit-details-marker { display: none; }
.ap-branch__hours svg { width: 13px; height: 13px; }
.ap-branch__hours p { margin: 4px 0 0; font-size: .75rem; }
.ap-branch__actions { display: flex; gap: 8px; }
.ap-branch__action {
  display: inline-flex; flex: 1; align-items: center; justify-content: center; gap: 6px; min-height: 40px; border-radius: 12px;
  border: 1px solid var(--ap-line); background: #fff; color: var(--ap-ink); font-size: .8125rem; font-weight: 700; text-decoration: none;
}
.ap-branch__action svg { width: 17px; height: 17px; }
.ap-branch__action--primary { border-color: transparent; background: var(--ap-instore); color: #fff; }
.ap-branches__more { width: 100%; min-height: 44px; margin-top: 10px; border: 1px dashed var(--ap-line); border-radius: 12px; background: var(--ap-surface); color: var(--ap-link); font: inherit; font-size: .8125rem; font-weight: 700; cursor: pointer; }

@media (min-width: 768px) {
  .ap-swiper .ap-slide--store, .ap-swiper .ap-slide--store.ap-slide--after, .ap-skeleton--store { width: calc((min(100vw, var(--ap-page-width)) - 2 * var(--ap-gutter) - 6 * 16px) / 6.6); }
  .ap-store__name { font-size: .875rem; }
  .ap-store-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
  .ap-mdp__cover { margin-inline: 0; aspect-ratio: 2 / 1; border-radius: var(--ap-radius-l); }
  .ap-mdp__card { margin-inline: 16px; }
}
@media (min-width: 1024px) {
  .ap-swiper .ap-slide--store, .ap-swiper .ap-slide--store.ap-slide--after, .ap-skeleton--store { width: calc((min(100vw, var(--ap-page-width)) - 2 * var(--ap-gutter) - 7 * 20px) / 7.6); }
}
@media (prefers-reduced-motion: reduce) {
  .ap-store, .ap-store__media > img, .ap-store-tile { transition: none; }
  .ap-slide--store:nth-child(even) > .ap-store { transform: none; }
}
