/**
 * Стили блочной документации.
 * Один файл для сайта и админки.
 *
 * Подключается:
 *   - public/admin/protoblocks/docs/index.php (публичная страница)
 *   - public/admin/protoblocks/docs/admin/blocks.php (редактор блоков)
 */

/* ========== Текст ========== */
.docs-block-text { margin-bottom: 14px; }
.docs-block-text p { margin-bottom: 10px; line-height: 1.7; }

/* ========== Списки ========== */
.docs-block-list { padding-left: 24px; margin-bottom: 16px; line-height: 1.7; }
.docs-block-list li { margin-bottom: 6px; }

/* ========== Callout ========== */
.docs-callout { padding: 14px 18px; border-radius: 0 8px 8px 0; margin: 16px 0; font-size: 14px; line-height: 1.6; }
.docs-callout p { margin: 0; }
.docs-callout--info { background: #eaf4fb; border-left: 4px solid #3c8dbc; color: #2c3e50; }
.docs-callout--warning { background: #fff8e1; border-left: 4px solid #f9a825; color: #5d4037; }
.docs-callout--tip { background: #e8f5e9; border-left: 4px solid #43a047; color: #1b5e20; }

/* ========== FAQ ========== */
.docs-faq { margin: 16px 0; }
.docs-faq__item { background: #fff; border: 1px solid #e0e3e8; border-radius: 10px; margin-bottom: 8px; overflow: hidden; }
.docs-faq__question { padding: 14px 18px; font-weight: 600; cursor: pointer; display: flex; justify-content: space-between; align-items: center; font-size: 15px; }
.docs-faq__question:hover { background: #fafbfc; }
.docs-faq__question i { color: #bbb; transition: transform 0.2s; }
.docs-faq__item.open .docs-faq__question i { transform: rotate(180deg); }
.docs-faq__answer { padding: 0 18px 14px; display: none; color: #555; line-height: 1.6; }
.docs-faq__item.open .docs-faq__answer { display: block; }

/* ========== Шаги ========== */
.docs-steps { margin: 16px 0; }
.docs-steps__item h3 { font-size: 17px; display: flex; align-items: center; gap: 8px; margin: 20px 0 8px; border: none; padding: 0; }
.docs-step { display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px; border-radius: 50%; background: #3c8dbc; color: #fff; font-size: 14px; font-weight: 700; flex-shrink: 0; }
.docs-steps__desc { margin-left: 36px; color: #555; line-height: 1.6; }

/* ========== Таблица ========== */
.docs-table { width: 100%; border-collapse: collapse; margin: 16px 0; font-size: 14px; background: #fff; border-radius: 8px; overflow: hidden; box-shadow: 0 1px 3px rgba(0,0,0,0.06); }
.docs-table th { background: #f5f7fa; padding: 10px 14px; text-align: left; font-weight: 600; border-bottom: 2px solid #e0e3e8; }
.docs-table td { padding: 10px 14px; border-bottom: 1px solid #f0f0f0; }
.docs-table tr:last-child td { border-bottom: none; }

/* ========== Картинка ========== */
.docs-image { margin: 20px 0; text-align: center; }
.docs-image img { max-width: 100%; border-radius: 8px; box-shadow: 0 2px 8px rgba(0,0,0,0.1); cursor: pointer; transition: box-shadow 0.2s; }
.docs-image img:hover { box-shadow: 0 4px 16px rgba(0,0,0,0.18); }
.docs-image figcaption { margin-top: 8px; font-size: 13px; color: #888; }

/* ========== Видео ========== */
.docs-video { margin: 20px 0; }
.docs-video iframe { max-width: 100%; border-radius: 8px; }

/* Видео-переключатель YouTube / RuTube */
.docs-video-tabs { margin: 20px 0; }
.docs-video-tabs__buttons { display: flex; gap: 0; margin-bottom: 12px; }
.docs-video-tabs__btn {
    padding: 8px 20px; border: 1px solid #ddd; background: #f5f5f5; color: #666;
    font-size: 13px; font-weight: 600; cursor: pointer; transition: all 0.2s;
    font-family: inherit;
}
.docs-video-tabs__btn:first-child { border-radius: 6px 0 0 6px; }
.docs-video-tabs__btn:last-child { border-radius: 0 6px 6px 0; border-left: none; }
.docs-video-tabs__btn.active { background: #fff; color: #1a1a1a; border-color: #999; z-index: 1; position: relative; }
.docs-video-tabs__btn:hover:not(.active) { background: #eee; }
.docs-video-tabs__panel { display: none; }
.docs-video-tabs__panel.active { display: block; }
.docs-video-tabs__panel iframe { max-width: 100%; border-radius: 8px; }

/* ========== Код ========== */
.for_copy { margin: 16px 0; position: relative; }
.for_copy pre { background: #1e1e1e; color: #d4d4d4; padding: 16px; border-radius: 8px; overflow-x: auto; line-height: 1.5; }
.for_copy code { font-family: 'SF Mono', Menlo, Consolas, monospace; font-size: 13px; }
.btn_copy { position: absolute; top: 8px; right: 8px; background: #444; color: #ccc; border: none; padding: 4px 10px; border-radius: 4px; cursor: pointer; font-size: 12px; }
.btn_copy:hover { background: #555; color: #fff; }

/* ========== Заголовки в статье ========== */
.docs-article__body h2 { font-size: 22px; font-weight: 600; margin: 30px 0 12px; padding-bottom: 8px; border-bottom: 2px solid #e8eaed; color: #1a1a1a; }
.docs-article__body h3 { font-size: 18px; font-weight: 600; margin: 24px 0 10px; color: #1a1a1a; }
.docs-article__body h4 { font-size: 16px; font-weight: 600; margin: 20px 0 8px; color: #333; }

/* ========== Теги (pill-кнопки) ========== */
.docs-page__tags { display: flex; flex-wrap: wrap; gap: 8px; }
.docs-page__tag {
    display: inline-block; padding: 6px 16px; border-radius: 20px; background: #fff;
    border: 1px solid #e0e3e8; color: #444; font-size: 13px; font-weight: 500;
    cursor: pointer; transition: all 0.2s; text-decoration: none;
}
.docs-page__tag:hover { background: #eaf4fb; border-color: #3c8dbc; color: #3c8dbc; }
.docs-page__tag.active { background: #3c8dbc; border-color: #3c8dbc; color: #fff; }

/* ========== Breadcrumbs ========== */
.docs-breadcrumbs { font-size: 14px; color: #999; margin-bottom: 12px; }
.docs-breadcrumbs a { color: #3c8dbc; text-decoration: none; }
.docs-breadcrumbs a:hover { text-decoration: underline; }
.docs-breadcrumbs span { margin: 0 6px; color: #ccc; }

/* ========== Карточки статей ========== */
.docs-card { display: flex; align-items: center; gap: 14px; padding: 12px 16px; background: #fff; border-radius: 10px; border: 1px solid #e8eaed; text-decoration: none; color: inherit; transition: box-shadow 0.2s, border-color 0.2s, transform 0.15s; margin-bottom: 6px; }
.docs-card:hover { box-shadow: 0 4px 16px rgba(0,0,0,0.07); border-color: #3c8dbc; transform: translateY(-1px); }
.docs-card__icon { flex-shrink: 0; width: 40px; height: 40px; border-radius: 10px; background: #f5f7fa; display: flex; align-items: center; justify-content: center; font-size: 17px; color: #3c8dbc; }
.docs-card__body { flex: 1; min-width: 0; }
.docs-card__title { font-size: 15px; font-weight: 500; color: #1a1a1a; }
.docs-card__desc { font-size: 13px; color: #888; margin-top: 2px; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; }
.docs-card__desc .highlight { background: #ffeaa7; font-weight: 600; padding: 0 2px; border-radius: 2px; }
.docs-card__arrow { flex-shrink: 0; color: #ccc; font-size: 13px; transition: color 0.2s, transform 0.2s; }
.docs-card:hover .docs-card__arrow { color: #3c8dbc; transform: translateX(3px); }

/* ========== Layout: main + sidebar ========== */
.docs-layout { display: flex; gap: 40px; align-items: flex-start; }
.docs-layout__main { flex: 1; min-width: 0; }
.docs-layout__sidebar { flex: 0 0 220px; }

/* ========== TOC в теле статьи ========== */
.docs-toc { background: #fff; border: 1px solid #e8eaed; border-radius: 10px; padding: 20px 24px; margin-bottom: 28px; }
.docs-toc__title { font-size: 15px; font-weight: 600; color: #555; margin-bottom: 12px; display: flex; align-items: center; gap: 8px; }
.docs-toc__list { list-style: none; padding: 0; margin: 0; }
.docs-toc__list li { margin-bottom: 6px; }
.docs-toc__list li a { color: #3c8dbc; text-decoration: none; font-size: 14px; line-height: 1.5; }
.docs-toc__list li a:hover { text-decoration: underline; }
.docs-toc__sub { padding-left: 16px; }

/* ========== Sticky sidebar навигация ========== */
.docs-sidebar-nav { padding: 0; }
.docs-sidebar-nav.fixed { position: fixed; top: 76px; width: 220px; max-height: calc(100vh - 96px); overflow-y: auto; }
.docs-sidebar-nav__title { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 1px; color: #999; margin-bottom: 12px; }
.docs-sidebar-nav__list { list-style: none; padding: 0; margin: 0; border-left: 2px solid #e8eaed; }
.docs-sidebar-nav__list li { margin: 0; }
.docs-sidebar-nav__link { display: block; padding: 5px 0 5px 14px; color: #666; text-decoration: none; font-size: 13px; line-height: 1.4; border-left: 2px solid transparent; margin-left: -2px; transition: all 0.15s; }
.docs-sidebar-nav__link:hover { color: #333; }
.docs-sidebar-nav__link.active { color: #3c8dbc; border-left-color: #3c8dbc; font-weight: 600; }
.docs-sidebar-nav__link.docs-sidebar-nav__sub { padding-left: 28px; font-size: 12px; }

@media (max-width: 900px) {
    .docs-layout { flex-direction: column; }
    .docs-layout__sidebar { display: none; }
}

/* ========== Docs listing page ========== */
.docs-page { max-width: 1100px; margin: 0 auto; padding: 20px 0 60px; }
.docs-page__header { margin-bottom: 24px; }
.docs-page__header h1 { font-size: 32px; font-weight: 700; color: #1a1a1a; margin-bottom: 6px; }
.docs-page__header p { font-size: 16px; color: #666; margin: 0; }

.docs-page__search { margin-bottom: 20px; }
.docs-page__search-input {
    width: 100%; max-width: 480px; padding: 12px 16px 12px 42px;
    border: 1px solid #e0e3e8; border-radius: 10px; font-size: 15px; font-family: inherit;
    background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%23999' stroke-width='2'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cline x1='21' y1='21' x2='16.65' y2='16.65'/%3E%3C/svg%3E") 14px center no-repeat;
    outline: none; transition: border-color 0.2s, box-shadow 0.2s;
}
.docs-page__search-input:focus { border-color: #3c8dbc; box-shadow: 0 0 0 3px rgba(60,141,188,0.12); }
#search-results .article { border-bottom: 1px solid #eee; padding: 10px 0; }
#search-results .article h3 a { color: #3c8dbc; text-decoration: none; }
.highlight { background-color: #ffeaa7; font-weight: bold; }

.docs-section { margin-bottom: 36px; }
.docs-section__header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; padding-bottom: 10px; border-bottom: 2px solid #e8eaed; }
.docs-section__title { font-size: 20px; font-weight: 600; color: #1a1a1a; display: flex; align-items: center; gap: 10px; }
.docs-section__icon { display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; border-radius: 10px; font-size: 16px; flex-shrink: 0; }

@media (max-width: 768px) {
    .docs-page__header h1 { font-size: 26px; }
    .docs-page__search-input { max-width: 100%; }
}

/* ========== Lightbox ========== */
.docs-lightbox-overlay { display: none; position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,0.85); z-index: 9999; cursor: pointer; justify-content: center; align-items: center; }
.docs-lightbox-overlay.active { display: flex; }
.docs-lightbox-overlay img { max-width: 92%; max-height: 92%; border-radius: 8px; box-shadow: 0 4px 40px rgba(0,0,0,0.5); }
.docs-lightbox-close { position: absolute; top: 20px; right: 30px; color: #fff; font-size: 36px; cursor: pointer; line-height: 1; }
