/*
 * هایلایت کد نتوبین — Stylesheet v1.0.0
 * Author: Yasin Kiani — https://yasinkiani.ir
 */

/* ═══════════════════════════════════════════════════════════
   فونت‌ها
═══════════════════════════════════════════════════════════ */
.ntb-font-fira-code       { --ntb-font: 'Fira Code',       'Fira Mono', monospace; }
.ntb-font-jetbrains-mono  { --ntb-font: 'JetBrains Mono',  monospace; }
.ntb-font-source-code-pro { --ntb-font: 'Source Code Pro', monospace; }
.ntb-font-roboto-mono     { --ntb-font: 'Roboto Mono',     monospace; }
.ntb-font-system          { --ntb-font: ui-monospace, 'SF Mono', Consolas, 'Courier New', monospace; }

/* ═══════════════════════════════════════════════════════════
   تم‌ها
═══════════════════════════════════════════════════════════ */

/* ── Material Ocean ── پیش‌فرض ──────────────────────────── */
.ntb-theme-material-ocean {
    --ntb-bg:           #1e2d3d;
    --ntb-header-bg:    #15202d;
    --ntb-hdr-border:   rgba(255,255,255,.07);
    --ntb-text:         #d6deeb;
    --ntb-label:        #7096b2;
    --ntb-dot-r:        #ff5f57;
    --ntb-dot-y:        #febc2e;
    --ntb-dot-g:        #28c840;
    --ntb-copy-bg:      rgba(255,255,255,.10);
    --ntb-copy-fg:      #7096b2;
    --ntb-copy-hbg:     rgba(255,255,255,.20);
    --ntb-copy-hfg:     #d6deeb;
    --ntb-copy-ok:      #addb67;
    --ntb-ln-fg:        #5d8aab;    /* ← روشن‌تر از قبل */
    --ntb-ln-border:    rgba(255,255,255,.12);
    --ntb-scroll:       rgba(255,255,255,.12);
    --ntb-border:       rgba(255,255,255,.07);
    /* سینتکس */
    --ntb-kw:       #c792ea;
    --ntb-str:      #ecc48d;
    --ntb-atv:      #c3e88d;
    --ntb-cmt:      #637777;
    --ntb-fn:       #82aaff;
    --ntb-cls:      #ffcb8b;
    --ntb-num:      #f78c6c;
    --ntb-op:       #c792ea;
    --ntb-var:      #f78c6c;
    --ntb-punc:     #c3ccdb;
    --ntb-tag:      #f07178;
    --ntb-prop:     #7fdbca;
}

/* ── Minimal Dark ────────────────────────────────────────── */
.ntb-theme-minimal-dark {
    --ntb-bg:           #1a1b26;
    --ntb-header-bg:    #16161e;
    --ntb-hdr-border:   rgba(255,255,255,.06);
    --ntb-text:         #a9b1d6;
    --ntb-label:        #565f89;
    --ntb-dot-r:        #ff5f57;
    --ntb-dot-y:        #febc2e;
    --ntb-dot-g:        #28c840;
    --ntb-copy-bg:      rgba(255,255,255,.08);
    --ntb-copy-fg:      #565f89;
    --ntb-copy-hbg:     rgba(255,255,255,.16);
    --ntb-copy-hfg:     #a9b1d6;
    --ntb-copy-ok:      #9ece6a;
    --ntb-ln-fg:        #565f89;
    --ntb-ln-border:    rgba(255,255,255,.08);
    --ntb-scroll:       rgba(255,255,255,.1);
    --ntb-border:       rgba(255,255,255,.06);
    --ntb-kw:   #bb9af7; --ntb-str:  #9ece6a; --ntb-atv:  #9ece6a;
    --ntb-cmt:  #4a5173; --ntb-fn:   #7aa2f7; --ntb-cls:  #2ac3de;
    --ntb-num:  #ff9e64; --ntb-op:   #89ddff; --ntb-var:  #e0af68;
    --ntb-punc: #89ddff; --ntb-tag:  #f7768e; --ntb-prop: #73daca;
}

