/* MI PART Content Studio V1.2 — product descriptions only; no storefront shell changes */
.mp-content-studio{border:1px solid #d7e1f0;border-radius:16px;background:#fff;overflow:hidden;box-shadow:0 9px 24px rgba(29,62,107,.05)}
.mp-content-studio.is-fullscreen{position:fixed!important;inset:12px;z-index:2000;display:flex;flex-direction:column;background:#fff;overflow:auto;box-shadow:0 10px 60px #0b203c77}
.mp-content-studio.is-fullscreen .mp-content-editable{flex:1;min-height:50vh;overflow-y:auto}
.mp-content-toolbar{display:flex;flex-wrap:wrap;align-items:center;gap:5px;padding:9px 10px;background:#f3f7fc;border-bottom:1px solid #d7e1f0;position:sticky;top:0;z-index:5}
.mp-content-toolbar button,.mp-content-toolbar select,.mp-content-media-control button,.mp-content-media-control select{border:1px solid #dce4f0;background:#fff;border-radius:8px;min-height:35px;padding:5px 9px;color:#223956;font:inherit;font-size:13px;cursor:pointer}
.mp-content-toolbar button:hover,.mp-content-media-control button:hover{background:#eaf2ff;border-color:#96b7e8}
.mp-content-toolbar button:disabled{opacity:.4;cursor:default}
.mp-content-toolbar select{max-width:120px}
.mp-content-toolbar .mp-content-media-btn{background:#1f64c5;color:#fff;border-color:#1f64c5;font-weight:700;padding-inline:12px}
.mp-content-toolbar .mp-content-media-btn:hover{background:#1c54a5}
.mp-content-media-control{display:flex;flex-wrap:wrap;gap:6px;align-items:center;padding:7px 12px;border-bottom:1px solid #e1e8f2;background:#fafcff;font-size:12px;color:#49617d}
.mp-content-media-control button:disabled,.mp-content-media-control select:disabled{cursor:not-allowed;opacity:.5}
.mp-content-editable{background:#fff;min-height:380px;line-height:2.25;padding:20px 24px;outline:none;overflow-wrap:anywhere;color:#1f2c43;text-align:right;font-size:16px;white-space:normal}
.mp-content-editable:focus{box-shadow:inset 0 0 0 2px #c8ddfb}
.mp-content-editable h2,.mp-content-editable h3,.mp-content-editable h4{margin:16px 0 8px;color:#142b4b;line-height:1.6}
.mp-content-editable p{margin:5px 0 14px}
.mp-content-editable figure{display:block;border:1px solid #e3ebf5;background:#f8fbff;padding:10px;border-radius:12px;margin:16px auto;text-align:center;width:100%;max-width:100%;cursor:pointer}
.mp-content-editable figure:hover{outline:2px solid #bad1f5}
.mp-content-editable figure img,.mp-content-editable figure video,.mp-content-editable figure iframe{display:block;max-width:100%;height:auto;margin:auto;border:0;border-radius:8px}
.mp-content-editable figure iframe{aspect-ratio:16/9;height:auto;min-height:250px}
.mp-content-editable figcaption{font-size:12px;color:#6e7f96;margin-top:5px}
.mp-content-editable .mp-content-right{text-align:right}.mp-content-editable .mp-content-left{text-align:left}.mp-content-editable .mp-content-center{text-align:center}
.mp-content-editable .mp-content-right img,.mp-content-editable .mp-content-right video{margin-right:0;margin-left:auto}
.mp-content-editable .mp-content-left img,.mp-content-editable .mp-content-left video{margin-right:auto;margin-left:0}
.mp-content-editable img:not(figure img){max-width:100%;height:auto}
.mp-content-editable table{width:100%;border-collapse:collapse;margin:14px 0}.mp-content-editable th,.mp-content-editable td{border:1px solid #bfcddd;padding:10px}
.mp-content-editable blockquote{border-right:4px solid #477cbe;padding:10px 15px;background:#eef5ff;margin:16px 0}
.mp-content-editor-status{background:#eff5ff;border-top:1px solid #e0e9fa;padding:9px 13px;color:#3b608f;font-size:12px;min-height:28px}
.mp-content-editor-status.is-error{color:#ab2828;background:#fff0f0}
.mp-content-source{width:100%;font:14px/1.7 ui-monospace,monospace;min-height:380px;padding:16px;resize:vertical;border:0;background:#fcfdff}
.mp-content-legacy{margin-top:18px;border:1px dashed #d6e0ed;border-radius:9px;padding:13px}
.mp-content-legacy summary{cursor:pointer;color:#627a94;font-size:13px}
.mp-media-dialog{border:1px solid #dce6f2;border-radius:17px;padding:0;max-width:min(720px,94vw);width:700px;max-height:90vh;overflow:auto;color:#223654;background:#fff;box-shadow:0 22px 60px #101d35aa}
.mp-media-dialog::backdrop{background:rgba(10,25,49,.65)}
.mp-modal-header{display:flex;align-items:center;justify-content:space-between;padding:17px 20px;border-bottom:1px solid #e0e7f2}
.mp-modal-header h3{margin:0;font-size:19px}.mp-modal-header button{border:0;background:#edf2f8;border-radius:9px;padding:7px 12px;cursor:pointer}
.mp-media-tabs{display:flex;gap:6px;padding:10px 16px;border-bottom:1px solid #e6edf5}
.mp-media-tabs button{border:0;background:transparent;padding:9px 13px;border-radius:8px;cursor:pointer;font:inherit;color:#566c86}
.mp-media-tabs button.is-current{background:#dcecff;color:#184f9c;font-weight:700}
.mp-media-panel{padding:20px;display:grid;gap:14px}.mp-media-panel[hidden]{display:none}
.mp-media-panel label{display:grid;gap:5px;font-weight:600;color:#29435f}
.mp-media-panel input{width:100%;border:1px solid #cddbf0;border-radius:10px;padding:12px;font:inherit;background:white;color:#1d3450}
.mp-media-panel .btn{justify-self:start;border:0;padding:10px 16px;cursor:pointer}
.mp-media-library{display:grid;grid-template-columns:repeat(auto-fill,minmax(110px,1fr));gap:10px;max-height:52vh;overflow:auto}
.mp-library-item{border:1px solid #dae2ed;background:#fff;border-radius:9px;overflow:hidden;cursor:pointer;padding:6px;display:flex;flex-direction:column;align-items:center;gap:6px;min-height:95px}
.mp-library-item img{max-width:100%;height:85px;object-fit:contain}.mp-library-item span{word-break:break-all;font-size:11px}.mp-library-video{font-size:38px!important;color:#245caf}
/* Public product description renders its own media width + captions, not product gallery CSS */
.mp-description-html{overflow-wrap:anywhere;line-height:2.1}
.mp-description-html .mp-content-media{display:block;max-width:100%;width:100%;margin:20px auto;padding:0;text-align:center}
.mp-description-html .mp-content-media img,.mp-description-html .mp-content-media video,.mp-description-html .mp-content-media iframe{display:block;margin:0 auto;max-width:100%;height:auto;border-radius:10px}
.mp-description-html .mp-content-media iframe{aspect-ratio:16/9;min-height:230px}
.mp-description-html .mp-content-media figcaption{font-size:12px;color:#607288;margin:4px auto 10px}
.mp-description-html .mp-content-media.mp-content-right{text-align:right}.mp-description-html .mp-content-media.mp-content-left{text-align:left}
.mp-description-html .mp-content-media.mp-content-right img,.mp-description-html .mp-content-media.mp-content-right video,.mp-description-html .mp-content-media.mp-content-right iframe{margin-right:0;margin-left:auto}
.mp-description-html .mp-content-media.mp-content-left img,.mp-description-html .mp-content-media.mp-content-left video,.mp-description-html .mp-content-media.mp-content-left iframe{margin-left:0;margin-right:auto}
.mp-description-html img{max-width:100%;height:auto}
.mp-description-html table{border-collapse:collapse;width:100%}.mp-description-html td,.mp-description-html th{border:1px solid #d8e0ef;padding:10px}
@media(max-width:700px){.mp-content-editable{padding:12px;min-height:300px;font-size:15px}.mp-content-toolbar{gap:4px}.mp-content-toolbar select{max-width:100px}.mp-media-dialog{width:95vw}.mp-content-editable figure iframe,.mp-description-html .mp-content-media iframe{min-height:170px}}

/* V1.3 media verification feedback */
.mp-media-dialog-status{margin:10px 18px 0;padding:10px 12px;border-radius:8px;background:#eef5ff;color:#24517e;font-size:13px;line-height:1.8}
.mp-media-dialog-status.is-error{background:#fff0f0;color:#a52222;border:1px solid #f6c7c7}
.mp-media-dialog-status.is-ok{background:#eaf8ed;color:#146b3b}
.mp-media-panel button:disabled{opacity:.55;cursor:progress}
.mp-content-media[data-mp-broken="1"]{outline:2px dashed #d33;border-radius:9px}
.mp-media-probe-box{background:#fff8e6;border:1px solid #f0cf8d;border-radius:10px;padding:10px;margin:8px 0;font-size:13px;line-height:2}


/* MI PART V1.4 – typography and expanded accessible color controls. */
.mp-content-toolbar{overflow:visible;z-index:15}
.mp-content-toolbar select[data-format=font]{max-width:164px;min-width:108px}
.mp-content-toolbar select[data-format=fontsize]{max-width:118px}
.mp-content-toolbar .mp-live-color{display:flex!important;flex-direction:row!important;align-items:center;gap:6px;margin:0!important;padding:3px 8px;border:1px solid #dce4f0;background:#fff;border-radius:8px;font-size:12px;line-height:1.4;cursor:pointer;color:#254769}
.mp-content-toolbar .mp-live-color input{width:32px;height:29px;min-width:32px;padding:1px;border:1px solid #bccde1;border-radius:6px;background:#fff;cursor:pointer}
.mp-content-toolbar .mp-256-colors{position:relative}
.mp-content-toolbar .mp-256-colors summary{list-style:none;cursor:pointer;min-height:35px;display:grid;place-items:center;padding:5px 10px;border:1px solid #dce4f0;border-radius:8px;background:#fff;color:#24496a;font-size:12px;user-select:none}
.mp-content-toolbar .mp-256-colors summary::-webkit-details-marker{display:none}
.mp-content-toolbar .mp-256-colors[open]{z-index:50}
.mp-content-toolbar .mp-256-colors .mp-color-tabs{position:absolute;inset-inline-start:0;top:39px;width:320px;display:flex;gap:5px;padding:10px 10px 0;background:#fff;border:1px solid #bed0e7;border-bottom:0;border-radius:12px 12px 0 0;box-shadow:0 8px 25px #25456724;z-index:10}
.mp-content-toolbar .mp-color-tabs button.is-active{background:#e3f0ff;border-color:#7eacd9;color:#165dac}
.mp-content-toolbar .mp-color-grid{position:absolute;inset-inline-start:0;top:79px;width:320px;display:grid;grid-template-columns:repeat(16,1fr);gap:3px;padding:10px;background:#fff;border:1px solid #bed0e7;border-top:0;border-radius:0 0 12px 12px;box-shadow:0 10px 26px #25456724;max-height:320px;overflow-y:auto;z-index:10}
.mp-content-toolbar .mp-color-grid .mp-color-swatch{width:100%;height:16px;min-height:16px;padding:0;border-radius:3px;border:1px solid #0002;cursor:pointer}
.mp-content-toolbar .mp-color-grid .mp-color-swatch:hover,.mp-content-toolbar .mp-color-grid .mp-color-swatch:focus-visible{outline:2px solid #145ac2;outline-offset:1px}
@media(max-width:580px){.mp-content-toolbar .mp-256-colors .mp-color-tabs,.mp-content-toolbar .mp-color-grid{width:min(320px,85vw)}}
/* Keep customer-side typography visible after the server-side whitelist cleans it. */
.mp-description-html [style*="font-family"]{font-family:inherit}
.mp-description-html [style*="font-family:Tahoma"]{font-family:Tahoma,Arial,sans-serif}
.mp-description-html [style*="font-family:Arial"]{font-family:Arial,sans-serif}
.mp-description-html [style*="font-family:Georgia"]{font-family:Georgia,serif}
.mp-description-html [style*="font-family:Times New Roman"]{font-family:"Times New Roman",serif}
.mp-description-html [style*="font-family:Courier New"]{font-family:"Courier New",monospace}
.mp-description-html [style*="font-family:Vazirmatn"]{font-family:Vazirmatn,Tahoma,sans-serif}


/* MI PART V1.5 — multiple images side by side, in editor AND on public product page */
.mp-gallery-help{background:#eef6ff;border:1px solid #d4e6fc;color:#35577d;padding:10px 12px;border-radius:10px;font-size:12px;line-height:2;margin:8px 0 12px}
.mp-content-toolbar .mp-grid-action{background:#e0edff;border-color:#a6c9f7;color:#164f9f;font-weight:700;white-space:nowrap}
.mp-content-toolbar .mp-grid-action:hover{background:#cfe2ff}
.mp-content-editable .mp-content-gallery,
.mp-description-html .mp-content-gallery{
 display:grid!important;grid-template-columns:repeat(2,minmax(0,1fr));gap:14px;
 width:100%;max-width:100%;box-sizing:border-box;margin:16px 0;align-items:stretch;direction:rtl;
}
.mp-content-editable .mp-content-gallery.mp-gallery-3,
.mp-description-html .mp-content-gallery.mp-gallery-3{grid-template-columns:repeat(3,minmax(0,1fr))}
.mp-content-editable .mp-content-gallery .mp-gallery-slot,
.mp-description-html .mp-content-gallery .mp-gallery-slot{box-sizing:border-box;min-width:0;width:auto;max-width:100%;margin:0;padding:0;overflow:hidden}
.mp-content-editable .mp-content-gallery .mp-gallery-slot{
 min-height:154px;background:#f5f9ff;border:2px dashed #b5cdea;border-radius:13px;
 display:flex;align-items:stretch;justify-content:center;cursor:pointer;
}
.mp-content-editable .mp-content-gallery .mp-gallery-slot:hover{border-color:#4a88df;background:#edf5ff}
.mp-content-editable .mp-content-gallery .mp-gallery-slot:focus-visible{outline:3px solid #70a5eb;outline-offset:2px}
.mp-content-editable .mp-content-gallery .mp-gallery-slot:empty::before{content:'＋  انتخاب یا آپلود عکس';color:#527cb0;font-weight:650;font-size:13px;align-self:center;white-space:normal;text-align:center;padding:12px}
.mp-content-editable .mp-content-gallery figure.mp-content-media,
.mp-description-html .mp-content-gallery figure.mp-content-media{
 width:100%!important;max-width:100%!important;margin:0!important;padding:8px!important;
 box-sizing:border-box;min-width:0;border-radius:11px;background:#fff;
}
.mp-content-editable .mp-content-gallery figure.mp-content-media img,
.mp-description-html .mp-content-gallery figure.mp-content-media img{
 width:100%!important;max-width:100%!important;max-height:350px;height:auto!important;object-fit:contain;
 display:block;margin:auto;border-radius:8px;
}
.mp-description-html .mp-content-gallery .mp-gallery-slot:empty{display:none}
.mp-description-html .mp-content-gallery figure.mp-content-media figcaption{font-size:12px;margin:5px 2px 0;color:#6b7890}
@media(max-width:700px){
 .mp-content-editable .mp-content-gallery,.mp-description-html .mp-content-gallery{gap:8px}
 .mp-content-editable .mp-content-gallery.mp-gallery-3,.mp-description-html .mp-content-gallery.mp-gallery-3{grid-template-columns:repeat(2,minmax(0,1fr))}
}
@media(max-width:440px){
 .mp-content-editable .mp-content-gallery,.mp-description-html .mp-content-gallery,
 .mp-content-editable .mp-content-gallery.mp-gallery-3,.mp-description-html .mp-content-gallery.mp-gallery-3{grid-template-columns:minmax(0,1fr)}
}


/* MI PART v1.6 — sticky content-editing toolbar.
   The old overflow:hidden on .mp-content-studio made the already-defined
   sticky toolbar stick inside a non-scrolling clipping ancestor, so it
   disappeared while the actual page scrolled. Allow normal page scrolling. */
#mp-description { overflow: visible !important; }
#mp-content-studio:not(.is-fullscreen) { overflow: visible; }
#mp-content-studio .mp-content-toolbar {
    position: -webkit-sticky;
    position: sticky;
    top: 8px;
    z-index: 105;
    background: #f3f7fc;
    border: 1px solid #d4e2f2;
    border-radius: 12px;
    box-shadow: 0 7px 18px rgba(21,49,94,.13);
    isolation: auto;
}
#mp-content-studio.is-fullscreen .mp-content-toolbar {top: 0; z-index: 110;}
/* Color palette should remain above editor images while the bar is fixed. */
#mp-content-studio .mp-256-colors[open] {z-index: 120;}
@media (max-width:700px) {
    #mp-content-studio .mp-content-toolbar {top: 0; gap: 4px; padding: 7px;}
}
