/* CopyBox Lite – ~2.5KB min; theme via CSS variables */
:root{
  --cbx-bg:#0b0f14;
  --cbx-fg:#e7edf3;
  --cbx-muted:#9db0c0;
  --cbx-border:#23303a;
  --cbx-accent:#3ea6ff;
  --cbx-radius:14px;
  --cbx-pad:14px;
  --cbx-font: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  --cbx-font-ui: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, "Helvetica Neue", Arial, "Noto Sans", "Apple Color Emoji", "Segoe UI Emoji";
}
@media (prefers-color-scheme: light){
  :root{
    --cbx-bg:#f7fafc;
    --cbx-fg:#0d1b24;
    --cbx-muted:#4d6372;
    --cbx-border:#d5e1ea;
    --cbx-accent:#1669c9;
  }
}

.cbx{
  position:relative;
  display:block;           /* NEW: يمنع أي تحوّل غير متوقع للعرض */
  clear:both;              /* NEW: يفصل عن أي عناصر عائمة قبله */
  margin:1.25rem 0;
  border:1px solid var(--cbx-border);
  border-radius:var(--cbx-radius);
  background:var(--cbx-bg);
  color:var(--cbx-fg);
  overflow:hidden;
}
/* NEW: clearfix احترازي لمنع تمدد بصري للصندوق فوق ما بعده */
.cbx:after{
  content:"";
  display:block;
  clear:both;
}

.cbx .cbx-head{
  display:flex;
  align-items:center;
  justify-content:space-between;
  padding:.6rem .9rem;
  background:linear-gradient(0deg, transparent, rgba(255,255,255,.03));
  border-bottom:1px solid var(--cbx-border);
  font-family:var(--cbx-font-ui);
}
.cbx .cbx-title{
  font-size:.85rem;
  letter-spacing:.02em;
  color:var(--cbx-muted);
  text-transform:uppercase;
}

.cbx .cbx-body{
  position:relative;
  padding:var(--cbx-pad);
}

.cbx-pre{
  margin:0;
  overflow:auto;
  font-family:var(--cbx-font);
  font-size:.92rem;
  line-height:1.55;
  white-space:pre;
}
.cbx-code{
  display:block;
  min-width:100%;
}
.cbx-text{
  font-family:var(--cbx-font-ui);
  color:var(--cbx-fg);
}
.cbx-text p{ margin:.6rem 0; }

.cbx-copy{
  position:absolute;
  top:.6rem;
  inset-inline-end:.6rem; /* RTL/LTR aware */
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap:.35rem;
  padding:.45rem .55rem;
  background:rgba(255,255,255,.06);
  color:var(--cbx-fg);
  border:1px solid var(--cbx-border);
  border-radius:10px;
  cursor:pointer;
  transition:transform .08s ease, background .2s ease, opacity .2s ease;
}
.cbx-copy:hover{ background:rgba(255,255,255,.12); }
.cbx-copy:active{ transform:scale(.97); }
.cbx-copy:focus{ outline:2px solid var(--cbx-accent); outline-offset:2px; }
.cbx-ico{ pointer-events:none; }

/* Live toast bubble */
.cbx .cbx-live{
  position:absolute;
  bottom:.6rem;
  inset-inline-end:.6rem;
  padding:.2rem .5rem;
  background:rgba(0,0,0,.35);
  color:#fff;
  border-radius:8px;
  font-size:.75rem;
  opacity:0;
  transform:translateY(6px);
  transition:opacity .25s ease, transform .25s ease;
}
.cbx.show-status .cbx-live{
  opacity:1; transform:translateY(0);
}

/* Line numbers (JS adds cbx-line spans) */
.cbx--linenums .cbx-code{
  counter-reset: cbxln;
}
.cbx--linenums .cbx-code .cbx-line{
  display:block;
  padding-inline-start:3.2em;
  position:relative;
}
.cbx--linenums .cbx-code .cbx-line::before{
  counter-increment: cbxln;
  content: counter(cbxln);
  position:absolute;
  inset-inline-start:.3em;
  color:var(--cbx-muted);
  min-width:2.4em;
  text-align:end;
  opacity:.7;
}

/* Scrollbars (WebKit) */
.cbx-pre::-webkit-scrollbar{ height:10px; width:10px; }
.cbx-pre::-webkit-scrollbar-thumb{ background:rgba(255,255,255,.15); border-radius:10px; }
.cbx-pre::-webkit-scrollbar-track{ background:transparent; }

/* Allow easy theming per-site */
.cbx.cbx--text .cbx-body{ font-size:1rem; }

/* NEW: فاصل صامت يضاف بعد كل صندوق من الشورتكود لفصل التخطيط بقوة */
.cbx-sentinel{
  display:block;
  clear:both;
  height:0;
  margin:0;
  padding:0;
}