/* ── Minimal Light ───────────────────────────────────────── */
.ntb-theme-minimal-light {
    --ntb-bg:           #f7f8fa;
    --ntb-header-bg:    #eef0f4;
    --ntb-hdr-border:   rgba(0,0,0,.07);
    --ntb-text:         #383a42;
    --ntb-label:        #9da5b4;
    --ntb-dot-r:        #ff5f57;
    --ntb-dot-y:        #febc2e;
    --ntb-dot-g:        #28c840;
    --ntb-copy-bg:      rgba(0,0,0,.07);
    --ntb-copy-fg:      #9da5b4;
    --ntb-copy-hbg:     rgba(0,0,0,.14);
    --ntb-copy-hfg:     #383a42;
    --ntb-copy-ok:      #50a14f;
    --ntb-ln-fg:        #9da5b4;
    --ntb-ln-border:    rgba(0,0,0,.1);
    --ntb-scroll:       rgba(0,0,0,.12);
    --ntb-border:       rgba(0,0,0,.08);
    --ntb-kw:   #a626a4; --ntb-str:  #50a14f; --ntb-atv:  #50a14f;
    --ntb-cmt:  #a0a1a7; --ntb-fn:   #4078f2; --ntb-cls:  #c18401;
    --ntb-num:  #986801; --ntb-op:   #0184bc; --ntb-var:  #e45649;
    --ntb-punc: #696c77; --ntb-tag:  #e45649; --ntb-prop: #0184bc;
}

/* ── Dracula ─────────────────────────────────────────────── */
.ntb-theme-dracula {
    --ntb-bg:           #282a36;
    --ntb-header-bg:    #21222c;
    --ntb-hdr-border:   rgba(255,255,255,.06);
    --ntb-text:         #f8f8f2;
    --ntb-label:        #6272a4;
    --ntb-dot-r:        #ff5555;
    --ntb-dot-y:        #f1fa8c;
    --ntb-dot-g:        #50fa7b;
    --ntb-copy-bg:      rgba(255,255,255,.08);
    --ntb-copy-fg:      #6272a4;
    --ntb-copy-hbg:     rgba(255,255,255,.18);
    --ntb-copy-hfg:     #f8f8f2;
    --ntb-copy-ok:      #50fa7b;
    --ntb-ln-fg:        #6272a4;
    --ntb-ln-border:    rgba(255,255,255,.1);
    --ntb-scroll:       rgba(255,255,255,.1);
    --ntb-border:       rgba(255,255,255,.06);
    --ntb-kw:   #ff79c6; --ntb-str:  #f1fa8c; --ntb-atv:  #f1fa8c;
    --ntb-cmt:  #6272a4; --ntb-fn:   #50fa7b; --ntb-cls:  #8be9fd;
    --ntb-num:  #bd93f9; --ntb-op:   #ff79c6; --ntb-var:  #8be9fd;
    --ntb-punc: #f8f8f2; --ntb-tag:  #ff79c6; --ntb-prop: #50fa7b;
}

/* ── Nord ────────────────────────────────────────────────── */
.ntb-theme-nord {
    --ntb-bg:           #2e3440;
    --ntb-header-bg:    #272c36;
    --ntb-hdr-border:   rgba(255,255,255,.06);
    --ntb-text:         #d8dee9;
    --ntb-label:        #616e87;
    --ntb-dot-r:        #bf616a;
    --ntb-dot-y:        #ebcb8b;
    --ntb-dot-g:        #a3be8c;
    --ntb-copy-bg:      rgba(255,255,255,.08);
    --ntb-copy-fg:      #616e87;
    --ntb-copy-hbg:     rgba(255,255,255,.16);
    --ntb-copy-hfg:     #d8dee9;
    --ntb-copy-ok:      #a3be8c;
    --ntb-ln-fg:        #616e87;
    --ntb-ln-border:    rgba(255,255,255,.1);
    --ntb-scroll:       rgba(255,255,255,.1);
    --ntb-border:       rgba(255,255,255,.06);
    --ntb-kw:   #81a1c1; --ntb-str:  #a3be8c; --ntb-atv:  #a3be8c;
    --ntb-cmt:  #616e87; --ntb-fn:   #88c0d0; --ntb-cls:  #8fbcbb;
    --ntb-num:  #b48ead; --ntb-op:   #81a1c1; --ntb-var:  #8fbcbb;
    --ntb-punc: #d8dee9; --ntb-tag:  #bf616a; --ntb-prop: #88c0d0;
}

