/*
 * Content Studio (ADR-0045): the old admin's look (product_old_backend/public/css/studio.css +
 * products.css) applied to the Studio pages only. Body class `dsp-app` is set by those pages.
 */

/* ---- Tokens: the old palette, also mapped onto Filament's gray/primary scales ---- */
html.dsp-app-html, :root:has(body.dsp-app) {
    --bg: #080C12; --card: #12161C; --gold: #2EC4B6; --gold2: #7FE3D8; --mut: #9CA3AB; --ink: #F2F3F5; --line: rgba(46, 196, 182, .25);
    --field: #0B0F14; --deep: #05070A; --draft: #f5c26b; --ok: #8be28b; --bad: #ff9aa2;
    --chip: #10141A; --bar: #000000; --cover: #1B2027; --glass: rgba(8, 12, 18, .92); --glow: #1B2027; --brand: #fff;

    --gray-50: #F2F3F5; --gray-100: #E4E6E9; --gray-200: #CBCED3; --gray-300: #B0B4BA; --gray-400: #9CA3AB; --gray-500: #70767E;
    --gray-600: #4B5058; --gray-700: #2D3138; --gray-800: #1D2127; --gray-900: #12161C; --gray-950: #080C12;
    --primary-50: #e8faf8; --primary-100: #c8f3ee; --primary-200: #9fe9e0; --primary-300: #7FE3D8; --primary-400: #4fd3c6; --primary-500: #2EC4B6;
    --primary-600: #23a698; --primary-700: #1c857a; --primary-800: #176b63; --primary-900: #135751; --primary-950: #04211e;
    --font-family: 'Tajawal';
}

body.dsp-app {
    background: radial-gradient(1200px 600px at 80% -10%, var(--glow) 0%, var(--bg) 55%) fixed !important;
    color: var(--ink); font-family: 'Tajawal', sans-serif; line-height: 1.7;
}
body.dsp-app *:not(code):not(pre) { font-family: 'Tajawal', sans-serif; }
body.dsp-app .fi-layout, body.dsp-app .fi-main-ctn, body.dsp-app .fi-main { background: transparent; }
/* Page width: 90% of the window on desktop, the full width on phones and tablets (owner, 11 Nov 2026). */
body.dsp-app .fi-page { width: 90%; max-width: none; margin-inline: auto; padding: 22px 20px 70px; }
@media (max-width: 1023px) { body.dsp-app .fi-page { width: 100%; } }
body.dsp-app .fi-main { padding-inline: 0; max-width: none; }
@media (max-width: 640px) { body.dsp-app .fi-page { padding: 16px 16px 60px; } }
body.dsp-app .fi-page-header-main-ctn { padding-top: 0; gap: 1rem; }

/* ---- Top bar (old .topbar) ---- */
.dsp-topbar { background: var(--bar); display: flex; align-items: center; gap: 10px; padding: 8px 16px; position: sticky; top: 0; z-index: 90; flex-wrap: wrap; }
.dsp-topbar__brand { display: flex; align-items: center; gap: 8px; }
.dsp-topbar__brand b { color: var(--brand); font-size: 13px; font-weight: 900; }
/* ADR-0062: the official logo; white on the dark theme, black on the light one. Height only, never stretched. */
.dsp-topbar__logo { display: block; width: auto; height: auto; max-width: 140px; max-height: 32px; object-fit: contain; }
html.dsp-light .dsp-topbar__logo.is-dark, html:not(.dsp-light) .dsp-topbar__logo.is-light { display: none; }
.dsp-topbar__nav { display: flex; gap: 3px; flex-wrap: wrap; }
.dsp-topbar__nav a { color: var(--mut); font-size: 12.5px; font-weight: 800; padding: 6px 12px; border-radius: 99px; }
.dsp-topbar__nav a.is-on, .dsp-topbar__nav a:hover { background: var(--chip); color: var(--gold2); }
.dsp-topbar__user { margin-inline-start: auto; }
.dsp-topbar__user button { background: var(--chip); color: var(--ink); border: 1px solid var(--line); border-radius: 99px; padding: 6px 12px; font-size: 12px; font-weight: 800; cursor: pointer; }
.dsp-topbar__user small { color: var(--mut); font-weight: 700; }

