/* ============================================================================
   superblocks.css — стили для блочного редактора (robx-superblocks)
   ----------------------------------------------------------------------------
   Подключение:
     <link rel="stylesheet" href="/shared/superblocks/superblocks.css">
     <script src="/shared/superblocks/superblocks.js" defer></script>

   Скоупа НЕТ: селекторы (`.notion-*`, `.ct-*`, `.pdf-viewer*`, `.gpt-modal*`)
   живут глобально, чтобы редактор работал без обязательной обёртки
   `.edu-root` и его можно было подключать в любую страницу — в discussion-
   panel, чат, на сторонний сайт. Все классы префиксованы доменом редактора,
   так что коллизий с обычным host-CSS быть не должно. Если на host-странице
   уже определён хотя бы один из этих классов — оборачивай редактор в свой
   контейнер и переопределяй стили внутри него.
   ============================================================================ */

/* Block editor (robx-superblocks) — seamless, no inner scroll */
.notion-editor-wrap{background:transparent;padding:0;margin:0;border:none;min-height:120px}
.notion-editor-wrap.readonly{background:transparent}
.notion-editor__content{display:flex;flex-direction:column;gap:0}
.notion-block{display:flex;align-items:flex-start;gap:3px;padding:0 6px;border-radius:8px;border:none;background:transparent;min-height:38px;position:relative}
.notion-block__handle{cursor:grab;color:#8f9db0;font-size:24px;line-height:1;user-select:none;opacity:0;transition:opacity .2s}
.notion-block:hover .notion-block__handle{opacity:1}
.notion-block__handle:active{cursor:grabbing}
.notion-block__content{flex:1;min-height:22px;outline:none;padding:6px 8px;border-radius:6px;font-size:15px;color:#3c4043;line-height:1.6}
.notion-block__content:empty::before{content:attr(data-placeholder);color:#9aa6b2}
.notion-block__content p{margin:0;line-height:1.5}
/* Heading scale: the block itself provides vertical rhythm, so headings get
   zero margin. Sizes are a clean descending ladder — never shrink below p. */
.notion-block__content h1,
.notion-block__content h2,
.notion-block__content h3,
.notion-block__content h4,
.notion-block__content h5,
.notion-block__content h6{margin:0;line-height:1.3;font-family:inherit;color:inherit}
.notion-block__content h1{font-size:26px;font-weight:700}
.notion-block__content h2{font-size:22px;font-weight:700}
.notion-block__content h3{font-size:18px;font-weight:700}
.notion-block__content h4{font-size:16px;font-weight:600}
.notion-block__content h5{font-size:15px;font-weight:600}
.notion-block__content h6{font-size:14px;font-weight:600;color:#5f6368}
.notion-add-block{align-self:flex-start;display:inline-flex;align-items:center;gap:8px;padding:8px 14px;border-radius:999px;border:1px solid rgba(26,115,232,.3);background:rgba(26,115,232,.05);color:#1a73e8;font-weight:600;cursor:pointer}
.notion-add-block:hover,.notion-add-block:focus{background:rgba(26,115,232,.12);border-color:rgba(26,115,232,.5);outline:none}
.notion-add-block-menu{position:relative;align-self:flex-start;margin-top:10px}
.notion-add-block-menu summary{list-style:none;display:inline-block}
.notion-add-block-menu summary::-webkit-details-marker{display:none}
/* Add-block popup — matches the hover-«+» popup in robx-superblocks.js
   (.rsb-add-menu) so both entry points read identically. NOT scoped to
   because positionAddBlockMenu portals the element to <body>
   to escape transformed ancestors. */
.notion-add-block-options{background:#fff;border:1px solid rgba(0,0,0,.08);border-radius:10px;box-shadow:0 8px 24px rgba(0,0,0,.16);padding:6px;display:none;flex-direction:column;gap:2px;min-width:220px;z-index:5000;font-family:inherit}
details.notion-add-block-menu[open] > .notion-add-block-options{display:flex}
.notion-add-block-option{border:none;background:none;color:#3c4043;padding:8px 12px;border-radius:6px;cursor:pointer;font-size:13.5px;font-weight:500;text-align:left;font-family:inherit;white-space:nowrap}
.notion-add-block-option:hover,.notion-add-block-option:focus{background:rgba(26,115,232,.08);color:#1a73e8;outline:none}
.editor-loading{padding:24px;text-align:center;color:#9aa0a6;font-size:13px}

/* ===== robx-superblocks: per-block overlays / menus / media ===== */
/* Block types */
.notion-block__content--media{display:flex;flex-direction:column;gap:10px;padding:10px;border:1px dashed rgba(26,115,232,.3);background:transparent;border-radius:8px;width:100%;max-width:100%;min-width:240px;min-height:140px;overflow:hidden;box-sizing:border-box;align-self:flex-start;flex:none;margin-left:auto;margin-right:auto}
.notion-block__content--media[data-file-id]:not([data-file-id=""]){border:none;padding:0}
.notion-media-resize-handle{position:absolute;background:transparent;z-index:4;pointer-events:auto}
.notion-media-resize-handle.is-left,.notion-media-resize-handle.is-right{top:0;bottom:0;width:10px;cursor:ew-resize}
.notion-media-resize-handle.is-left{left:0}
.notion-media-resize-handle.is-right{right:0}
.notion-media-resize-handle.is-top,.notion-media-resize-handle.is-bottom{left:0;right:0;height:10px;cursor:ns-resize}
.notion-media-resize-handle.is-top{top:0}
.notion-media-resize-handle.is-bottom{bottom:0}
.notion-block__content--code{
  flex:1;background:#111 !important;color:#f8f8f2 !important;
  border-radius:8px;padding:14px 16px 14px 0;margin:0;
  font-family:"SF Mono","Consolas","Monaco","Courier New",monospace;
  font-size:13.5px;line-height:1.55;white-space:pre-wrap;
  counter-reset:code-line;tab-size:4;-moz-tab-size:4;
  overflow:auto;box-sizing:border-box;
}
.notion-block__content--code:focus{background:#111 !important;box-shadow:none;outline:1px solid rgba(26,115,232,.35)}
/* Line numbers: each top-level line (browser wraps contenteditable lines in <div>)
   gets an auto-incremented counter shown in a fixed-width gutter.
   Hanging indent (padding-left + negative text-indent): первая визуальная
   строка с ::before-номером сидит у левого края, а wrapped-continuation
   респектит padding-left и не уезжает под номера. Без этого длинные
   строки с мягким переносом наезжали на gutter. */
.notion-block__content--code > div,
.notion-block__content--code > p{
  margin:0;padding:0 0 0 4.5em;text-indent:-4.5em;display:block
}
.notion-block__content--code > *::before{
  counter-increment:code-line;content:counter(code-line);
  display:inline-block;width:3em;padding-right:1em;margin-right:.5em;
  text-align:right;color:#6b7890;user-select:none;
  border-right:1px solid rgba(255,255,255,.08);
}
/* If the editor renders the content as a single text node (no wrapper lines),
   fall back to a single "1" counter on the plain text. */
.notion-block__content--code:empty::before,
.notion-block__content--code::first-line{/* keep natural */}
.notion-block__content--pdf{border:1px solid #e0e0e0;border-radius:8px;overflow:hidden;background:#f8f8f8;padding:0}
.pdf-viewer{display:flex;flex-direction:column;align-items:center}
.pdf-viewer__canvas-wrap{width:100%;display:flex;justify-content:center;background:#525659;min-height:300px}
.pdf-viewer__canvas-wrap canvas{max-width:100%;height:auto!important}
.pdf-viewer__controls{display:flex;align-items:center;justify-content:center;gap:12px;padding:10px 16px;background:#fff;border-top:1px solid #e0e0e0;width:100%}
.pdf-viewer__controls button{padding:6px 14px;border:1px solid #d0d0d0;border-radius:6px;background:#f5f5f5;cursor:pointer;font-size:14px;font-weight:600;color:#333}
.pdf-viewer__controls button:hover:not(:disabled){background:#e0e0e0}
.pdf-viewer__controls button:disabled{opacity:.4;cursor:default}
.pdf-viewer__page-info{font-size:14px;color:#555;font-weight:500}
.pdf-upload-area{display:flex;flex-direction:column;align-items:center;justify-content:center;padding:48px 24px;color:#888;gap:12px}
.pdf-upload-area i{font-size:40px;color:#ccc}
.pdf-upload-btn{padding:8px 20px;background:#1a73e8;color:#fff;border:none;border-radius:8px;cursor:pointer;font-size:14px;font-weight:600}
.pdf-upload-btn:hover{background:#0046cc}
.notion-block__content--quote{border-left:3px solid rgba(26,115,232,.5);padding:8px 12px;background:rgba(26,115,232,.05);border-radius:8px;font-style:italic}
.notion-block__content--table{padding:10px;border:none;border-radius:8px}
.notion-block__content--quiz{padding:12px;border:1px dashed rgba(26,115,232,.4);border-radius:8px;background:rgba(26,115,232,.03)}
.notion-quiz-label{display:flex;align-items:center;gap:8px;margin-bottom:8px;font-weight:600;color:#1a73e8}
.notion-quiz-select{width:100%;padding:8px 12px;border:1px solid #d6dbe6;border-radius:8px;font-size:14px;background:#fff;cursor:pointer}
.notion-quiz-select:focus{outline:none;border-color:#1a73e8}

/* Code trainer */
.notion-block__content--code-trainer{padding:0;border:1px solid #d6dbe6;border-radius:8px;overflow:hidden}
.ct-toolbar{display:flex;align-items:center;gap:4px;padding:8px 12px;background:#f2f4f5;border-bottom:1px solid #d6dbe6;flex-wrap:wrap}
.ct-lang-tab{padding:5px 12px;border-radius:14px;font-size:13px;font-weight:500;cursor:pointer;background:transparent;color:#666;transition:all .15s;user-select:none;border:none;font-family:inherit}
.ct-lang-tab:hover{background:#e0e0e0}
.ct-lang-tab--active{background:#1a73e8;color:#fff}
.ct-lang-tab--active:hover{background:#1765cc}
.ct-run-btn{margin-left:auto;padding:5px 14px;border-radius:14px;border:none;background:#00aa55;color:#fff;font-size:13px;font-weight:500;cursor:pointer;display:flex;align-items:center;gap:6px;font-family:inherit}
.ct-run-btn:hover{background:#009944}
.ct-run-icon{display:inline-block;width:0;height:0;border-style:solid;border-width:5px 0 5px 9px;border-color:transparent transparent transparent #fff}
.ct-textarea{width:100%;box-sizing:border-box;border:none;resize:vertical;font-family:inherit}
.notion-block__content--code-trainer .CodeMirror{height:250px;font-size:14px;font-family:"Courier New",Consolas,monospace;border:none;background:#212121}
.ct-output{border-top:1px solid #d6dbe6;background:#1e1e1e;color:#d4d4d4}
.ct-output-header{padding:6px 12px;font-size:12px;font-weight:600;color:#888;border-bottom:1px solid #333}
.ct-output-pre{margin:0;padding:10px 12px;font-family:"Courier New",Consolas,monospace;font-size:13px;white-space:pre-wrap;word-break:break-all}

/* Table */
.notion-table{width:100%;border-collapse:separate;border-spacing:0;border:.5px solid #d6dbe6;border-radius:12px;overflow:hidden;background:#fff}
.notion-table td,.notion-table th{border:.5px solid #d6dbe6;padding:6px 8px;min-width:40px;background:#fff;position:relative}
.notion-table td:hover,.notion-table th:hover{background:#f2f4f8;box-shadow:inset 0 0 0 1px #b8bfcb}
.notion-table td:focus,.notion-table th:focus,.notion-table td:focus-visible,.notion-table th:focus-visible{outline:none;box-shadow:none}
.notion-table-cell-selected,.notion-table-cell-selected:hover{background:rgba(26,115,232,.08);box-shadow:inset 0 0 0 2px #1e6fff}
.notion-table-resizer-col{position:absolute;top:0;right:-2px;width:4px;height:100%;cursor:col-resize;z-index:2}
.notion-table-resizer-row{position:absolute;left:0;bottom:-2px;width:100%;height:4px;cursor:row-resize;z-index:2}
.notion-table-wrapper{position:relative;display:inline-block;max-width:100%}
.notion-table-add-col,.notion-table-add-row{position:absolute;width:18px;height:18px;border-radius:50%;border:none;background:#eef0f5;color:#5b6475;display:inline-flex;align-items:center;justify-content:center;cursor:pointer;font-size:13px;font-weight:600;line-height:1;padding:0;opacity:0;pointer-events:none;font-family:inherit;box-shadow:0 1px 3px rgba(0,0,0,.08)}
.notion-table-add-col{transform:translateX(-50%)}
.notion-table-add-row{transform:translateY(-50%)}
.notion-table-add-col:hover,.notion-table-add-row:hover,.notion-table-add-col:focus,.notion-table-add-row:focus{background:#e7eaf2;outline:none}
.notion-block:hover .notion-table-add-col[data-positioned="true"],.notion-block:hover .notion-table-add-row[data-positioned="true"]{opacity:1;pointer-events:auto}
.notion-table-row-btn,.notion-table-col-btn{position:absolute;border-radius:6px;border:none;background:#eef0f5;color:#6b7280;display:inline-flex;align-items:center;justify-content:center;font-size:12px;cursor:pointer;opacity:0;pointer-events:none;font-family:inherit}
.notion-table-row-btn{width:8px;height:18px}
.notion-table-col-btn{width:18px;height:8px}
.notion-table-row-btn:hover,.notion-table-col-btn:hover,.notion-table-row-btn:focus,.notion-table-col-btn:focus{background:#e3e6ef;outline:none}
.notion-table-menu{position:absolute;background:#fff;border:1px solid #d6dbe6;border-radius:8px;box-shadow:0 8px 24px rgba(0,0,0,.12);padding:6px;display:none;flex-direction:column;gap:6px;z-index:6}
.notion-table-menu button{border:none;background:#f5f6fa;color:#4b5563;padding:6px 10px;border-radius:6px;cursor:pointer;font-size:12px;font-weight:600;text-align:left;font-family:inherit}
.notion-table-menu button:hover,.notion-table-menu button:focus{background:#e8ebf2;outline:none}

/* Inline per-block action row (image/code/quote icons) */
.notion-block__actions{display:none;gap:6px;position:absolute;right:6px;top:6px}
.notion-block__action{width:22px;height:22px;border-radius:4px;border:1px solid rgba(26,115,232,.2);background:#f5f9ff;color:#1a73e8;font-size:12px;font-weight:700;display:inline-flex;align-items:center;justify-content:center;cursor:pointer;font-family:inherit}
.notion-block__action:hover,.notion-block__action:focus{background:rgba(26,115,232,.15);outline:none}

/* Media preview + upload */
.notion-block__media-preview{display:flex;flex-direction:column;gap:6px;width:100%;height:100%}
.notion-block__media-preview img,.notion-block__media-preview video{max-width:100%;border-radius:8px;width:100%;height:100%;object-fit:contain}
.notion-media-upload{align-self:flex-start;display:inline-flex;align-items:center;gap:6px;padding:6px 12px;border-radius:999px;border:1px solid rgba(26,115,232,.3);background:rgba(26,115,232,.08);color:#1a73e8;font-weight:600;cursor:pointer;font-size:13px;font-family:inherit}
.notion-media-upload:disabled{opacity:.6;cursor:not-allowed}
.notion-media-progress{display:none;flex-direction:column;gap:6px}
.notion-media-progress.active{display:flex}
.notion-media-progress__bar{position:relative;height:6px;background:#d9e6ff;border-radius:999px;overflow:hidden}
.notion-media-progress__fill{position:absolute;inset:0;width:0;background:#00aa55;transition:width .2s}
.notion-media-progress__info{font-size:12px;color:#80868b}

/* Per-block hamburger menu (Спросить GPT / Удалить) — HIDDEN by default */
.notion-block__menu{position:absolute;top:0;left:0;transform:translateY(-100%);background:#fff;border:1px solid #d6dbe6;border-radius:8px;box-shadow:0 8px 24px rgba(0,0,0,.12);padding:6px;display:none;flex-direction:column;gap:6px;z-index:5;min-width:160px}
.notion-block__menu button{border:none;background:rgba(255,68,68,.1);color:#ff4444;padding:6px 10px;border-radius:6px;cursor:pointer;font-weight:600;font-size:12px;text-align:left;font-family:inherit}
.notion-block__menu button:hover,.notion-block__menu button:focus{background:rgba(255,68,68,.2);outline:none}
.notion-block__menu-gpt{background:rgba(59,130,246,.1)!important;color:#3b82f6!important}
.notion-block__menu-gpt:hover,.notion-block__menu-gpt:focus{background:rgba(59,130,246,.2)!important}
.notion-block__menu-copy{background:rgba(16,185,129,.1)!important;color:#10b981!important}
.notion-block__menu-copy:hover,.notion-block__menu-copy:focus{background:rgba(16,185,129,.2)!important}

/* Ask-GPT modal from robx-superblocks */
.gpt-modal{display:none;position:fixed;inset:0;background:rgba(0,0,0,.5);z-index:1500;align-items:center;justify-content:center}
.gpt-modal.active{display:flex}
.gpt-modal__content{background:#fff;border-radius:12px;padding:24px;width:90%;max-width:600px;max-height:80vh;overflow-y:auto;box-shadow:0 20px 25px -5px rgba(0,0,0,.1),0 10px 10px -5px rgba(0,0,0,.04)}
.gpt-modal__header{display:flex;justify-content:space-between;align-items:center;margin-bottom:20px}
.gpt-modal__title{font-size:20px;font-weight:600;color:#1f2937;margin:0}
.gpt-modal__close{background:none;border:none;font-size:24px;cursor:pointer;color:#6b7280;padding:4px 8px;line-height:1;font-family:inherit}
.gpt-modal__close:hover{color:#1f2937}
.gpt-modal__input-wrapper{margin-bottom:16px}
.gpt-modal__input{width:100%;padding:12px;border:1px solid #d1d5db;border-radius:8px;font-size:14px;font-family:inherit;resize:vertical;min-height:80px}
.gpt-modal__input:focus{outline:none;border-color:#3b82f6;box-shadow:0 0 0 3px rgba(59,130,246,.1)}
.gpt-modal__response{background:#f9fafb;border:1px solid #e5e7eb;border-radius:8px;padding:16px;margin-top:16px;display:none;white-space:pre-wrap;word-wrap:break-word;font-size:14px;line-height:1.6;color:#1f2937}
.gpt-modal__response.active{display:block}
.gpt-modal__loading{display:none;text-align:center;padding:20px;color:#6b7280;font-size:14px}
.gpt-modal__loading.active{display:block}
.gpt-modal__hint{font-size:12px;color:#6b7280;margin-top:8px}

/* Floating selection toolbar (B/I/U/links/colors/headings/alignment) */
.notion-toolbar{position:absolute;display:none;align-items:center;gap:4px;padding:6px 8px;background:#fff;border:1px solid #d6dbe6;border-radius:10px;box-shadow:0 8px 24px rgba(0,0,0,.12);z-index:2000;flex-wrap:nowrap;white-space:nowrap;font-family:"Nunito Sans",system-ui,-apple-system,sans-serif}
.notion-toolbar button{border:1px solid rgba(26,115,232,.2);background:#f5f9ff;color:#1a73e8;padding:5px 7px;border-radius:6px;cursor:pointer;font-size:13px;font-weight:600;min-width:30px;flex-shrink:0;font-family:inherit}
.notion-toolbar button:hover,.notion-toolbar button:focus{background:rgba(26,115,232,.15);outline:none}
.notion-toolbar button.active{background:rgba(26,115,232,.25)}
.notion-toolbar__color{width:28px;height:28px;padding:2px;border:1px solid rgba(26,115,232,.2);border-radius:6px;background:#fff;cursor:pointer;flex-shrink:0}
.notion-toolbar__sep{width:1px;height:20px;background:#dadce0;margin:0 2px;flex-shrink:0}