/* ── Monokai ─────────────────────────────────────────────── */
.ntb-theme-monokai {
    --ntb-bg:           #272822;
    --ntb-header-bg:    #1e1f1c;
    --ntb-hdr-border:   rgba(255,255,255,.06);
    --ntb-text:         #f8f8f2;
    --ntb-label:        #75715e;
    --ntb-dot-r:        #f92672;
    --ntb-dot-y:        #e6db74;
    --ntb-dot-g:        #a6e22e;
    --ntb-copy-bg:      rgba(255,255,255,.08);
    --ntb-copy-fg:      #75715e;
    --ntb-copy-hbg:     rgba(255,255,255,.16);
    --ntb-copy-hfg:     #f8f8f2;
    --ntb-copy-ok:      #a6e22e;
    --ntb-ln-fg:        #75715e;
    --ntb-ln-border:    rgba(255,255,255,.1);
    --ntb-scroll:       rgba(255,255,255,.1);
    --ntb-border:       rgba(255,255,255,.06);
    --ntb-kw:   #f92672; --ntb-str:  #e6db74; --ntb-atv:  #e6db74;
    --ntb-cmt:  #75715e; --ntb-fn:   #a6e22e; --ntb-cls:  #a6e22e;
    --ntb-num:  #ae81ff; --ntb-op:   #f92672; --ntb-var:  #66d9e8;
    --ntb-punc: #f8f8f2; --ntb-tag:  #f92672; --ntb-prop: #a6e22e;
}

/* ── GitHub Dark ─────────────────────────────────────────── */
.ntb-theme-github-dark {
    --ntb-bg:           #0d1117;
    --ntb-header-bg:    #080c10;
    --ntb-hdr-border:   rgba(255,255,255,.05);
    --ntb-text:         #e6edf3;
    --ntb-label:        #6e7681;
    --ntb-dot-r:        #f85149;
    --ntb-dot-y:        #d29922;
    --ntb-dot-g:        #3fb950;
    --ntb-copy-bg:      rgba(255,255,255,.07);
    --ntb-copy-fg:      #6e7681;
    --ntb-copy-hbg:     rgba(255,255,255,.15);
    --ntb-copy-hfg:     #e6edf3;
    --ntb-copy-ok:      #3fb950;
    --ntb-ln-fg:        #6e7681;
    --ntb-ln-border:    rgba(255,255,255,.09);
    --ntb-scroll:       rgba(255,255,255,.09);
    --ntb-border:       rgba(255,255,255,.05);
    --ntb-kw:   #ff7b72; --ntb-str:  #a5d6ff; --ntb-atv:  #a5d6ff;
    --ntb-cmt:  #8b949e; --ntb-fn:   #d2a8ff; --ntb-cls:  #7ee787;
    --ntb-num:  #79c0ff; --ntb-op:   #ff7b72; --ntb-var:  #ffa657;
    --ntb-punc: #e6edf3; --ntb-tag:  #7ee787; --ntb-prop: #79c0ff;
}

