/* BAHTHI_HUMANIZE_STUDIO_V1 — استوديو الهيومنس */
:root {
  --hl-sim: rgba(236, 72, 153, .22);
  --hl-sim-line: #db2777;
  --hl-ai: rgba(34, 184, 207, .25);
  --hl-ai-line: #0e9fb5;
  --hum-a: #6d4aff;
  --hum-b: #9b5cf6;
  --paper: #ffffff;
  --paper-ink: #1d1d1f;
  --paper-line: #e6e3da;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --hl-sim: rgba(236, 72, 153, .3);
    --hl-ai: rgba(34, 184, 207, .32);
    --paper-line: #33403d;
  }
}
.btn-humanize { background: linear-gradient(135deg, var(--hum-a), var(--hum-b)); color: #fff; box-shadow: 0 8px 22px rgba(109, 74, 255, .28); }
.btn-humanize:hover:not(:disabled) { transform: translateY(-1px); box-shadow: 0 12px 28px rgba(109, 74, 255, .36); }
.chip-user .cr-h { display: inline-flex; align-items: center; gap: 4px; background: rgba(109, 74, 255, .12); color: var(--hum-a); }
.chip-user .cr-h .ico-sm { width: 13px; height: 13px; }

body.is-studio .fab-wa { display: none; }
.studio { padding: 18px 0 56px; flex: 1; }
.st-top { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; padding: 12px 14px; border: 1px solid var(--line); border-radius: 18px; background: var(--surface); box-shadow: var(--shadow); margin-bottom: 16px; }
.st-title { display: flex; align-items: center; gap: 10px; flex: 1 1 260px; min-width: 0; }
.st-title .fi { width: 38px; height: 38px; border-radius: 12px; background: var(--primary-soft); color: var(--primary); display: grid; place-items: center; flex: none; }
.st-title b { display: block; font-size: 14.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.st-title small { display: block; font-size: 11px; letter-spacing: .12em; color: var(--muted); direction: ltr; text-align: start; }
.st-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.st-changes { font-size: 13px; color: var(--muted); display: inline-flex; align-items: center; gap: 6px; }

.st-body { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 18px; align-items: start; }
.st-doc { min-width: 0; }
.st-paper { background: var(--paper); color: var(--paper-ink); border: 1px solid var(--paper-line); border-radius: 10px; box-shadow: var(--shadow-lg); padding: 56px clamp(18px, 6vw, 72px); font-family: "Times New Roman", "IBM Plex Sans Arabic", serif; font-size: 16px; line-height: 1.95; min-height: 70vh; }
.st-paper .sp { margin: 0 0 12px; padding: 2px 10px; border-radius: 6px; border-inline-start: 3px solid transparent; outline: none; white-space: pre-wrap; word-break: break-word; transition: background .25s, border-color .25s; }
.st-paper .sp:focus { background: rgba(31, 111, 104, .06); }
.st-paper .sp-h { font-size: 1.22em; font-weight: 700; }
.st-paper .sp-b { font-weight: 700; }
.st-paper .sp-center { text-align: center; }
.st-paper .sp-cell { font-size: .9em; border: 1px dashed var(--paper-line); border-inline-start-width: 3px; margin-bottom: 6px; }
.st-paper .sp-flag { border-inline-start-color: var(--hl-sim-line); }
.st-paper .sp-done { border-inline-start-color: #2f9e6a; }
.st-paper .sp-edited { border-inline-start-color: #c9a467; }
.st-paper .sp-new { animation: stNew 1.6s ease-out; }
.st-paper .sp-busy { background: linear-gradient(90deg, rgba(109,74,255,.06), rgba(109,74,255,.18), rgba(109,74,255,.06)); background-size: 200% 100%; animation: stShimmer 1.2s linear infinite; }
.st-paper mark { color: inherit; border-radius: 3px; padding: 1px 0; }
.st-paper mark.hl-sim { background: var(--hl-sim); }
.st-paper mark.hl-ai { background: var(--hl-ai); }
@keyframes stShimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }
@keyframes stNew { from { background: rgba(47, 158, 106, .22); } to { background: transparent; } }

.st-side { position: sticky; top: 86px; display: grid; gap: 12px; padding: 18px; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); box-shadow: var(--shadow); max-height: calc(100vh - 100px); overflow: auto; }
.st-label { font-size: 11px; letter-spacing: .2em; color: var(--muted); font-weight: 700; border-inline-start: 3px solid var(--primary); padding-inline-start: 8px; }
.st-scores { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.st-score { padding: 12px; gap: 10px; }
.st-score .ring { width: 54px; height: 54px; }
.st-score .ring::before { width: 42px; height: 42px; font-size: 13px; }
.st-est { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; font-size: 11.5px; }
.st-est s { color: var(--muted); }
.st-est b { color: var(--ok); }
.st-est em { font-style: normal; font-size: 10px; font-weight: 700; color: var(--ok); background: var(--ok-soft); padding: 0 6px; border-radius: 6px; }
.st-tabs { display: grid !important; grid-template-columns: 1fr 1fr; }
.st-tabs button { display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.st-tabs .tag { font-size: 11px; padding: 0 7px; }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.dot-sim { background: var(--hl-sim-line); }
.dot-ai { background: var(--hl-ai-line); }
.st-info { font-size: 13px; line-height: 1.8; }
.st-go { background: linear-gradient(135deg, var(--hum-a), var(--hum-b)); box-shadow: 0 10px 26px rgba(109, 74, 255, .3); height: 52px; white-space: normal; line-height: 1.4; }
.st-meter { display: flex; justify-content: space-between; gap: 8px; font-size: 12.5px; color: var(--muted); flex-wrap: wrap; }
.st-foot { display: flex; gap: 8px; align-items: flex-start; font-size: 12px; color: var(--muted); line-height: 1.7; }
.st-foot .ico-sm { flex: none; margin-top: 3px; }
.st-retain { font-size: 12px; margin-top: 14px; text-align: center; }
.st-float { position: fixed; z-index: 80; display: inline-flex; align-items: center; gap: 6px; height: 38px; padding: 0 14px; border: 0; border-radius: 999px; color: #fff; font-weight: 600; font-size: 13px; background: linear-gradient(135deg, var(--hum-a), var(--hum-b)); box-shadow: 0 10px 28px rgba(109, 74, 255, .4); white-space: nowrap; }

@media (max-width: 980px) {
  .st-body { grid-template-columns: 1fr; }
  .st-side { position: static; max-height: none; order: -1; }
}
@media (max-width: 560px) {
  .studio .wrap { padding-inline: 12px; }
  .st-paper { padding: 28px 14px; font-size: 15px; }
  .st-scores { grid-template-columns: 1fr; }
  .st-actions { width: 100%; justify-content: space-between; }
}

/* V2: عرض ملف Word كاملاً */
.wrap-xl { max-width: 1440px; }
.st-docx { min-width: 0; overflow-x: auto; border-radius: 14px; }
.st-docx-loading { display: flex; align-items: center; gap: 10px; padding: 40px; justify-content: center; color: var(--muted); background: var(--surface); border: 1px solid var(--line); border-radius: 14px; }
.st-docx .docx-wrapper { direction: ltr; background: transparent !important; padding: 0 !important; display: flex; flex-direction: column; align-items: center; gap: 18px; }
.st-docx .docx-wrapper > section.docx { margin: 0 !important; box-shadow: var(--shadow-lg) !important; border-radius: 4px; color: #111; }
.st-docx p.sx-p { outline: none; border-radius: 3px; cursor: text; transition: background-color .25s; }
.st-docx p.sx-p:hover { background-color: rgba(31, 111, 104, .05); }
.st-docx p.sx-p:focus { background-color: rgba(31, 111, 104, .08); }
.st-docx p.sx-done { background-color: rgba(47, 158, 106, .10) !important; }
.st-docx p.sx-edited { background-color: rgba(201, 164, 103, .14) !important; }
.st-docx p.sx-new { animation: stNew 1.6s ease-out; }
.st-docx p.sx-busy { background: linear-gradient(90deg, rgba(109,74,255,.06), rgba(109,74,255,.2), rgba(109,74,255,.06)) !important; background-size: 200% 100% !important; animation: stShimmer 1.2s linear infinite; }
mark.sx-hl { color: inherit; border-radius: 2px; padding: 0; }
mark.sx-hl.hl-sim { background: var(--hl-sim); }
mark.sx-hl.hl-ai { background: var(--hl-ai); }
.st-docx section.docx mark.sx-hl.hl-sim { background: rgba(236, 72, 153, .28); }
.st-docx section.docx mark.sx-hl.hl-ai { background: rgba(34, 184, 207, .32); }
.st-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.st-row .btn { padding: 0 10px; }
.st-saved { font-size: 12.5px; color: var(--ok); text-align: center; }
.st-body { grid-template-columns: minmax(0, 1fr) 340px; }
@media (max-width: 980px) { .st-body { grid-template-columns: 1fr; } }
.st-docx p.sx-elig, .st-paper .sp.sx-elig { background-color: rgba(109, 74, 255, .07); }
.st-whole { border-color: rgba(109, 74, 255, .35); color: var(--hum-a); }
.btn-humanize.is-locked { background: linear-gradient(135deg, #9a93b8, #b3abd1); box-shadow: none; opacity: .9; }
.btn-humanize.is-locked:hover { opacity: 1; transform: none; }
.hum-lock { text-align: center; display: grid; gap: 12px; justify-items: center; }
.hum-lock p { font-size: 14px; line-height: 1.85; }
.hum-lock-ic { width: 56px; height: 56px; border-radius: 18px; display: grid; place-items: center; color: var(--hum-a); background: rgba(109, 74, 255, .12); }
.hum-lock-id { justify-content: center; gap: 8px; }
.hum-lock .modal-actions { width: 100%; justify-content: center; }

/* V5: عرض مطابق للتقرير */
.st-views { display: inline-flex !important; margin-bottom: 12px; }
.st-views button { display: inline-flex; align-items: center; gap: 6px; }
.st-pages { display: grid; gap: 16px; justify-items: center; }
.st-rep-note { display: flex; gap: 8px; align-items: flex-start; font-size: 12.5px; line-height: 1.8; color: var(--muted); background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; width: 100%; }
.st-rep-note .ico-sm { flex: none; margin-top: 3px; }
.st-pg { position: relative; width: 100%; max-width: 900px; background: #fff; box-shadow: var(--shadow-lg); border-radius: 4px; overflow: hidden; }
.st-pg img { position: absolute; inset: 0; width: 100%; height: 100%; display: block; user-select: none; }
.st-box { position: absolute; cursor: pointer; border-radius: 2px; transition: background-color .2s, box-shadow .2s; }
.st-box[data-i="-1"] { cursor: default; }
.st-box.hov { box-shadow: 0 0 0 2px rgba(109, 74, 255, .75); background: rgba(109, 74, 255, .08); }
.st-box.done { background: rgba(47, 158, 106, .42); box-shadow: inset 0 0 0 1px rgba(47, 158, 106, .7); }
.st-box.edited { background: rgba(201, 164, 103, .4); }
.st-box.busy { background: linear-gradient(90deg, rgba(109,74,255,.15), rgba(109,74,255,.45), rgba(109,74,255,.15)); background-size: 200% 100%; animation: stShimmer 1.2s linear infinite; }
.st-pop { position: fixed; z-index: 90; width: min(380px, calc(100vw - 20px)); background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow-lg); padding: 12px 14px; display: grid; gap: 8px; }
.st-pop-h { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.st-pop-h b { font-size: 13.5px; }
.st-pop-t { font-size: 13px; line-height: 1.8; color: var(--ink-2); max-height: 150px; overflow: auto; }
.st-pop-a { display: flex; gap: 8px; flex-wrap: wrap; }

/* BAHTHI_ONLYOFFICE_V1: نافذة Word */
.st-oo { width: 100%; height: calc(100vh - 170px); min-height: 640px; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: #f3f3f3; box-shadow: var(--shadow); }
.st-oo #st-oo-host, .st-oo iframe { width: 100%; height: 100%; border: 0; display: block; }
.st-docx > .st-rep-note { margin-bottom: 10px; }
@media (max-width: 980px) { .st-oo { height: 78vh; min-height: 520px; } }
