/* Offers & popups from the dashboard (store/offers.php, store.js): the popup window, the top bar, and the banners on the
   home page, a category's books page and the bag. Logical properties only, so one file serves Arabic and English.
   Everything stays hidden until store.js shows it (device, trigger, frequency). */

.dt-offer[hidden] { display: none !important; }
.dt-offer-wrap:has(> .dt-offer[hidden]) { display: none; }

/* ---------- shared pieces ---------- */
.dt-offer-kicker { display: inline-flex; align-items: center; gap: 8px; font-size: 11.5px; font-weight: 800; letter-spacing: .06em; color: #8F7520; }
.dt-offer-kicker::before, .dt-offer-kicker::after { content: ""; width: 18px; height: 1px; background: linear-gradient(90deg, transparent, #BA9B32); }
.dt-offer-kicker::after { transform: scaleX(-1); }
.dt-offer-seal { display: inline-grid; place-items: center; flex-shrink: 0; width: 56px; height: 56px; border-radius: 50%; background: radial-gradient(circle at 30% 25%, #FAF0CD, #E0C76C 45%, #BA9B32 100%); color: #00382b; font-size: 22px; box-shadow: 0 0 0 4px rgba(224, 199, 108, .25), 0 10px 22px -8px rgba(0, 0, 0, .45); }
.dt-offer-code { display: inline-flex; align-items: center; justify-content: center; gap: 10px; padding: 9px 14px; border: 1.5px dashed #BA9B32; border-radius: 12px; background: #FFFCF0; color: #6b5200; font: inherit; font-size: 12.5px; font-weight: 700; cursor: pointer; transition: background .2s, border-color .2s; }
.dt-offer-code strong { font-size: 15px; font-weight: 900; letter-spacing: .12em; color: #00382b; font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; }
.dt-offer-code i { color: #8F7520; }
.dt-offer-code:hover { background: #FAF0CD; border-color: #8F7520; }
.dt-offer-code.is-copied { border-style: solid; border-color: #0f6b45; background: #e6f5ee; }
.dt-offer-code.is-copied i::before { content: "\f00c"; font-weight: 900; font-family: "Font Awesome 6 Free"; color: #0f6b45; }
.dt-offer-cta { display: inline-flex; align-items: center; justify-content: center; gap: 10px; min-height: 48px; padding: 0 22px; border: 0; border-radius: 14px; background: linear-gradient(135deg, #005943, #00382b); color: #fff; font: inherit; font-size: 15px; font-weight: 800; text-decoration: none; cursor: pointer; box-shadow: 0 10px 22px -10px rgba(0, 56, 43, .65), inset 0 1px 0 rgba(255, 255, 255, .12); transition: transform .2s var(--ease, ease), box-shadow .2s; }
.dt-offer-cta i { color: #E0C76C; font-size: 13px; transition: transform .2s; }
.dt-offer-cta:hover { transform: translateY(-1px); box-shadow: 0 14px 26px -10px rgba(0, 56, 43, .75); color: #fff; }
.dt-offer-cta:hover i { transform: translateX(3px); }
[dir="rtl"] .dt-offer-cta:hover i { transform: translateX(-3px); }
.dt-offer-x { position: absolute; top: 12px; inset-inline-end: 12px; z-index: 2; display: grid; place-items: center; width: 36px; height: 36px; border: 0; border-radius: 50%; background: rgba(255, 255, 255, .92); color: #00241B; font-size: 16px; cursor: pointer; box-shadow: 0 4px 12px rgba(0, 0, 0, .18); transition: transform .2s, background .2s; }
.dt-offer-x:hover { background: #fff; transform: rotate(90deg); }
.dt-offer-x:focus-visible, .dt-offer-cta:focus-visible, .dt-offer-code:focus-visible, .dt-offer-later:focus-visible { outline: 2px solid #BA9B32; outline-offset: 2px; }

/* ---------- popup: a centred card on computers, a bottom sheet on phones ---------- */
.dt-offer-popup { position: fixed; inset: 0; z-index: 10040; display: grid; place-items: center; padding: 20px; }
.dt-offer-mask { position: absolute; inset: 0; background: rgba(0, 20, 15, .58); -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px); opacity: 0; transition: opacity .35s; }
.dt-offer-card { position: relative; width: min(440px, 100%); max-height: calc(100dvh - 40px); overflow: auto; overscroll-behavior: contain; border-radius: 24px; background: #FFFDF7; box-shadow: 0 30px 70px -20px rgba(0, 0, 0, .55), 0 0 0 1px rgba(186, 155, 50, .35); text-align: center; opacity: 0; transform: translateY(18px) scale(.97); transition: opacity .35s var(--ease, ease), transform .45s var(--ease, ease); }
.dt-offer-popup.is-open .dt-offer-mask { opacity: 1; }
.dt-offer-popup.is-open .dt-offer-card { opacity: 1; transform: none; }
.dt-offer-art { position: relative; display: grid; place-items: center; height: 150px; background: radial-gradient(120% 90% at 50% 0%, #0a6b52 0%, #00473a 55%, #00241B 100%); overflow: hidden; }
.dt-offer-art::before { content: ""; position: absolute; inset: 0; background-image: var(--orn-khatam); background-size: 64px; background-position: center; opacity: .12; }
.dt-offer-art::after { content: ""; position: absolute; inset-inline: 0; bottom: 0; height: 3px; background: linear-gradient(90deg, transparent, #E0C76C, #FAF0CD, #E0C76C, transparent); }
.dt-offer-art img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.dt-offer-art.has-img { height: 190px; }
.dt-offer-art.has-img .dt-offer-seal { position: absolute; bottom: -28px; }
.dt-offer-art .dt-offer-seal { position: relative; width: 72px; height: 72px; font-size: 28px; }
.dt-offer-content { display: flex; flex-direction: column; align-items: stretch; gap: 12px; padding: 22px 26px 18px; }
.dt-offer-art.has-img + .dt-offer-content { padding-top: 38px; }
.dt-offer-content .dt-offer-kicker { align-self: center; }
.dt-offer-content h3 { margin: 0; font-size: 23px; line-height: 1.4; font-weight: 900; color: #00382b; }
.dt-offer-content p { margin: 0; font-size: 14.5px; line-height: 1.85; color: #4B635A; }
.dt-offer-content .dt-offer-code { margin-top: 2px; }
.dt-offer-later { align-self: center; padding: 6px 10px; border: 0; background: none; color: #6f7f78; font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; text-decoration: underline; text-decoration-color: rgba(111, 127, 120, .4); text-underline-offset: 4px; }
.dt-offer-later:hover { color: #00241B; }

@media (max-width: 560px) {
  .dt-offer-popup { place-items: end stretch; padding: 0; }
  .dt-offer-card { width: 100%; max-height: calc(100dvh - 48px); border-radius: 24px 24px 0 0; padding-bottom: env(safe-area-inset-bottom, 0px); transform: translateY(100%); transition: opacity .2s, transform .45s var(--ease, ease); }
  .dt-offer-card::before { content: ""; position: absolute; top: 8px; left: 50%; z-index: 2; width: 40px; height: 4px; margin-left: -20px; border-radius: 4px; background: rgba(255, 255, 255, .55); }
  .dt-offer-art { height: 118px; }
  .dt-offer-art.has-img { height: 160px; }
  .dt-offer-art .dt-offer-seal { width: 62px; height: 62px; font-size: 24px; }
  .dt-offer-content { gap: 10px; padding: 18px 18px 12px; }
  .dt-offer-content h3 { font-size: 20px; }
  .dt-offer-content p { font-size: 14px; line-height: 1.75; }
  .dt-offer-cta { min-height: 50px; }
}

/* ---------- top bar: above the announcement bar ---------- */
.dt-offer-bar { position: relative; background: linear-gradient(90deg, #BA9B32, #E0C76C 30%, #FAF0CD 50%, #E0C76C 70%, #BA9B32); color: #241a00; }
.dt-offer-bar-in { display: flex; align-items: center; justify-content: center; gap: 10px 14px; min-height: 42px; padding-block: 6px; padding-inline-end: 44px; flex-wrap: wrap; }
.dt-offer-bar-text { display: inline-flex; align-items: center; gap: 8px; min-width: 0; font-size: 13.5px; line-height: 1.5; text-align: center; }
.dt-offer-bar-text i { color: #00473a; }
.dt-offer-bar-text strong { font-weight: 900; color: #00241B; }
.dt-offer-bar-text span { font-weight: 600; }
.dt-offer-bar .dt-offer-code { padding: 3px 10px; border-radius: 8px; background: rgba(255, 255, 255, .65); border-color: #8F7520; font-size: 11.5px; gap: 6px; }
.dt-offer-bar .dt-offer-code strong { font-size: 13px; }
.dt-offer-bar .dt-offer-cta { min-height: 30px; padding: 0 14px; border-radius: 999px; font-size: 12.5px; box-shadow: none; }
.dt-offer-bar .dt-offer-x { top: 50%; inset-inline-end: 8px; width: 28px; height: 28px; margin-top: -14px; font-size: 13px; background: rgba(255, 255, 255, .5); box-shadow: none; }
.dt-offer-bar .dt-offer-x:hover { background: rgba(255, 255, 255, .85); }
.dt-offer-bar:not(:has(.dt-offer-x)) .dt-offer-bar-in { padding-inline-end: 0; }
@media (max-width: 640px) {
  .dt-offer-bar-in { gap: 6px 10px; padding-block: 7px; padding-inline-start: 14px; }
  .dt-offer-bar-text { font-size: 12.5px; flex-wrap: wrap; justify-content: center; gap: 2px 6px; }
  .dt-offer-bar-text span { font-size: 12px; }
  .dt-offer-bar .dt-offer-cta { min-height: 28px; padding: 0 12px; font-size: 12px; }
}

/* ---------- banners: home page, category page, bag page, bag drawer ---------- */
.dt-offer-wrap { padding-block: 26px 4px; }
.dt-offer-banner { position: relative; display: flex; align-items: center; gap: 22px; padding: 24px 28px; border-radius: 22px; overflow: hidden; background: radial-gradient(130% 160% at 0% 0%, #0a6b52 0%, #00473a 45%, #00241B 100%); color: #FAF0CD; box-shadow: 0 18px 40px -22px rgba(0, 36, 27, .7), inset 0 0 0 1px rgba(224, 199, 108, .28); }
.dt-offer-banner::before { content: ""; position: absolute; inset-block: 0; inset-inline-end: 0; width: 46%; background-image: var(--orn-khatam); background-size: 70px; opacity: .08; pointer-events: none; -webkit-mask-image: linear-gradient(90deg, transparent, #000); mask-image: linear-gradient(90deg, transparent, #000); }
[dir="rtl"] .dt-offer-banner::before { -webkit-mask-image: linear-gradient(270deg, transparent, #000); mask-image: linear-gradient(270deg, transparent, #000); }
.dt-offer-banner .dt-offer-text { position: relative; flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.dt-offer-banner .dt-offer-kicker { color: #E0C76C; }
.dt-offer-banner .dt-offer-kicker::before, .dt-offer-banner .dt-offer-kicker::after { background: linear-gradient(90deg, transparent, #E0C76C); }
.dt-offer-banner h3 { margin: 0; font-size: 22px; line-height: 1.45; font-weight: 900; color: #fff; }
.dt-offer-banner p { margin: 0; font-size: 14px; line-height: 1.8; color: rgba(250, 240, 205, .85); }
.dt-offer-actions { position: relative; display: flex; align-items: center; gap: 12px; flex-shrink: 0; flex-wrap: wrap; justify-content: flex-end; }
.dt-offer-banner .dt-offer-code { background: rgba(255, 255, 255, .06); border-color: rgba(224, 199, 108, .7); color: #FAF0CD; }
.dt-offer-banner .dt-offer-code strong { color: #fff; }
.dt-offer-banner .dt-offer-code i { color: #E0C76C; }
.dt-offer-banner .dt-offer-code:hover { background: rgba(255, 255, 255, .12); }
.dt-offer-banner .dt-offer-cta { background: linear-gradient(135deg, #FAF0CD, #E0C76C 55%, #BA9B32); color: #00241B; box-shadow: 0 10px 22px -12px rgba(0, 0, 0, .6); }
.dt-offer-banner .dt-offer-cta i { color: #00473a; }
.dt-offer-banner .dt-offer-x { top: 10px; inset-inline-end: 10px; width: 30px; height: 30px; font-size: 13px; background: rgba(255, 255, 255, .12); color: #FAF0CD; box-shadow: none; }
.dt-offer-banner .dt-offer-x:hover { background: rgba(255, 255, 255, .22); }
.dt-offer-banner:has(.dt-offer-x) { padding-inline-end: 52px; }

.dt-offer-at-category { margin-bottom: 18px; }
.dt-offer-at-cart { margin-bottom: 18px; }
/* in the bag drawer: a compact card among the bag's cards */
.dt-offer-at-bag { flex-direction: column; align-items: stretch; gap: 12px; padding: 16px 18px; border-radius: 18px; margin-bottom: 12px; }
.dt-offer-at-bag .dt-offer-seal { display: none; }
.dt-offer-at-bag h3 { font-size: 16px; }
.dt-offer-at-bag p { font-size: 13px; line-height: 1.7; }
.dt-offer-at-bag .dt-offer-actions { justify-content: stretch; gap: 8px; }
.dt-offer-at-bag .dt-offer-actions > * { flex: 1 1 auto; }
.dt-offer-at-bag .dt-offer-cta { min-height: 42px; font-size: 14px; }

@media (max-width: 768px) {
  .dt-offer-wrap { padding-block: 18px 0; }
  .dt-offer-banner { flex-direction: column; align-items: stretch; gap: 14px; padding: 20px 18px; border-radius: 18px; text-align: start; }
  .dt-offer-banner:has(.dt-offer-x) { padding-inline-end: 18px; }
  .dt-offer-banner:has(.dt-offer-x) .dt-offer-text { padding-inline-end: 34px; }
  .dt-offer-banner .dt-offer-seal { width: 46px; height: 46px; font-size: 18px; }
  .dt-offer-banner h3 { font-size: 18px; }
  .dt-offer-banner p { font-size: 13.5px; }
  .dt-offer-actions { flex-direction: column; align-items: stretch; }
  .dt-offer-actions > * { width: 100%; }
  .dt-offer-banner:not(.dt-offer-at-bag) .dt-offer-seal { position: absolute; top: 18px; inset-inline-end: 18px; }
  .dt-offer-banner:not(.dt-offer-at-bag):has(.dt-offer-x) .dt-offer-seal { display: none; }
  .dt-offer-banner:not(.dt-offer-at-bag):not(:has(.dt-offer-x)) .dt-offer-text { padding-inline-end: 58px; }
}

@media (prefers-reduced-motion: reduce) {
  .dt-offer-card, .dt-offer-mask, .dt-offer-cta, .dt-offer-x { transition: none; }
}