/* ── One Dark Pro ────────────────────────────────────────── */
.ntb-theme-one-dark {
    --ntb-bg:           #282c34;
    --ntb-header-bg:    #21252b;
    --ntb-hdr-border:   rgba(255,255,255,.06);
    --ntb-text:         #abb2bf;
    --ntb-label:        #6b7280;
    --ntb-dot-r:        #e06c75;
    --ntb-dot-y:        #e5c07b;
    --ntb-dot-g:        #98c379;
    --ntb-copy-bg:      rgba(255,255,255,.08);
    --ntb-copy-fg:      #6b7280;
    --ntb-copy-hbg:     rgba(255,255,255,.16);
    --ntb-copy-hfg:     #abb2bf;
    --ntb-copy-ok:      #98c379;
    --ntb-ln-fg:        #6b7280;
    --ntb-ln-border:    rgba(255,255,255,.1);
    --ntb-scroll:       rgba(255,255,255,.1);
    --ntb-border:       rgba(255,255,255,.06);
    --ntb-kw:   #c678dd; --ntb-str:  #98c379; --ntb-atv:  #98c379;
    --ntb-cmt:  #5c6370; --ntb-fn:   #61afef; --ntb-cls:  #e5c07b;
    --ntb-num:  #d19a66; --ntb-op:   #56b6c2; --ntb-var:  #e06c75;
    --ntb-punc: #abb2bf; --ntb-tag:  #e06c75; --ntb-prop: #56b6c2;
}