/* ---- Page header: breadcrumb-like title and the save buttons ---- */
body.dsp-app .fi-header { align-items: center; padding-bottom: .25rem; }
body.dsp-app .fi-header-heading { font-size: 1.25rem; font-weight: 900; color: var(--ink); }
body.dsp-app .fi-header-subheading { color: var(--gold2); font-weight: 700; font-size: .85rem; }
body.dsp-app .fi-header .fi-ac { gap: .5rem; }
body.dsp-app:has(.dsp-layout--studio) .fi-header { position: sticky; top: 46px; z-index: 40; padding: .6rem 0; background: var(--glass); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }

/* ---- Toasts: in front of the sticky top bar and title bar, never behind them ---- */
body.dsp-app .fi-no { z-index: 200; top: 54px; }

/* ---- Buttons (old .btn, .b-gold) ---- */
body.dsp-app .fi-btn { border-radius: 12px; font-weight: 800; font-size: 13.5px; padding: 9px 16px; box-shadow: none; }
body.dsp-app .fi-btn.fi-color-success, body.dsp-app .fi-btn.fi-color-primary { background: linear-gradient(135deg, var(--gold2), var(--gold)); color: #04211e; }
body.dsp-app .fi-btn.fi-color-gray { background: var(--chip); color: var(--ink); border: 1px solid var(--line); }
body.dsp-app .fi-btn.fi-color-gray:hover { border-color: var(--gold); }

/* ---- Tabs: pill switch like the old .mode ---- */
body.dsp-app .dsp-studio-tabs > .fi-tabs, body.dsp-app .dsp-studio-tabs .fi-tabs:first-child {
    display: flex; gap: 4px; background: var(--chip); border-radius: 99px; padding: 4px; border: 1px solid var(--line); width: fit-content; max-width: 100%; overflow-x: auto; margin-bottom: 18px; box-shadow: none;
}
body.dsp-app .fi-tabs-item { border-radius: 99px; padding: 8px 18px; font-weight: 800; font-size: 13px; color: var(--mut); background: transparent; white-space: nowrap; }
body.dsp-app .fi-tabs-item .fi-tabs-item-label { color: inherit; }
body.dsp-app .fi-tabs-item.fi-active { background: var(--gold); color: #04211e; }
body.dsp-app .fi-tabs-item:not(.fi-active):hover { color: var(--gold2); background: transparent; }
body.dsp-app .dsp-studio-tabs .fi-sc-tabs-tab { padding: 0; }
/* The tabs bar (languages + preview) stays under the top bar and title bar while scrolling.
   --dsp-stick is measured by product-form.js; the fallback fits a one-line title. */
body.dsp-app .dsp-studio-tabs > .fi-tabs { position: sticky; top: calc(var(--dsp-stick, 118px) + 6px); z-index: 39; box-shadow: 0 6px 18px rgba(0, 0, 0, .35); }

/* ---- Sections = old .box cards ---- */
body.dsp-app .fi-section { background: var(--card); border: 1px solid var(--line); border-radius: 18px; box-shadow: none; --tw-ring-shadow: 0 0 #0000; }
body.dsp-app .fi-section:not(.fi-section-not-contained):not(.fi-aside) > .fi-section-header { padding: 18px 20px 4px; border: 0; }
body.dsp-app .fi-section-content-ctn { border-top: 0 !important; }
body.dsp-app .fi-section-content { padding: 12px 20px 20px; }
body.dsp-app .fi-section-header-heading { color: var(--gold2); font-size: 16px; font-weight: 900; }
body.dsp-app .fi-section-header-description { color: var(--mut); }
body.dsp-app .fi-section .fi-section { background: var(--deep); border-radius: 14px; }
body.dsp-app .dsp-link-note { font-size: 13px; opacity: .8; text-align: right; overflow-wrap: anywhere; }
body.dsp-app .dsp-subhead { color: var(--gold2); font-weight: 900; font-size: 14px; margin-top: .25rem; }
body.dsp-app .dsp-note { background: rgba(46, 196, 182, .08); border: 1px solid var(--line); color: var(--gold2); border-radius: 12px; padding: 10px 14px; font-size: 12.5px; }
body.dsp-app .fi-sc-text { color: var(--mut); font-size: 12.5px; }

/* ---- Fields: old inputs ---- */
body.dsp-app .fi-fo-field-label-content { color: var(--ink); font-size: 12.5px; font-weight: 800; }
body.dsp-app .fi-fo-field-label-required-mark { color: var(--gold); }
body.dsp-app .fi-input-wrp, body.dsp-app .fi-fo-textarea, body.dsp-app .fi-select-input .fi-input-wrp {
    background: var(--field) !important; border: 1.5px solid var(--line); border-radius: 10px; box-shadow: none !important; --tw-ring-shadow: 0 0 #0000;
}
body.dsp-app .fi-input-wrp:focus-within, body.dsp-app .fi-fo-textarea:focus-within { border-color: var(--gold); }
body.dsp-app .fi-input, body.dsp-app .fi-fo-textarea textarea, body.dsp-app .fi-select-input-btn { color: var(--ink); font-size: 13.5px; background: transparent; }
body.dsp-app .fi-input::placeholder, body.dsp-app textarea::placeholder { color: #5f6b77; }
body.dsp-app .fi-fo-field-wrp-helper-text, body.dsp-app .fi-fo-field-helper-text, body.dsp-app .fi-sc-text.fi-color-gray { color: var(--mut); font-size: 11.5px; }

/* ---- Drop zones (old .drop) ---- */
body.dsp-app .filepond--root { margin-bottom: 0; font-family: 'Tajawal', sans-serif; }
body.dsp-app .filepond--panel-root { background: transparent !important; border: 1.5px dashed var(--line); border-radius: 12px; }
body.dsp-app .filepond--drop-label { color: var(--mut); font-size: 12.5px; min-height: 4.25rem; }
body.dsp-app .filepond--drop-label label { color: var(--mut); }
body.dsp-app .filepond--label-action { color: var(--gold2); text-decoration-color: var(--gold); }
body.dsp-app .filepond--root:hover .filepond--panel-root { border-color: var(--gold); background: rgba(46, 196, 182, .06) !important; }
body.dsp-app .filepond--item-panel { background: var(--chip); }

/* ---- Library picker button (old "📚 اختيار من المكتبة") ---- */
body.dsp-app .dsp-mp .dsp-btn, body.dsp-app .dsp-btn { background: var(--chip); color: var(--ink); border: 1px solid var(--line); border-radius: 10px; font-weight: 800; }
body.dsp-app .dsp-btn:hover { border-color: var(--gold); background: var(--chip); }

/* ---- Repeaters: scene rows like old .srow-scene ---- */
body.dsp-app .fi-fo-repeater-item { background: var(--field); border: 1px solid var(--line); border-radius: 12px; box-shadow: none; }
body.dsp-app .fi-fo-repeater-item-header { border-bottom: 1px solid var(--line); padding: 6px 12px; }
body.dsp-app .fi-fo-repeater-item-header-label { color: var(--gold2); font-weight: 900; font-size: 13px; }
body.dsp-app .fi-fo-repeater-item-content { padding: 12px; }
body.dsp-app .fi-fo-repeater-add .fi-btn {
    background: linear-gradient(135deg, var(--gold2), var(--gold)); color: #04211e; border: 0;
}
body.dsp-app .dsp-scene-img .filepond--drop-label { min-height: 7rem; }

/* ---- Toggles, rich editor ---- */
body.dsp-app .fi-toggle.fi-toggle-on, body.dsp-app .fi-toggle[aria-checked="true"] { background: var(--gold); }
body.dsp-app .fi-fo-rich-editor { background: var(--field); border: 1.5px solid var(--line); border-radius: 12px; box-shadow: none; }
body.dsp-app .fi-fo-rich-editor-toolbar { border-bottom: 1px solid var(--line); background: var(--chip); border-radius: 12px 12px 0 0; }
body.dsp-app .fi-fo-rich-editor-content { min-height: 12rem; color: var(--ink); }

/* ---- Arabic tab: form + sticky preview side (old .aform / .side) ---- */
.dsp-layout.dsp-layout--studio { display: block; }
.dsp-entry { display: grid; grid-template-columns: minmax(0, 1fr) 420px; gap: 20px; align-items: start; }
@media (max-width: 1100px) { .dsp-entry { grid-template-columns: 1fr; } .dsp-entry__side { order: -1; } }
.dsp-entry__form { display: grid; gap: 18px; min-width: 0; }
.dsp-entry__form > .fi-sc, .dsp-entry__form .fi-sc-form { gap: 18px; }
.dsp-entry__side { position: sticky; top: 116px; max-height: calc(100vh - 130px); overflow: auto; }
@media (max-width: 1100px) { .dsp-entry__side { position: static; max-height: none; } }
body.dsp-app .dsp-entry__side .dsp-preview, body.dsp-app .dsp-studio-preview .dsp-preview { position: static; max-height: none; background: var(--deep); border: 1px solid var(--line); border-radius: 16px; padding: 14px; color: var(--ink); box-shadow: none; }
.dsp-entry__side .dsp-checks, .dsp-entry__side .dsp-viewswitch, .dsp-entry__side .dsp-preview__toggle, .dsp-entry__side .dsp-preview__note { display: none !important; }
.dsp-entry__side .dsp-preview__scroll { max-height: none; }
body.dsp-app .dsp-preview__h { color: var(--gold2); font-size: 13px; font-weight: 900; margin: 4px 0 10px; }
body.dsp-app .dsp-card { background: var(--card); border: 1px solid var(--line); border-radius: 16px; max-width: 220px; margin-inline: auto; color: var(--ink); }
body.dsp-app .dsp-page { background: var(--deep); border: 1px solid var(--line); border-radius: 22px; color: var(--ink); }
body.dsp-app .dsp-block { border-color: var(--line); }
body.dsp-app .dsp-chip { background: var(--chip); border: 1px solid var(--line); color: var(--gold2); }
body.dsp-app .dsp-chip.is-on { background: var(--gold); color: #04211e; }

/* ---- Full preview tab ---- */
/* The preview tab uses the page width, like the store page. */
body.dsp-app .dsp-studio-preview .dsp-preview { max-width: none; padding: 18px; }
.dsp-studio-preview .dsp-card { max-width: 260px; margin-inline: 0 auto; }
.dsp-studio-preview .dsp-checks { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 4px 16px; }
.dsp-studio-preview .dsp-page { border-radius: 22px; overflow: hidden; }
.dsp-studio-preview .dsp-hero h3 { font-size: 30px; }
.dsp-studio-preview .dsp-block { padding: 16px 20px; }
.dsp-fullscenes.is-grid { grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); }
.dsp-studio-preview .dsp-fullscenes:not(.is-grid) { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.dsp-fullscenes figure.is-locked { display: grid; place-items: center; min-height: 160px; background: repeating-linear-gradient(135deg, var(--chip) 0 12px, var(--field) 12px 24px); }
.dsp-fullscenes figure.is-locked span { font-size: 26px; opacity: .8; }
.dsp-richtext { line-height: 2; font-size: 15px; color: var(--ink); }
.dsp-richtext p { margin: 0 0 .75rem; }
.dsp-richtext h1, .dsp-richtext h2, .dsp-richtext h3 { font-weight: 900; margin: 1rem 0 .5rem; color: var(--gold2); }
.dsp-richtext h1 { font-size: 1.5rem; } .dsp-richtext h2 { font-size: 1.3rem; } .dsp-richtext h3 { font-size: 1.15rem; }
.dsp-richtext blockquote { border-inline-start: 3px solid var(--gold); padding-inline-start: 12px; color: var(--mut); margin: .75rem 0; }
.dsp-richtext ul, .dsp-richtext ol { padding-inline-start: 1.5rem; margin: 0 0 .75rem; } .dsp-richtext ul { list-style: disc; } .dsp-richtext ol { list-style: decimal; }
.dsp-richtext img, .dsp-richtext video { max-width: 100%; border-radius: 12px; margin: .75rem auto; display: block; }
.dsp-richtext audio { width: 100%; margin: .75rem 0; }
.dsp-richtext table { width: 100%; border-collapse: collapse; margin: .75rem 0; } .dsp-richtext td, .dsp-richtext th { border: 1px solid var(--line); padding: 6px 8px; }

/* ---- Free clip player: its own 0 → length timeline ---- */
.dsp-clip { display: grid; gap: 8px; }
.dsp-clip__video { width: 100%; max-height: 70vh; border-radius: 14px; background: #000; cursor: pointer; }
.dsp-clip__bar { display: flex; align-items: center; gap: 10px; background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 8px 12px; }
.dsp-clip__play { width: 38px; height: 38px; border-radius: 50%; border: 0; flex: none; cursor: pointer; font-weight: 900; color: #04211e; background: linear-gradient(135deg, var(--gold2), var(--gold)); }
.dsp-clip__range { flex: 1; accent-color: var(--gold); }
.dsp-clip__time { font-size: 12px; color: var(--mut); font-variant-numeric: tabular-nums; min-width: 82px; text-align: end; }

/* ---- Theme switch ---- */
.dsp-theme { background: var(--chip); color: var(--ink); border: 1px solid var(--line); border-radius: 99px; padding: 6px 12px; font-size: 12px; font-weight: 800; cursor: pointer; }
html.dsp-light .dsp-theme .is-dark, html:not(.dsp-light) .dsp-theme .is-light { display: none; }

/* ---- Light mode: same layout, light tokens ---- */
html.dsp-app-html.dsp-light {
    --bg: #F5F6F8; --card: #ffffff; --ink: #080C12; --mut: #5F656D; --line: rgba(46, 196, 182, .38); --gold2: #138a80;
    --field: #FAFBFC; --deep: #EFF0F2; --chip: #EBEDF0; --bar: #ffffff; --cover: #E0E2E6; --glass: rgba(245, 246, 248, .94); --glow: #ECEEF1; --brand: #080C12;
    --draft: #b7791f; --ok: #2f855a; --bad: #c53030;
}
html.dsp-light .dsp-topbar { border-bottom: 1px solid var(--line); box-shadow: 0 2px 10px rgba(8, 12, 18, .05); }
html.dsp-light body.dsp-app .fi-section, html.dsp-light .dsp-cs__card, html.dsp-light .dsp-cs__panel { box-shadow: 0 4px 16px rgba(8, 12, 18, .05); }
html.dsp-light .dsp-cs__btn.is-danger { background: #fde8ea; color: #9b1c2c; border-color: rgba(197, 48, 48, .3); }
html.dsp-light .dsp-cs__modal { background: rgba(8, 12, 18, .45); }
.dsp-viewswitch { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; margin-bottom: 1rem; background: var(--chip); border-radius: 99px; padding: 4px; border: 1px solid var(--line); }
.dsp-viewswitch button { padding: 8px 10px; border-radius: 99px; font-weight: 800; font-size: 12.5px; color: var(--mut); background: transparent; border: 0; }
.dsp-viewswitch button.is-on { background: var(--gold); color: #04211e; }
.dsp-fullscenes { display: grid; gap: .75rem; }
.dsp-fullscenes figure { margin: 0; border-radius: 12px; overflow: hidden; background: var(--card); border: 1px solid var(--line); }
.dsp-fullscenes img { width: 100%; display: block; }
.dsp-fullscenes figcaption { padding: .5rem .7rem; font-size: .85rem; color: var(--ink); }
.dsp-fullpara { margin: 0 0 .6rem; line-height: 1.9; }
.dsp-fullimg { width: 100%; border-radius: .6rem; }

/* ---- List page (old products admin) ---- */
.dsp-cs { color: var(--ink); }
.dsp-cs__head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .75rem; margin-bottom: 14px; }
.dsp-cs__head h2 { font-size: 22px; font-weight: 900; }
.dsp-cs__primary { background: linear-gradient(135deg, var(--gold2), var(--gold)); color: #04211e; font-weight: 800; border-radius: 12px; padding: 10px 18px; border: 0; cursor: pointer; font-size: 13.5px; }
.dsp-cs__primary:hover { filter: brightness(1.06); }
.dsp-cs__panel { background: var(--card); border: 1px solid var(--line); border-radius: 18px; padding: 16px 18px; margin-bottom: 14px; }
.dsp-cs__panel small { color: var(--mut); font-size: 12px; display: block; margin-bottom: 8px; }
.dsp-cs__quick { display: flex; flex-wrap: wrap; gap: 6px; }
.dsp-cs__chip { background: var(--field); border: 1px solid var(--line); color: var(--mut); border-radius: 99px; padding: 6px 14px; font-weight: 800; font-size: 12.5px; }
.dsp-cs__chip:hover { border-color: var(--gold); color: var(--gold2); }
.dsp-cs__filters { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.dsp-cs__filters input { grid-column: 1 / -1; }
@media (min-width: 768px) { .dsp-cs__filters { grid-template-columns: 200px 200px 1fr; } .dsp-cs__filters input { grid-column: auto; } }
.dsp-cs__filters select, .dsp-cs__filters input { width: 100%; padding: 8px 11px; border: 1.5px solid var(--line); border-radius: 10px; font-size: 13.5px; background: var(--field); color: var(--ink); }
.dsp-cs__grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 16px; }
@media (max-width: 480px) { .dsp-cs__grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; } }
.dsp-cs__card { display: flex; flex-direction: column; background: var(--card); color: var(--ink); border-radius: 16px; overflow: hidden; border: 1px solid var(--line); transition: transform .15s, border-color .15s; }
.dsp-cs__card:hover { transform: translateY(-2px); border-color: var(--gold); }
/* Every card's image has the same fixed height, whatever the picture's own size: it is cropped to fill it. */
.dsp-cs__cover { position: relative; display: block; flex: none; height: 220px; overflow: hidden; background: var(--cover); }
@media (max-width: 480px) { .dsp-cs__cover { height: 160px; } }
.dsp-cs__cover img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; }
.dsp-cs__placeholder { position: absolute; inset: 0; display: grid; place-items: center; color: var(--mut); font-size: 12px; }
.dsp-cs__type, .dsp-cs__status { position: absolute; top: 8px; display: inline-flex; align-items: center; gap: 4px; background: var(--chip); border: 1px solid var(--line); color: var(--gold2); font-size: 11px; font-weight: 800; padding: 3px 9px; border-radius: 99px; }
.dsp-cs__type { right: 8px; }
.dsp-cs__status { left: 8px; color: var(--draft); border-color: rgba(245, 194, 107, .35); }
.dsp-cs__status.is-published { color: var(--ok); border-color: rgba(139, 226, 139, .35); }
.dsp-cs__status.is-archived { color: var(--mut); border-color: rgba(154, 167, 180, .35); }
.dsp-cs__body { display: flex; flex-direction: column; flex: 1; }
.dsp-cs__title { padding: 10px 11px 2px; font-size: 14px; font-weight: 800; overflow-wrap: anywhere; }
.dsp-cs__meta { padding: 0 11px; color: var(--mut); font-size: 11.5px; min-height: 18px; }
.dsp-cs__price { padding: 6px 11px 10px; color: var(--gold2); font-weight: 900; font-size: 14px; margin-top: auto; }
.dsp-cs__actions { display: flex; gap: 6px; flex-wrap: wrap; padding: 0 11px 12px; }
.dsp-cs__btn { display: inline-flex; align-items: center; gap: 5px; border-radius: 12px; padding: 6px 11px; font-weight: 800; font-size: 12px; cursor: pointer; background: var(--chip); color: var(--ink); border: 1px solid var(--line); }
.dsp-cs__btn:hover { border-color: var(--gold); }
.dsp-cs__btn.is-ok { background: linear-gradient(135deg, var(--gold2), var(--gold)); color: #04211e; border: 0; }
.dsp-cs__btn.is-danger { background: #4a1d24; color: #ffd5d9; border: 1px solid rgba(255, 120, 130, .35); }
.dsp-cs__empty { border: 1px dashed var(--line); border-radius: 14px; padding: 22px; text-align: center; color: var(--mut); font-size: 13px; display: grid; gap: 1rem; justify-items: center; }
.dsp-cs__pages { margin-top: 1.25rem; }
.dsp-cs__modal { position: fixed; inset: 0; z-index: 160; background: rgba(7, 10, 14, .85); display: flex; align-items: center; justify-content: center; padding: 16px; }
.dsp-cs__dialog { width: 100%; max-width: 760px; max-height: 88vh; overflow: auto; background: var(--card); color: var(--ink); border: 1px solid var(--line); border-radius: 18px; padding: 22px; }
.dsp-cs__dialog-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.dsp-cs__dialog-head h3 { font-size: 17px; font-weight: 900; }
.dsp-cs__close { background: var(--chip); color: var(--ink); border: 1px solid var(--line); border-radius: 12px; padding: 6px 14px; font-weight: 800; cursor: pointer; }
.dsp-cs__typegroup { margin: 16px 0 0; font-size: 14px; font-weight: 700; opacity: .75; }
.dsp-cs__types { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px; margin-top: 10px; }
.dsp-cs__typebtn { background: var(--field); border: 1px solid var(--line); color: var(--ink); border-radius: 14px; padding: 16px 10px; font-weight: 800; font-size: 14px; text-align: center; display: grid; gap: 6px; justify-items: center; }
.dsp-cs__typebtn:hover { border-color: var(--gold); }
.dsp-cs__typeicon { font-size: 26px; }
body.dsp-app .fi-pagination { color: var(--mut); }

/* Page background behind short pages, and compact tabs on phones. */
html.dsp-app-html { background: var(--bg); }
@media (max-width: 640px) {
    body.dsp-app .fi-tabs-item { padding: 7px 11px; font-size: 12px; }
    body.dsp-app .dsp-studio-tabs > .fi-tabs { width: 100%; }
    .dsp-topbar__user { margin-inline-start: 0; }
}

.dsp-cs__head-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

.dsp-topbar__theme { margin-inline-start: auto; }
.dsp-topbar__theme + .dsp-topbar__user { margin-inline-start: 0; }

/* Scene rows (old .srow-scene): image beside its text, one row per scene, add button full width below. */
body.dsp-app .dsp-scene-rows .fi-fo-repeater-item { margin-bottom: 10px; }
body.dsp-app .dsp-scene-rows .fi-fo-repeater-item-header-label { font-size: 13px; }
body.dsp-app .fi-fo-repeater-add { display: flex; justify-content: flex-start; background: none; }
body.dsp-app .fi-fo-repeater-add .fi-btn { padding: 8px 16px; font-size: 13px; }
body.dsp-app .dsp-scene-img .filepond--root { max-width: 220px; }

/* ---- Save guard (product-form.js): progress screen while saving, upload bar, blocked save buttons ---- */
.dsp-saving { position: fixed; inset: 0; z-index: 300; display: grid; place-items: center; background: rgba(4, 18, 17, .55); backdrop-filter: blur(3px); cursor: progress; }
.dsp-saving[hidden] { display: none; }
.dsp-saving__box { direction: rtl; text-align: center; background: var(--card, #fff); color: var(--ink, #10201f); border-radius: 18px; padding: 26px 30px; min-width: 280px; max-width: min(92vw, 420px); box-shadow: 0 20px 60px rgba(0,0,0,.35); display: grid; gap: 8px; justify-items: center; }
.dsp-saving__box strong { font-size: 18px; font-weight: 900; }
.dsp-saving__box p { margin: 0; color: var(--mut, #5b6b69); font-size: 14px; font-weight: 700; }
.dsp-saving__time { color: var(--gold2, #b8860b); font-weight: 800; min-height: 1em; }
.dsp-saving__spin { width: 42px; height: 42px; border-radius: 50%; border: 4px solid rgba(0,0,0,.12); border-top-color: var(--gold, #d4a017); animation: dsp-spin .9s linear infinite; }
@keyframes dsp-spin { to { transform: rotate(360deg); } }
.dsp-upload-bar { position: fixed; inset-inline: 0; bottom: 0; z-index: 250; direction: rtl; text-align: center; padding: 10px 16px; font-weight: 800; font-size: 14px; background: var(--gold, #d4a017); color: #04211e; box-shadow: 0 -4px 16px rgba(0,0,0,.2); }
.dsp-upload-bar[hidden] { display: none; }
body.dsp-uploading .dsp-save-btn { opacity: .5; cursor: not-allowed; }
body.dsp-saving-now .dsp-save-btn { opacity: .5; pointer-events: none; cursor: progress; }

/* ---- Read-only story (ADR-0051): why it can't be edited, and where to edit basics ---- */
.dsp-lock-banner { direction: rtl; background: #fff7e0; color: #5a4300; border: 1px solid #f0d58a; border-radius: 14px; padding: 12px 16px; font-weight: 800; font-size: 14px; line-height: 1.7; }
.dsp-lock-banner a { color: #8a5a00; text-decoration: underline; }

/* ADR-0094: «المنتجات المشمولة» on the Studio campaign page. */
.dsp-offer-items { margin-top: 1.25rem; }
.dsp-offer-items__row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 18px; padding: 10px 12px; border-top: 1px solid var(--line); }
.dsp-offer-items__row strong { flex: 1 1 220px; }
.dsp-offer-items__row span { color: var(--mut); font-size: 13px; }
.dsp-offer-items__actions { display: inline-flex; gap: 6px; margin-inline-start: auto; }
.dsp-offer-items__warn { background: #fff4d6; color: #6b4a00; border-radius: 10px; padding: 10px 12px; margin: 8px 0; font-size: 13px; }

/* ADR-0099: the draw box on the Studio campaign page. */
.dsp-draw { border: 1px solid var(--line); border-radius: 16px; padding: 14px 16px; margin: 0 0 16px; background: linear-gradient(135deg, rgba(255, 215, 0, .08), rgba(233, 30, 99, .06)); }
.dsp-draw__head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 8px; }
.dsp-draw__head h3 { margin: 0; font-size: 18px; font-weight: 900; }
.dsp-draw__date { font-size: 13px; opacity: .8; }
.dsp-draw__state { margin: 8px 0 12px; font-weight: 700; }
.dsp-draw__steps { display: flex; flex-wrap: wrap; gap: 8px; }
.dsp-draw__winners { margin: 12px 0 0; padding: 0; list-style: none; display: grid; gap: 6px; }
.dsp-draw__winners li { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; padding: 8px 10px; border-radius: 10px; background: var(--card); }
.dsp-draw__winners a { color: var(--gold2); text-decoration: underline; font-size: 13px; }
.dsp-draw__hint { margin: 12px 0 0; font-size: 12px; opacity: .75; line-height: 1.8; }
.dsp-cs__drawdue { position: absolute; inset-inline-start: 8px; bottom: 8px; background: #e91e63; color: #fff; font-weight: 800; font-size: 12px; padding: 3px 10px; border-radius: 999px; box-shadow: 0 2px 8px rgba(0, 0, 0, .25); }
