/* Product form (ADR-0041): layout with a sticky live preview, media library modal, preview window picker. */
.dsp-layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: 1.5rem; }
@media (min-width: 1280px) { .dsp-layout { grid-template-columns: minmax(0, 1fr) 400px; } }
.dsp-layout > * { min-width: 0; }

[x-cloak] { display: none !important; }
.dsp-muted { color: var(--gray-500); font-size: .8rem; }
.dsp-bad { color: var(--danger-600); font-size: .8rem; font-weight: 600; }
.dsp-link { color: var(--primary-600); text-decoration: underline; font-size: .8rem; margin-inline-start: .5rem; }
.dsp-btn { display: inline-flex; align-items: center; gap: .3rem; padding: .35rem .75rem; border-radius: .5rem; font-size: .8rem; font-weight: 600;
    border: 1px solid var(--gray-300); background: #fff; color: var(--gray-800); cursor: pointer; }
.dsp-btn:hover { background: var(--gray-50); }
.dsp-btn:disabled { opacity: .45; cursor: not-allowed; }
.dsp-btn--primary { background: var(--primary-600); border-color: var(--primary-600); color: #fff; }
.dsp-btn--primary:hover { background: var(--primary-500); }
.dsp-input { flex: 1; padding: .4rem .7rem; border-radius: .5rem; border: 1px solid var(--gray-300); background: #fff; font-size: .875rem; }
.dsp-chip { padding: .15rem .6rem; border-radius: 999px; font-size: .75rem; border: 1px solid var(--gray-300); background: #fff; color: var(--gray-700); }
.dsp-chip.is-on { background: var(--primary-600); border-color: var(--primary-600); color: #fff; }
.dsp-langs { display: flex; gap: .3rem; flex-wrap: wrap; }
.dark .dsp-btn, .dark .dsp-input, .dark .dsp-chip:not(.is-on) { background: var(--gray-900); border-color: var(--gray-700); color: var(--gray-200); }
.dark .dsp-btn--primary { background: var(--primary-600); color: #fff; }

/* Sticky live preview */
.dsp-preview { position: sticky; top: 4.5rem; max-height: calc(100vh - 5.5rem); display: flex; flex-direction: column; border-radius: .9rem;
    border: 1px solid var(--gray-200); background: #fff; box-shadow: 0 1px 2px rgb(0 0 0 / .05); overflow: hidden; }
.dark .dsp-preview { background: var(--gray-900); border-color: var(--gray-700); }
.dsp-preview__bar { display: flex; flex-direction: column; gap: .5rem; padding: .75rem .9rem; border-bottom: 1px solid var(--gray-200); }
.dark .dsp-preview__bar { border-color: var(--gray-700); }
.dsp-preview__toggle { display: flex; justify-content: space-between; align-items: center; font-weight: 700; font-size: .9rem; width: 100%; }
.dsp-dirty { color: var(--warning-600); font-size: .75rem; font-weight: 600; }
.dsp-preview__scroll { overflow-y: auto; padding: .9rem; }
.dsp-preview__h { font-size: .75rem; font-weight: 700; color: var(--gray-500); margin: 1rem 0 .4rem; text-transform: uppercase; }
.dsp-preview__note { margin-top: .8rem; }
@media (max-width: 1279px) { .dsp-preview { position: static; max-height: none; } }

.dsp-checks { display: grid; gap: .2rem; }
.dsp-checks button { display: flex; align-items: center; gap: .5rem; width: 100%; text-align: start; padding: .3rem .5rem; border-radius: .4rem; font-size: .8rem; }
.dsp-checks button:hover { background: var(--gray-100); }
.dark .dsp-checks button:hover { background: var(--gray-800); }
.dsp-checks small { margin-inline-start: auto; color: var(--gray-500); font-size: .72rem; }
.dsp-checks__mark { width: 1.2rem; height: 1.2rem; border-radius: 999px; display: inline-flex; align-items: center; justify-content: center;
    font-size: .7rem; background: var(--gray-200); color: var(--gray-600); flex-shrink: 0; }
.dsp-checks .is-ok .dsp-checks__mark { background: var(--success-600); color: #fff; }
.dsp-checks .is-warn .dsp-checks__mark { background: var(--warning-500); color: #fff; }
.dsp-checks .is-warn small { color: var(--warning-600); }

.dsp-card { border: 1px solid var(--gray-200); border-radius: .8rem; overflow: hidden; max-width: 220px; }
.dark .dsp-card { border-color: var(--gray-700); }
.dsp-card__img { position: relative; aspect-ratio: 3 / 4; background: var(--gray-100); display: flex; align-items: center; justify-content: center; font-size: 2rem; }
.dark .dsp-card__img { background: var(--gray-800); }
.dsp-card__img img { width: 100%; height: 100%; object-fit: cover; }
.dsp-card__type, .dsp-card__status { position: absolute; top: .4rem; font-size: .65rem; padding: .1rem .45rem; border-radius: 999px; background: rgb(0 0 0 / .6); color: #fff; }
.dsp-card__type { inset-inline-start: .4rem; }
.dsp-card__status { inset-inline-end: .4rem; }
.dsp-card__body { display: grid; gap: .2rem; padding: .6rem; font-size: .85rem; }
.dsp-price { font-weight: 700; color: var(--primary-600); }
.dsp-price small { color: var(--gray-500); font-weight: 500; }

.dsp-page { border: 1px solid var(--gray-200); border-radius: .8rem; overflow: hidden; }
.dark .dsp-page { border-color: var(--gray-700); }
.dsp-hero { position: relative; min-height: 120px; height: 200px; background: linear-gradient(135deg, var(--gray-700), var(--gray-900)); overflow: hidden; }
.dsp-hero img { position: absolute; inset: 0; width: 100%; height: 100%; }
.dsp-hero__text { position: absolute; inset: 0; display: flex; flex-direction: column; padding: .9rem; color: #fff; gap: .2rem;
    background: linear-gradient(to top, rgb(0 0 0 / .65), transparent 70%); }
.dsp-hero__text h3 { font-size: 1.15rem; font-weight: 800; }
.dsp-hero__text p { font-size: .8rem; opacity: .9; }
.dsp-hero__sub { font-weight: 600; }
/* Long texts over the cover scroll inside it instead of being cut off; the page header under the cover
   is used when "show text over the cover" is off, so the preview always shows every text. */
.dsp-hero__text { overflow-y: auto; white-space: pre-line; }
.dsp-hero__text > * { flex-shrink: 0; }
.dsp-headline { padding: .8rem .9rem 0; display: grid; gap: .25rem; white-space: pre-line; }
.dsp-headline h3 { font-size: 1.15rem; font-weight: 800; }
.dsp-headline p { font-size: .85rem; }
.dsp-hero__text.is-v-top { justify-content: flex-start; } .dsp-hero__text.is-v-center { justify-content: center; } .dsp-hero__text.is-v-bottom { justify-content: flex-end; }
.dsp-hero__text.is-h-right { align-items: flex-start; } .dsp-hero__text.is-h-center { align-items: center; text-align: center; } .dsp-hero__text.is-h-left { align-items: flex-end; }
[dir="ltr"] .dsp-hero__text.is-h-right { align-items: flex-end; } [dir="ltr"] .dsp-hero__text.is-h-left { align-items: flex-start; }
.dsp-meta { display: flex; flex-wrap: wrap; gap: .4rem; padding: .6rem .9rem 0; }
.dsp-meta span { font-size: .72rem; padding: .1rem .5rem; border-radius: 999px; background: var(--gray-100); }
.dark .dsp-meta span { background: var(--gray-800); }
.dsp-desc { padding: .6rem .9rem 0; font-size: .82rem; white-space: pre-line; }
.dsp-buy { display: flex; align-items: center; justify-content: space-between; padding: .7rem .9rem; }
.dsp-buy button { padding: .35rem 1rem; border-radius: .5rem; background: var(--primary-600); color: #fff; font-size: .8rem; font-weight: 700; opacity: .8; }
.dsp-block { padding: .7rem .9rem; border-top: 1px solid var(--gray-100); display: grid; gap: .45rem; }
.dark .dsp-block { border-color: var(--gray-800); }
.dsp-block h5 { font-size: .82rem; font-weight: 700; display: flex; justify-content: space-between; gap: .5rem; flex-wrap: wrap; }
.dsp-block h5 small { font-weight: 500; color: var(--gray-500); font-size: .7rem; }
.dsp-block audio, .dsp-block video { width: 100%; border-radius: .5rem; }
.dsp-scenes { display: grid; grid-template-columns: repeat(3, 1fr); gap: .4rem; }
.dsp-scene { position: relative; aspect-ratio: 3 / 4; border-radius: .5rem; overflow: hidden; background: var(--gray-200); border: 2px solid transparent; cursor: pointer; }
.dark .dsp-scene { background: var(--gray-800); }
.dsp-scene img { width: 100%; height: 100%; object-fit: cover; }
.dsp-scene:not(.is-free) img { filter: blur(3px) brightness(.6); }
.dsp-scene.is-free { border-color: var(--success-500); }
.dsp-scene:hover { border-color: var(--primary-500); }
.dsp-scene__lock { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 1.2rem; }
.dsp-scene__badge { position: absolute; top: .25rem; inset-inline-start: .25rem; font-size: .62rem; padding: 0 .35rem; border-radius: 999px; background: var(--success-600); color: #fff; }
.dsp-scene__n { position: absolute; bottom: .25rem; inset-inline-end: .3rem; font-size: .65rem; color: #fff; text-shadow: 0 1px 2px #000; }
.dsp-para { font-size: .8rem; line-height: 1.6; padding: .3rem .45rem; border-radius: .4rem; cursor: pointer; border-inline-start: 3px solid transparent; }
.dsp-para:hover { background: var(--gray-50); }
.dark .dsp-para:hover { background: var(--gray-800); }
.dsp-para.is-free { border-color: var(--success-500); }
.dsp-para:not(.is-free) { filter: blur(2.5px); opacity: .55; }
.dsp-para:not(.is-free):hover { filter: none; opacity: .8; }
.dsp-lock { font-size: .78rem; font-weight: 600; color: var(--gray-600); }
.dsp-items { display: grid; gap: .3rem; font-size: .8rem; }
.dsp-items li { display: flex; justify-content: space-between; gap: .5rem; padding: .3rem .5rem; border-radius: .4rem; background: var(--gray-50); }
.dark .dsp-items li { background: var(--gray-800); }

/* Media library picker */
.dsp-picker { display: grid; gap: .6rem; }
.dsp-picker__current { min-height: 2.5rem; display: flex; align-items: center; }
.dsp-picker__chosen { display: flex; align-items: center; gap: .6rem; }
.dsp-picker__thumb { width: 64px; height: 64px; object-fit: cover; border-radius: .5rem; border: 1px solid var(--gray-200); }
.dsp-picker__icon { font-size: 1.8rem; }
.dsp-picker__name { font-size: .85rem; font-weight: 600; word-break: break-all; }
.dsp-picker__empty { font-size: .8rem; color: var(--gray-500); }
.dsp-picker__buttons { display: flex; gap: .4rem; flex-wrap: wrap; }
.dsp-modal { position: fixed; inset: 0; z-index: 60; background: rgb(0 0 0 / .55); display: flex; align-items: center; justify-content: center; padding: 1rem; }
.dsp-modal__box { width: min(860px, 100%); max-height: 88vh; display: flex; flex-direction: column; border-radius: 1rem; background: #fff; color: var(--gray-900); overflow: hidden; }
.dark .dsp-modal__box { background: var(--gray-900); color: var(--gray-100); }
.dsp-modal__head, .dsp-modal__foot, .dsp-modal__search { display: flex; align-items: center; justify-content: space-between; gap: .5rem; padding: .8rem 1rem; }
.dsp-modal__head { border-bottom: 1px solid var(--gray-200); }
.dsp-modal__head h3 { font-weight: 700; }
.dsp-modal__foot { border-top: 1px solid var(--gray-200); flex-wrap: wrap; }
.dark .dsp-modal__head, .dark .dsp-modal__foot { border-color: var(--gray-700); }
.dsp-modal__body { overflow-y: auto; padding: 0 1rem 1rem; min-height: 200px; }
.dsp-modal__pages { display: flex; align-items: center; gap: .5rem; }
.dsp-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: .6rem; }
.dsp-grid__item { display: grid; gap: .2rem; text-align: start; padding: .4rem; border-radius: .6rem; border: 2px solid var(--gray-200); background: transparent; cursor: pointer; }
.dsp-grid__item:hover { border-color: var(--primary-400); }
.dsp-grid__item.is-chosen { border-color: var(--primary-600); box-shadow: 0 0 0 3px color-mix(in oklab, var(--primary-500) 30%, transparent); }
.dark .dsp-grid__item { border-color: var(--gray-700); }
.dsp-grid__item img, .dsp-grid__icon { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: .4rem; background: var(--gray-100); }
.dsp-grid__icon { display: flex; align-items: center; justify-content: center; font-size: 2.2rem; }
.dark .dsp-grid__icon { background: var(--gray-800); }
.dsp-grid__name { font-size: .75rem; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dsp-grid__meta { font-size: .68rem; color: var(--gray-500); }

/* Free preview window picker */
.dsp-window { display: grid; gap: .6rem; padding: .8rem; border-radius: .75rem; border: 1px dashed var(--gray-300); }
.dark .dsp-window { border-color: var(--gray-700); }
.dsp-window__head { display: flex; justify-content: space-between; align-items: center; gap: .5rem; flex-wrap: wrap; font-size: .875rem; }
.dsp-window__player { width: 100%; max-height: 320px; border-radius: .5rem; background: #000; }
audio.dsp-window__player { background: transparent; }
.dsp-timeline { position: relative; height: 18px; margin-top: .5rem; border-radius: 999px; background: var(--gray-200); cursor: pointer; }
.dark .dsp-timeline { background: var(--gray-700); }
.dsp-timeline__seg { position: absolute; top: 0; bottom: 0; border-radius: 999px; background: var(--success-500); opacity: .85; }
.dsp-timeline__seg.is-bad { background: var(--danger-500); }
.dsp-timeline__head { position: absolute; top: -3px; bottom: -3px; width: 3px; border-radius: 2px; background: var(--gray-900); }
.dark .dsp-timeline__head { background: #fff; }
.dsp-window__row { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem; }
.dsp-window__label { font-family: ui-monospace, monospace; font-size: .85rem; font-weight: 700; padding: .15rem .5rem; border-radius: .4rem; background: var(--success-50); color: var(--success-700); }
.dsp-window__sliders { display: grid; grid-template-columns: 1fr 1fr; gap: .8rem; font-size: .8rem; }
.dsp-window__sliders label { display: grid; gap: .25rem; }
.dsp-window__sliders input { width: 100%; accent-color: var(--primary-600); }
@media (max-width: 640px) { .dsp-window__sliders { grid-template-columns: 1fr; } }

/* Section anchors: leave room for the top bar when jumping. */
.dsp-anchor { scroll-margin-top: 5rem; }
.dsp-savebar { position: sticky; bottom: 0; z-index: 10; padding: .75rem 0; background: var(--gray-50); border-top: 1px solid var(--gray-200); }
.dark .dsp-savebar { background: var(--gray-950); border-color: var(--gray-800); }

/* Preview "after purchase": the buyer's download button, only for items with the download option ON (ADR-0052). */
.dsp-download { display: inline-flex; align-items: center; gap: .3rem; margin-top: .5rem; padding: .35rem .9rem; border-radius: 99px; font-size: .8rem; font-weight: 700;
    background: var(--primary-500); color: #04211e; text-decoration: none; }
.dsp-download:hover { filter: brightness(1.08); }
.dsp-nodownload { margin-top: .35rem; }

/* ADR-0054: the content card's badge, its ▶ clip of the first seconds, and the «اقرأ القصة كاملة» box. */
.dsp-card__badge { position: absolute; bottom: .45rem; inset-inline-start: .45rem; font-size: .7rem; font-weight: 800; padding: .15rem .55rem;
    border-radius: 999px; background: #f5c26b; color: #3b2a05; }
.dsp-card__play { position: absolute; inset-inline: .4rem; bottom: 2.1rem; }
.dsp-card__play .dsp-clip__bar { background: rgb(0 0 0 / .6); border-radius: 999px; padding: .15rem .35rem; color: #fff; }
.dsp-card__desc { color: var(--gray-500); white-space: pre-line; }
.dsp-readbox p { font-size: .85rem; white-space: pre-line; }
.dsp-readbox__li { font-size: .82rem; }
.dsp-readbox__btn { justify-self: start; margin-top: .3rem; padding: .45rem 1rem; border: 0; border-radius: 999px; font-weight: 800; font-size: .8rem;
    background: var(--primary-500, #2EC4B6); color: #04211e; cursor: pointer; }
.dsp-readbox__btn:disabled { opacity: .75; cursor: default; }
