/* ── Общий layout ── */
.tr-page { max-width: 100%; }
.tr-empty { color: #aaa; font-size: 14px; }
.tr-block-label { font-size: 12px; font-weight: 600; color: #888; text-transform: uppercase; letter-spacing: .5px; margin: 24px 0 10px; }
.tr-section-desc { color: #666; font-size: 14px; margin-bottom: 24px; line-height: 1.55; }

.tr-title-row { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; flex-wrap: wrap; }
.tr-title-row h1 { margin: 0; }

/* ── Карточки разделов ── */
.tr-card { position: relative; padding: 18px 22px; border: 1px solid #e8e5de; border-radius: 12px; margin-bottom: 12px; transition: border-color .2s; }
.tr-card:hover { border-color: #ccc; }
.tr-card__link { text-decoration: none; }
.tr-card__title { font-size: 17px; font-weight: 500; margin: 0 0 4px; color: #1a1a1a; }
.tr-card__desc { font-size: 13px; color: #666; margin: 0; line-height: 1.55; }
.tr-card__meta { font-size: 11px; color: #aaa; margin-top: 8px; }

/* ── Контрольные кнопки ── */
.tr-controls { position: absolute; top: 14px; right: 14px; display: flex; gap: 5px; opacity: 0; transition: opacity .15s; }
.tr-card:hover .tr-controls, .tr-lesson-row:hover .tr-controls { opacity: 1; }
.tr-ctrl {
    width: 30px; height: 30px; border-radius: 7px; cursor: pointer; display: flex;
    align-items: center; justify-content: center;
    background: #fff; border: 1px solid #ddd; transition: background .15s, border-color .15s;
}
.tr-ctrl:hover { background: #f4f2ed; border-color: #bbb; }
.tr-ctrl--danger:hover { border-color: #e24b4a; background: #fff0f0; }
.tr-ctrl svg { width: 14px; height: 14px; stroke: #666; fill: none; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.tr-ctrl--danger:hover svg { stroke: #e24b4a; }
.tr-ctrl--inline { display: inline-flex; vertical-align: middle; }

/* ── Inline-редактор ── */
.tr-inline-editor { margin-top: 10px; padding: 12px 14px; background: #f4f2ee; border: 1px solid #185fa5; border-radius: 8px; }
.tr-inline-editor textarea { width: 100%; box-sizing: border-box; resize: vertical; background: #fff; border: 1px solid #ddd; border-radius: 6px; padding: 8px 10px; font-size: 13px; line-height: 1.6; font-family: inherit; outline: none; }
.tr-inline-editor textarea:focus { border-color: #185fa5; }
.tr-inline-editor__actions { display: flex; gap: 6px; justify-content: flex-end; margin-top: 8px; }

/* ── Кнопки ── */
.tr-btn-save { font-size: 12px; padding: 5px 14px; border-radius: 5px; cursor: pointer; background: #185fa5; color: #fff; border: none; }
.tr-btn-save:hover { background: #0c447c; }
.tr-btn-cancel { font-size: 12px; padding: 5px 14px; border-radius: 5px; cursor: pointer; background: #fff; color: #666; border: 1px solid #ddd; }

/* ── Кнопка «Добавить» пунктирная ── */
.tr-add-btn {
    display: flex; align-items: center; gap: 10px; width: 100%; padding: 11px 18px;
    border: 1.5px dashed #ccc; border-radius: 10px; background: none; cursor: pointer;
    font-size: 13px; color: #999; margin-bottom: 24px; transition: border-color .2s, color .2s;
}
.tr-add-btn:hover { border-color: #185fa5; color: #185fa5; }
.tr-add-btn__icon { width: 22px; height: 22px; border-radius: 50%; background: #eee; display: flex; align-items: center; justify-content: center; font-size: 16px; line-height: 1; color: #888; }
.tr-add-btn:hover .tr-add-btn__icon { background: #e6f1fb; color: #185fa5; }

/* ── Список материалов ── */
.tr-lessons { border: 1px solid #e8e5de; border-radius: 12px; overflow: hidden; margin-bottom: 20px; }
.tr-lesson-row { display: flex; align-items: center; gap: 10px; padding: 11px 16px; border-bottom: 1px solid #f0ede8; position: relative; transition: background .15s; }
.tr-lesson-row:last-child { border-bottom: none; }
.tr-lesson-row:hover { background: #faf9f7; }
.tr-lesson-row .tr-controls { position: static; opacity: 0; flex-shrink: 0; }
.tr-lesson-row:hover .tr-controls { opacity: 1; }
.tr-type-badge { font-size: 10px; font-weight: 500; padding: 2px 7px; border-radius: 4px; background: #e6f1fb; color: #185fa5; flex-shrink: 0; }
.tr-type-badge--article { background: #eaf3de; color: #3b6d11; }
.tr-type-badge--rutube { background: #f0e6fb; color: #6b21a8; }
.tr-lesson-link { font-size: 13px; color: #222; flex: 1; text-decoration: none; }
.tr-lesson-link:hover { color: #185fa5; }
.tr-drag { cursor: grab; opacity: .25; flex-shrink: 0; }
.tr-drag:hover { opacity: .6; }

/* ── Файлы ── */
.tr-files { border: 1px solid #e8e5de; border-radius: 10px; padding: 14px 18px; margin-bottom: 20px; }
.tr-files__title { font-size: 12px; font-weight: 500; color: #888; margin-bottom: 10px; }
.tr-file-row { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid #f0ede8; }
.tr-file-row:last-of-type { border-bottom: none; }
.tr-file-ext { width: 30px; height: 30px; border-radius: 6px; flex-shrink: 0; background: #e6f1fb; display: flex; align-items: center; justify-content: center; font-size: 10px; font-weight: 500; color: #185fa5; }
.tr-file-name { font-size: 13px; color: #333; flex: 1; }
.tr-file-size { font-size: 11px; color: #aaa; }
.tr-file-dl { font-size: 11px; color: #185fa5; border: 1px solid #b5d4f4; border-radius: 4px; padding: 3px 9px; background: none; cursor: pointer; text-decoration: none; }
.tr-file-dl:hover { background: #e6f1fb; }

/* ── Видеоплеер ── */
.tr-video-wrap { height: 400px; aspect-ratio: 16/9; margin: 0 auto 16px; border-radius: 12px; overflow: hidden; background: #000; }
.tr-video-wrap video { width: 100%; height: 100%; display: block; object-fit: contain; }
@media (max-width: 768px) { .tr-video-wrap { width: 100%; height: auto; } }
.tr-video-placeholder { min-height: 220px; display: flex; align-items: center; justify-content: center; border: 1px dashed #ddd; border-radius: 12px; margin-bottom: 16px; }
.tr-video-meta { font-size: 12px; color: #aaa; margin-bottom: 18px; display: flex; gap: 18px; flex-wrap: wrap; }

/* ── Rutube iframe ── */
.tr-rutube-wrap { height: 400px; aspect-ratio: 16/9; margin: 0 auto 16px; border-radius: 12px; overflow: hidden; background: #000; }
.tr-rutube-wrap iframe { width: 100%; height: 100%; border: none; display: block; }
@media (max-width: 768px) { .tr-rutube-wrap { width: 100%; height: auto; } }

/* ── Rutube настройки ── */
.tr-rutube-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
.tr-rutube-check { display: flex; align-items: center; gap: 6px; font-size: 13px; color: #333; cursor: pointer; height: 36px; }
.tr-rutube-check input[type=checkbox] { width: 16px; height: 16px; accent-color: #185fa5; cursor: pointer; }
/* Вкладки выбора источника видео в модалке */
.tr-vs-tabs { display: flex; gap: 0; margin-bottom: 16px; border-bottom: 2px solid #e0e7ef; }
.tr-vs-tab { background: none; border: none; padding: 8px 18px; font-size: 13px; color: #666; cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -2px; transition: color .15s; }
.tr-vs-tab:hover { color: #185fa5; }
.tr-vs-tab.active { color: #185fa5; border-bottom-color: #185fa5; font-weight: 600; }
.tr-vs-current { font-size: 13px; color: #555; padding: 8px 0; }
.tr-vs-current__label { color: #999; margin-right: 6px; }

/* ── Блок комментария / статьи ── */
.tr-comment-block { border: 1px solid #e8e5de; border-radius: 10px; padding: 18px 22px; margin-bottom: 20px; position: relative; }
.tr-comment-block__label { font-size: 11px; font-weight: 500; color: #aaa; margin-bottom: 10px; display: flex; align-items: center; }

/* ── Контент ── */
.tr-comment-content { font-size: 0.95rem; line-height: 1.65; color: #212529; }
.tr-comment-content p { margin: 0 0 0.3em 0; }
.tr-comment-content h2 { font-size: 1.5em; font-weight: 700; margin: 0.8em 0 0.4em; }
.tr-comment-content h3 { font-size: 1.25em; font-weight: 600; margin: 0.7em 0 0.3em; }
.tr-comment-content h4 { font-size: 1.1em; font-weight: 600; margin: 0.6em 0 0.3em; }
.tr-comment-content img { max-width: 100%; height: auto; }
.tr-comment-content img[style*="float"] { display: inline; margin-block: 0; }
.tr-comment-content img[style*="float: left"] { margin-right: 10px; margin-bottom: 4px; }
.tr-comment-content img[style*="float: right"] { margin-left: 10px; margin-bottom: 4px; }
.tr-comment-content figure[style*="float"] { margin-block: 0; }
.tr-comment-content figure[style*="float: left"] { margin-right: 10px; }
.tr-comment-content figure[style*="float: right"] { margin-left: 10px; }
.tr-comment-content p:has(img) { margin-block: 0; }
.tr-comment-content p[style*="text-align:justify"], .tr-comment-content p[style*="text-align: justify"] { text-indent: 1.5em; }
.tr-comment-content .flow-break { display: block; clear: both; }
.tr-comment-content ul, .tr-comment-content ol { margin: 0.5em 0; padding-left: 1.5em; }
.tr-comment-content ul { list-style-type: disc; }
.tr-comment-content ol { list-style-type: decimal; }
.tr-comment-content li { margin-bottom: 0.2em; }
.tr-comment-content blockquote { border-left: 4px solid #dee2e6; margin: 0.8em 0; padding: 0.5em 1em; color: #495057; font-style: italic; }
.tr-comment-content code { font-size: 0.875em; background: #f1f3f5; padding: 0.15em 0.35em; border-radius: 3px; }
.tr-comment-content pre { background: #1e1e2e; color: #cdd6f4; padding: 0.8em 1em; border-radius: 6px; overflow-x: auto; margin: 0.8em 0; }
.tr-comment-content pre code { background: none; padding: 0; }
.tr-comment-content table { border-collapse: collapse; width: 100%; margin: 0.8em 0; }
.tr-comment-content th, .tr-comment-content td { border: 1px solid #dee2e6; padding: 0.4em 0.6em; text-align: left; }
.tr-comment-content th { background: #f8f9fa; font-weight: 600; }
.tr-comment-content a { color: #185fa5; }
.tr-comment-content hr { border: none; border-top: 1px solid #dee2e6; margin: 1em 0; }
.tr-comment-content figcaption { font-size: 0.85em; color: #6c757d; margin-top: 0.3em; }
.tr-comment-content video { max-width: 100%; height: auto; }

/* ── TinyMCE враппер ── */
.tr-editor-wrap { display: none; margin-top: 12px; border: 1px solid #185fa5; border-radius: 10px; overflow: hidden; }
.tr-editor-wrap.open { display: block; }
.tr-editor-wrap__header { display: flex; align-items: center; padding: 8px 14px; background: #f0f6fd; border-bottom: 1px solid #c8dff5; gap: 10px; }
.tr-editor-wrap__header span { font-size: 11px; color: #185fa5; flex: 1; }

/* ── Навигация по материалам ── */
.tr-nav-row { display: flex; gap: 10px; margin-top: 24px; }
.tr-nav-btn { flex: 1; padding: 10px 16px; font-size: 13px; border-radius: 8px; text-align: center; border: 1px solid #e0ddd5; color: #555; text-decoration: none; background: #faf9f7; }
.tr-nav-btn:hover { border-color: #185fa5; color: #185fa5; }

/* ── Модалка ── */
.tr-modal-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 1000; align-items: center; justify-content: center; }
.tr-modal-overlay.open { display: flex; }
.tr-modal { background: #fff; border-radius: 14px; padding: 24px 28px; min-width: 340px; max-width: 480px; width: 100%; border: 1px solid #e0ddd5; }
.tr-modal h3 { font-size: 16px; font-weight: 500; margin: 0 0 16px; }
.tr-modal label { font-size: 12px; color: #666; display: block; margin-bottom: 4px; }
.tr-modal input, .tr-modal textarea, .tr-modal select { width: 100%; box-sizing: border-box; border: 1px solid #ddd; border-radius: 6px; padding: 8px 10px; font-size: 13px; font-family: inherit; outline: none; margin-bottom: 12px; background: #fff; }
.tr-modal input:focus, .tr-modal textarea:focus { border-color: #185fa5; }
.tr-modal__actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 4px; }

/* ═══ Файловый менеджер ═══ */
.fm-modal { max-width: 640px; min-height: 340px; display: flex; flex-direction: column; padding: 0; overflow: hidden; }
.fm-header { display: flex; align-items: center; padding: 16px 20px 12px; border-bottom: 1px solid #eee; }
.fm-header h3 { flex: 1; margin: 0; font-size: 15px; }
.fm-close { width: 28px; height: 28px; display: flex; align-items: center; justify-content: center; cursor: pointer; border-radius: 6px; font-size: 16px; color: #999; }
.fm-close:hover { background: #f4f2ed; color: #333; }
.fm-crumbs { padding: 8px 20px; font-size: 12px; color: #888; background: #faf9f7; border-bottom: 1px solid #f0ede8; }
.fm-crumb { cursor: pointer; color: #185fa5; }
.fm-crumb:hover { text-decoration: underline; }
.fm-crumb-sep { color: #ccc; margin: 0 2px; }
.fm-toolbar { display: flex; gap: 8px; padding: 10px 20px; border-bottom: 1px solid #f0ede8; }
.fm-tb-btn { font-size: 12px; padding: 5px 12px; } /* кнопки тулбара — единый стиль, читаемые */
.fm-list { flex: 1; overflow-y: auto; max-height: 360px; padding: 4px 0; }
.fm-empty { text-align: center; color: #bbb; padding: 32px 20px; font-size: 13px; }
.fm-row { display: flex; align-items: center; gap: 10px; padding: 7px 20px; transition: background .1s; }
.fm-row:hover { background: #f8f7f4; }
.fm-icon { width: 32px; height: 32px; border-radius: 6px; background: #e6f1fb; display: flex; align-items: center; justify-content: center; font-size: 10px; font-weight: 600; color: #185fa5; flex-shrink: 0; }
.fm-icon--folder { background: #fff3cd; font-size: 16px; }
.fm-name { flex: 1; font-size: 13px; color: #333; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fm-row--folder .fm-name { cursor: pointer; color: #185fa5; }
.fm-row--folder .fm-name:hover { text-decoration: underline; }
.fm-meta { font-size: 11px; color: #aaa; flex-shrink: 0; }
.fm-act { flex-shrink: 0; }

/* ═══ Таймкоды ═══ */
.tr-tc { border: 1px solid #e8e5de; border-radius: 10px; margin-bottom: 16px; overflow: hidden; }

/* Заголовок — кликабельный, разворачивает/сворачивает */
.tr-tc__header {
    display: flex; align-items: center; gap: 8px; padding: 7px 14px; cursor: pointer;
    background: #faf9f7; transition: background .15s; user-select: none;
}
.tr-tc__header:hover { background: #f4f2ed; }
.tr-tc__icon { width: 16px; height: 16px; fill: #888; flex-shrink: 0; }
.tr-tc__title { font-size: 13px; font-weight: 500; color: #555; }
.tr-tc__count { font-size: 11px; color: #aaa; background: #eee; border-radius: 10px; padding: 1px 8px; }
.tr-tc__arrow { width: 14px; height: 14px; fill: none; stroke: #999; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; margin-left: auto; transition: transform .2s; }

/* Стрелка вверх при открытом блоке */
.tr-tc.open .tr-tc__arrow { transform: rotate(180deg); }

/* Тело — скрыто по умолчанию */
.tr-tc__body { display: none; border-top: 1px solid #e8e5de; }
.tr-tc.open .tr-tc__body { display: block; }

/* Список таймкодов */
.tr-tc__list { padding: 1px 0; }
.tr-tc__item { display: flex; align-items: center; gap: 10px; padding: 2px 14px; cursor: pointer; transition: background .12s; }
.tr-tc__item:hover { background: #f4f2ed; }
.tr-tc__item.active { background: #e6f1fb; }
.tr-tc__time { font-size: 13px; font-weight: 500; color: #185fa5; font-family: monospace; min-width: 48px; }
.tr-tc__name { font-size: 14px; color: #333; flex: 1; }
.tr-tc__item.active .tr-tc__name { font-weight: 500; color: #185fa5; }

/* Кнопки редактора при hover */
.tr-tc__actions { display: flex; gap: 2px; margin-left: auto; opacity: 0; pointer-events: none; transition: opacity .15s; flex-shrink: 0; }
.tr-tc__item:hover .tr-tc__actions { opacity: 1; pointer-events: auto; }
.tr-tc__actions .tr-ctrl { width: 22px; height: 22px; border-radius: 5px; }
.tr-tc__actions .tr-ctrl svg { width: 11px; height: 11px; }

/* Кнопка «Импорт» в заголовке */
.tr-tc__import-btn {
    display: flex; align-items: center; gap: 4px; font-size: 11px; color: #185fa5;
    background: none; border: 1px solid #b5d4f4; border-radius: 5px; padding: 3px 10px;
    cursor: pointer; margin-left: 8px; transition: background .15s;
}
.tr-tc__import-btn:hover { background: #e6f1fb; }
.tr-tc__import-btn svg { width: 12px; height: 12px; fill: none; stroke: #185fa5; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* Кнопка добавления и форма */
.tr-tc__add { padding: 3px 14px 6px; }
.tr-tc__form { display: flex; align-items: center; gap: 8px; padding: 6px 14px; background: #f4f2ee; border-top: 1px solid #e8e5de; }
.tr-tc__input { border: 1px solid #ddd; border-radius: 5px; padding: 6px 10px; font-size: 13px; font-family: inherit; outline: none; flex: 1; }
.tr-tc__input:focus { border-color: #185fa5; }
.tr-tc__input--time { max-width: 70px; flex: none; font-family: monospace; text-align: center; }

/* ═══════════════════════════════════════════════════════════════════════════════
   Контроль доступа: заглушка «требуется вход» и заблокированная ссылка скачивания
   ═══════════════════════════════════════════════════════════════════════════════ */

/* Блок-заглушка вместо плеера, когда доступ к видео ограничен */
.tr-locked {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    padding: 40px 20px; background: #f4f2ee; border: 1px dashed #c8c4ba; border-radius: 10px;
    text-align: center; gap: 10px; margin-bottom: 16px;
}
.tr-locked__icon { width: 36px; height: 36px; fill: none; stroke: #888; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.tr-locked__title { font-size: 15px; font-weight: 500; color: #333; }
.tr-locked__text { font-size: 13px; color: #777; max-width: 380px; }
.tr-locked .tr-btn-save { margin-top: 6px; }

/* Заблокированная ссылка скачивания: визуально выделена замочком */
.tr-file-dl--locked { background: #f4f2ee; color: #888; border-color: #d8d4ca; }
.tr-file-dl--locked:hover { background: #ebe8e1; color: #555; }