/* ═══════════════════════════════════════════════════════════
   کانتینر اصلی
═══════════════════════════════════════════════════════════ */
.ntb-wrapper {
    position:         relative;
    border-radius:    10px;
    overflow:         hidden;
    font-family:      var(--ntb-font, 'Fira Code', monospace);
    background-color: var(--ntb-bg, #1e2d3d);
    border:           1px solid var(--ntb-border, rgba(255,255,255,.07));
    display:          flex;
    flex-direction:   column;
}

/* ═══════════════════════════════════════════════════════════
   هدر
═══════════════════════════════════════════════════════════ */
.ntb-header {
    display:          flex;
    align-items:      center;
    gap:              10px;
    padding:          9px 14px;
    background-color: var(--ntb-header-bg, #15202d);
    border-bottom:    1px solid var(--ntb-hdr-border, rgba(255,255,255,.07));
    flex-shrink:      0;
    min-height:       42px;
}

/* دکمه‌های macOS */
.ntb-dots {
    display: flex;
    gap: 6px;
    align-items: center;
    flex-shrink: 0;
}
.ntb-dot {
    width: 12px; height: 12px;
    border-radius: 50%;
    flex-shrink: 0;
}
.ntb-dot-red    { background-color: var(--ntb-dot-r, #ff5f57); }
.ntb-dot-yellow { background-color: var(--ntb-dot-y, #febc2e); }
.ntb-dot-green  { background-color: var(--ntb-dot-g, #28c840); }

/* برچسب زبان */
.ntb-label {
    flex:           1;
    font-size:      11px;
    font-family:    var(--ntb-font, monospace);
    color:          var(--ntb-label, #7096b2);
    letter-spacing: .1em;
    text-transform: uppercase;
    font-weight:    500;
    white-space:    nowrap;
    overflow:       hidden;
    text-overflow:  ellipsis;
    min-width:      0;
}

/* ═══════════════════════════════════════════════════════════
   دکمه کپی — دایره‌ای
═══════════════════════════════════════════════════════════ */
.ntb-copy-btn {
    /* ← دایره‌ای */
    width:            34px;
    height:           34px;
    border-radius:    50%;
    flex-shrink:      0;

    /* layout */
    display:          inline-flex;
    align-items:      center;
    justify-content:  center;
    gap:              0;
    padding:          0;

    /* ظاهر */
    border:           none;
    cursor:           pointer;
    font-family:      var(--ntb-font, monospace);
    font-size:        12px;
    background-color: var(--ntb-copy-bg, rgba(255,255,255,.10));
    color:            var(--ntb-copy-fg, #7096b2);
    transition:       background-color .18s, color .18s, transform .12s;
    outline:          none;
    user-select:      none;
    -webkit-user-select: none;
}
.ntb-copy-btn:hover {
    background-color: var(--ntb-copy-hbg, rgba(255,255,255,.20));
    color:            var(--ntb-copy-hfg, #d6deeb);
    transform:        scale(1.08);
}
.ntb-copy-btn:active  { transform: scale(.94); }
.ntb-copy-btn.ntb-copied { color: var(--ntb-copy-ok, #addb67); }

/* متن دکمه — پنهان به صورت پیش‌فرض (آیکون‌محور) */
.ntb-copy-btn .ntb-copy-text {
    display: none;
}

/* اگر کاربر بخواهد متن نمایش داده شود (از Elementor toggle) */
.ntb-copy-btn.ntb-btn-with-text {
    width:         auto;
    border-radius: 20px;
    padding:       0 12px;
    gap:           5px;
}
.ntb-copy-btn.ntb-btn-with-text .ntb-copy-text { display: inline; }

/* دکمه شناور (بدون هدر) */
.ntb-copy-floating {
    position:       absolute;
    top:            10px;
    right:          10px;
    opacity:        0;
    pointer-events: none;
    transition:     opacity .2s, transform .12s;
    z-index:        10;
}
.ntb-wrapper:hover .ntb-copy-floating {
    opacity:        1;
    pointer-events: auto;
}

/* ═══════════════════════════════════════════════════════════
   ناحیه کد
═══════════════════════════════════════════════════════════ */
.ntb-code-container {
    position:   relative;
    overflow-x: auto;
    overflow-y: hidden;
    flex:       1;
}

/* ─── ریست و پایه pre/code ──────────────────────────────── */
.ntb-wrapper pre[class*="language-"],
.ntb-wrapper .ntb-code-block {
    margin:        0 !important;
    background:    transparent !important;
    border:        none !important;
    box-shadow:    none !important;
    border-radius: 0 !important;
    /* padding با Elementor قابل ویرایش است */
    padding:       1.4em 1.6em !important;
    font-size:     14px;
    line-height:   1.75;
    tab-size:      2;
    font-family:   var(--ntb-font, 'Fira Code', monospace) !important;
    /* ← بدون overflow: visible — اجازه می‌دهیم line-numbers کار کند */
    overflow:      visible;
    position:      relative;   /* برای line-numbers plugin */
}

.ntb-wrapper code[class*="language-"],
.ntb-wrapper pre code {
    background:  transparent !important;
    color:       var(--ntb-text, #d6deeb) !important;
    font-family: var(--ntb-font, 'Fira Code', monospace) !important;
    font-size:   inherit !important;
    white-space: pre;
    word-break:  normal;
    word-spacing: normal;
    hyphens:     none;
    display:     block;   /* برای white-space در wrap mode */
}

/* ─── شکست خط (word-wrap) ───────────────────────────────── */
.ntb-wrapper.ntb-wrap pre[class*="language-"],
.ntb-wrapper.ntb-wrap .ntb-code-block {
    white-space:    pre-wrap !important;
}
.ntb-wrapper.ntb-wrap code[class*="language-"],
.ntb-wrapper.ntb-wrap pre code {
    white-space:    pre-wrap !important;
    word-break:     break-word !important;
    overflow-wrap:  break-word !important;
}

/* ─── رفع مشکل overflow وقتی ntb-ln-wrap ساخته شده ──────── */
/* inline-flex اجازه می‌دهد محتوا از کادر بزند بیرون؛
   در حالت wrap به flex معمولی تبدیل می‌کنیم تا pre محدود شود */
.ntb-wrapper.ntb-wrap .ntb-code-container {
    overflow-x: hidden;
}
.ntb-wrapper.ntb-wrap .ntb-ln-wrap {
    display: flex;
    width:   100%;
}
.ntb-wrapper.ntb-wrap .ntb-ln-wrap > pre {
    flex-shrink: 1;
    min-width:   0;  /* ← اجازه می‌دهد pre کوچک‌تر از محتوا شود → wrap */
}

/* ─── قالب‌بندی HTML داخل کد (allow_html_in_code) ──────── */
.ntb-wrapper pre code strong,
.ntb-wrapper pre code b      { font-weight: 700 !important; }

.ntb-wrapper pre code em,
.ntb-wrapper pre code i      { font-style: italic !important; }

.ntb-wrapper pre code u      { text-decoration: underline; }

.ntb-wrapper pre code s,
.ntb-wrapper pre code del    { text-decoration: line-through; opacity: .65; }

.ntb-wrapper pre code mark   {
    background:    rgba(255,210,50,.30);
    border-radius: 3px;
    padding:       0 .2em;
    color:         inherit;
}

/* ─── تک‌رنگ (رنگ‌آمیزی خاموش) ─────────────────────────── */
.ntb-wrapper.ntb-mono .token {
    color:       inherit !important;
    font-style:  normal !important;
    font-weight: inherit !important;
}

/* ═══════════════════════════════════════════════════════════
   رنگ‌های توکن سینتکس — فقط در حالت ntb-colors
═══════════════════════════════════════════════════════════ */

/* کلیدواژه */
.ntb-wrapper.ntb-colors .token.keyword,
.ntb-wrapper.ntb-colors .token.important,
.ntb-wrapper.ntb-colors .token.atrule,
.ntb-wrapper.ntb-colors .token.rule,
.ntb-wrapper.ntb-colors .token.builtin        { color: var(--ntb-kw)   !important; font-weight: 600; }

/* رشته JS */
.ntb-wrapper.ntb-colors .token.string,
.ntb-wrapper.ntb-colors .token.char           { color: var(--ntb-str)  !important; }

/* مقدار attr HTML/JSX — رنگ جداگانه */
.ntb-wrapper.ntb-colors .token.attr-value,
.ntb-wrapper.ntb-colors .token.attr-value .token.string,
.ntb-wrapper.ntb-colors .token.attr-value .token.punctuation { color: var(--ntb-atv, var(--ntb-str)) !important; }

/* کامنت */
.ntb-wrapper.ntb-colors .token.comment,
.ntb-wrapper.ntb-colors .token.prolog,
.ntb-wrapper.ntb-colors .token.doctype,
.ntb-wrapper.ntb-colors .token.cdata          { color: var(--ntb-cmt)  !important; font-style: italic; }

/* توابع */
.ntb-wrapper.ntb-colors .token.function,
.ntb-wrapper.ntb-colors .token.function-name  { color: var(--ntb-fn)   !important; }

/* نام کلاس */
.ntb-wrapper.ntb-colors .token.class-name     { color: var(--ntb-cls)  !important; }

/* اعداد */
.ntb-wrapper.ntb-colors .token.number,
.ntb-wrapper.ntb-colors .token.boolean,
.ntb-wrapper.ntb-colors .token.constant       { color: var(--ntb-num)  !important; }

/* اپراتور */
.ntb-wrapper.ntb-colors .token.operator,
.ntb-wrapper.ntb-colors .token.entity,
.ntb-wrapper.ntb-colors .token.url            { color: var(--ntb-op)   !important; }

/* متغیر / پارامتر */
.ntb-wrapper.ntb-colors .token.variable,
.ntb-wrapper.ntb-colors .token.parameter      { color: var(--ntb-var)  !important; }

/* attr-name: className, onClick */
.ntb-wrapper.ntb-colors .token.attr-name      { color: var(--ntb-prop) !important; }

/* نقطه‌گذاری */
.ntb-wrapper.ntb-colors .token.punctuation    { color: var(--ntb-punc) !important; }

/* تگ HTML/JSX */
.ntb-wrapper.ntb-colors .token.tag            { color: var(--ntb-tag)  !important; }
.ntb-wrapper.ntb-colors .token.tag .token.punctuation { color: var(--ntb-tag) !important; }
.ntb-wrapper.ntb-colors .token.tag .token.attr-name   { color: var(--ntb-prop) !important; }

/* property / selector */
.ntb-wrapper.ntb-colors .token.property,
.ntb-wrapper.ntb-colors .token.selector,
.ntb-wrapper.ntb-colors .token.symbol         { color: var(--ntb-prop) !important; }

.ntb-wrapper.ntb-colors .token.namespace      { opacity: .75; }

/* ═══════════════════════════════════════════════════════════
   شماره خط — سیستم کاستوم (flex-based)
═══════════════════════════════════════════════════════════ */

/* مخفی‌کردن المان‌های Prism line-numbers plugin — ما سیستم خودمان را داریم */
.ntb-wrapper .line-numbers-rows { display: none !important; }
/* padding اضافه Prism را ریست کنیم */
.ntb-wrapper pre.line-numbers    { padding-left: 1.6em !important; }

/* ── wrapper داخلی: ستون عدد + pre در یک ردیف ── */
.ntb-ln-wrap {
    display:     inline-flex;
    min-width:   100%;
    align-items: stretch;
    direction:   ltr;   /* اعداد همیشه سمت چپ — مستقل از RTL صفحه */
}

/* ── ستون اعداد ── */
.ntb-ln-col {
    display:        flex;
    flex-direction: column;
    flex-shrink:    0;

    background:   var(--ntb-header-bg, #15202d);
    border-right: 1px solid var(--ntb-ln-border, rgba(255,255,255,.12));

    padding:     1.4em 0;        /* همتراز با padding-top/bottom بلوک کد */
    min-width:   2.8em;

    font-family: var(--ntb-font, 'Fira Code', monospace);
    font-size:   14px;           /* مطابق pre پیش‌فرض */
    line-height: 1.75;           /* مطابق pre */
    color:       var(--ntb-ln-fg, #5d8aab);

    user-select:        none;
    -webkit-user-select: none;
    pointer-events:     none;
}

.ntb-ln-col span {
    display:     block;
    padding:     0 0.7em;
    text-align:  right;
    white-space: nowrap;
    line-height: inherit;
}

/* pre در کنار ستون اعداد — grow می‌کند ولی زیر عرض محتوا نمی‌رود */
.ntb-ln-wrap > pre {
    flex-grow:   1;
    flex-shrink: 0;      /* ← نباید از عرض محتوا کوچک‌تر شود */
    flex-basis:  auto;
}

/* ═══════════════════════════════════════════════════════════
   رفع فاصله اضافی در حالت متن ساده
   (جلوگیری از کشیده‌شدن توسط flex-stretch المنتور)
═══════════════════════════════════════════════════════════ */
.ntb-wrapper.ntb-plain {
    height:     fit-content;   /* ارتفاع = محتوا، نه stretch فلکس */
    align-self: flex-start;    /* در ردیف‌های المنتور کشیده نشود */
}
.ntb-wrapper.ntb-plain .ntb-code-container {
    flex: none;                /* کانتینر کد فقط به اندازه محتوا باشد */
}
/* بلوک متن ساده: padding بالا/پایین برداشته می‌شود
   (دو سلکتور: اول با ntb-plain، دوم مستقیم روی ntb-rich-content — برای اطمینان) */
.ntb-wrapper.ntb-plain .ntb-code-block,
.ntb-wrapper .ntb-code-block.ntb-rich-content {
    padding-top:    0 !important;
    padding-bottom: 0 !important;
}
/* اولین و آخرین فرزند در rich content هم margin نداشته باشند */
.ntb-rich-content > *:first-child { margin-top:    0 !important; }
.ntb-rich-content > *:last-child  { margin-bottom: 0 !important; }
/* کانتینر متن ساده که محتوا ندارد (ntb-empty) — کاملاً مخفی می‌شود */
.ntb-code-container.ntb-empty {
    display: none;
}

/* ═══════════════════════════════════════════════════════════
   ویرایشگر متن غنی (WYSIWYG) — حالت متن ساده / پرامپت AI
   (کلاس ntb-code-block روی این div نیست — padding مستقیم تنظیم می‌شود)
═══════════════════════════════════════════════════════════ */
.ntb-rich-content {
    width:          100%;
    box-sizing:     border-box;
    font-family:    var(--ntb-font, 'Fira Code', monospace) !important;
    font-size:      14px;
    line-height:    1.75;
    color:          var(--ntb-text, #d6deeb);
    /* padding: بالا/پایین کم، چپ/راست مانند بلوک کد */
    padding:        0.8em 1.6em;
    /* ریست‌های لازم */
    margin:         0 !important;
    background:     transparent !important;
    border:         none !important;
    box-shadow:     none !important;
    border-radius:  0 !important;
    /* شکست خط */
    word-break:     break-word;
    overflow-wrap:  break-word;
}

/* ریست مارجین پاراگراف‌ها */
.ntb-rich-content p             { margin: 0 !important; }
.ntb-rich-content p + p         { margin-top: 0.4em !important; }

/* قالب‌بندی متن */
.ntb-rich-content strong,
.ntb-rich-content b             { font-weight: 700; color: inherit; }
.ntb-rich-content em,
.ntb-rich-content i             { font-style: italic; color: inherit; }
.ntb-rich-content u             { text-decoration: underline; }
.ntb-rich-content s,
.ntb-rich-content del           { text-decoration: line-through; opacity: .65; }

/* لینک */
.ntb-rich-content a             { color: var(--ntb-fn, #82aaff); text-decoration: none; }
.ntb-rich-content a:hover       { text-decoration: underline; }

/* لیست */
.ntb-rich-content ul,
.ntb-rich-content ol            { padding-inline-start: 1.8em; margin: 0 0 .55em; }
.ntb-rich-content li            { margin-bottom: .3em; }

/* هدینگ داخل پرامپت */
.ntb-rich-content h1,.ntb-rich-content h2,
.ntb-rich-content h3,.ntb-rich-content h4 {
    margin: .6em 0 .3em;
    font-weight: 700;
    color: var(--ntb-fn, #82aaff);
    line-height: 1.4;
}

/* کد inline داخل پرامپت */
.ntb-rich-content code {
    background:    rgba(255,255,255,.1);
    border-radius: 3px;
    padding:       .1em .35em;
    font-family:   inherit;
    font-size:     .9em;
}

/* ═══════════════════════════════════════════════════════════
   اسکرول‌بار
═══════════════════════════════════════════════════════════ */
.ntb-code-container::-webkit-scrollbar         { height: 5px; width: 5px; }
.ntb-code-container::-webkit-scrollbar-track   { background: transparent; }
.ntb-code-container::-webkit-scrollbar-thumb   {
    background:    var(--ntb-scroll, rgba(255,255,255,.12));
    border-radius: 3px;
}
.ntb-code-container::-webkit-scrollbar-thumb:hover { filter: brightness(1.5); }

/* ═══════════════════════════════════════════════════════════
   آیکون SVG
═══════════════════════════════════════════════════════════ */
.ntb-icon-copy, .ntb-icon-ok {
    flex-shrink:    0;
    vertical-align: middle;
    pointer-events: none;
    display:        block;
}

/* ═══════════════════════════════════════════════════════════
   ریسپانسیو
═══════════════════════════════════════════════════════════ */
@media (max-width: 768px) {
    /* هدر کوچک‌تر در موبایل */
    .ntb-header {
        padding:    5px 10px;
        min-height: 32px;
        gap:        6px;
    }
    .ntb-label  { font-size: 10px; }
    .ntb-dot    { width: 9px; height: 9px; }

    /* دکمه کپی در موبایل — فقط آیکون (دایره‌ای، بدون متن) */
    .ntb-copy-btn,
    .ntb-copy-btn.ntb-btn-with-text {
        width:         28px;
        height:        28px;
        border-radius: 50%;
        padding:       0;
        gap:           0;
        flex-shrink:   0;
    }
    .ntb-copy-btn.ntb-btn-with-text .ntb-copy-text { display: none; }

    /* کد و شماره خط */
    .ntb-wrapper pre[class*="language-"],
    .ntb-wrapper .ntb-code-block {
        font-size: 13px !important;
        padding:   1em 1.1em !important;
    }
    .ntb-ln-col { font-size: 13px; padding: 1em 0; }
}

@media (max-width: 480px) {
    .ntb-header {
        padding:    4px 8px;
        min-height: 28px;
        gap:        5px;
    }
    .ntb-label  { font-size: 9px; }
    .ntb-dot    { width: 8px; height: 8px; }

    .ntb-copy-btn,
    .ntb-copy-btn.ntb-btn-with-text {
        width:  26px;
        height: 26px;
    }

    .ntb-wrapper pre[class*="language-"],
    .ntb-wrapper .ntb-code-block {
        font-size: 12px !important;
        padding:   .9em 1em !important;
    }
    .ntb-ln-col { font-size: 12px; padding: .9em 0; }
}
