/* === КОНТЕНТ - Список и карточки === */
.content-list {
    display: grid;
    gap: 20px;
    margin-top: 24px;
}

.content-item {
    background: white;
    border: 1px solid var(--gray-200);
    border-radius: 12px;
    padding: 20px;
    transition: all 0.2s;
}

.content-item:hover {
    border-color: var(--primary);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.1);
}

.content-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--gray-200);
}

.content-item-header h4 {
    margin: 0;
    color: var(--gray-900);
    font-size: 18px;
    font-weight: 600;
}

.content-status {
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
}

.content-status.active {
    background: #d1fae5;
    color: #065f46;
}

.content-status.inactive {
    background: #fee2e2;
    color: #991b1b;
}

.content-item-body {
    margin-bottom: 16px;
}

.content-key {
    font-size: 13px;
    color: var(--gray-600);
    margin-bottom: 8px;
}

.content-key code {
    background: var(--gray-100);
    padding: 2px 8px;
    border-radius: 4px;
    font-family: 'Monaco', 'Courier New', monospace;
    font-size: 12px;
    color: var(--primary);
}

.content-preview {
    color: var(--gray-700);
    font-size: 14px;
    line-height: 1.6;
    white-space: pre-wrap;
}

.content-item-footer {
    display: flex;
    gap: 8px;
}

/* Контейнер с ограничением ширины */
.content-editor-wrapper {
    max-width: 1200px;
    margin: 0 auto;
}

/* Категории с аккордеоном */
.content-category {
    margin-bottom: 20px;
    background: white;
    border: 1px solid var(--gray-200);
    border-radius: 12px;
    overflow: hidden;
}

.category-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    background: var(--gray-50);
    cursor: pointer;
    user-select: none;
    transition: background 0.2s;
}

.category-header:hover {
    background: var(--gray-100);
}

.category-title {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: var(--gray-900);
}

.category-toggle {
    font-size: 20px;
    color: var(--gray-600);
    transition: transform 0.3s;
}

.category-header.collapsed .category-toggle {
    transform: rotate(-90deg);
}

.category-body {
    max-height: 3000px;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.category-body.collapsed {
    max-height: 0;
}

/* Сортировка */
.sort-buttons {
    display: flex;
    gap: 4px;
    flex-direction: column;
}

.btn-sort {
    padding: 4px 8px;
    font-size: 12px;
    background: var(--gray-100);
    border: none;
    cursor: pointer;
    border-radius: 4px;
}

.btn-sort:hover {
    background: var(--gray-200);
}

.content-item {
    display: flex;
    gap: 12px;
}

.content-item-main {
    flex: 1;
}

/* Редактор кнопок */
.button-editor {
    margin-bottom: 12px;
    padding: 12px;
    background: var(--gray-50);
    border-radius: 8px;
    border: 1px solid var(--gray-200);
}

.button-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.button-row .form-control {
    margin-bottom: 0;
}

.button-row .btn-danger {
    min-width: 32px;
    height: 38px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
}

#buttonsContainer {
    margin-bottom: 12px;
}

/* Drag and Drop для кнопок */
.button-editor.dragging {
    opacity: 0.5;
    background: var(--gray-100);
}

.button-editor {
    transition: transform 0.2s ease;
}

.drag-handle {
    cursor: move !important;
    user-select: none;
    font-size: 16px;
    line-height: 1;
    padding: 0 4px !important;
    color: #94a3b8;
    display: inline-flex;
    align-items: center;
    flex-shrink: 0;
}

/* Header с кнопками управления */
.section-header-with-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding-bottom: 2px;
    margin-bottom: 2px;
    border-bottom: 1px solid #e5e7eb;
}

.section-header-with-controls h3 {
    margin: 0;
    font-size: 15px;
    font-weight: 600;
    color: #1e293b;
}

/* Контейнер управления контентом */
.content-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}

.content-controls #contentBotSelect {
    min-width: 180px;
    max-width: 220px;
}

/* Inline кнопка сворачивания (не фиксированная) */
.collapse-all-btn-inline {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    background: #fff;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    color: #475569;
    cursor: pointer;
    transition: all 0.2s;
}

.collapse-all-btn-inline:hover {
    background: #f8fafc;
    border-color: #94a3b8;
    transform: translateY(-1px);
}

.collapse-all-btn-inline svg {
    transition: transform 0.2s;
}

/* Контейнер управления контентом */
.content-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

/* Кнопки тулбара — компактные и ровные по центру */
.content-controls .btn {
    padding: 3px 10px;
    font-size: 13px;
    line-height: 1.2;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
}

/* Переключатель ветки воронки */
.branch-switch { gap: 6px; }
.branch-switch-label { color: #94a3b8; font-weight: 500; }
.branch-switch-name { font-weight: 700; }

/* Поиск по блокам */
.content-search {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
    padding: 5px 12px;
    background: transparent;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    width: 240px;
    max-width: 100%;
    color: #94a3b8;
}
.content-search:focus-within { border-color: #c7b3ff; }
.content-search input {
    flex: 1;
    border: none;
    outline: none;
    font-size: 14px;
    color: #1f2937;
    background: transparent;
}
.content-search-count { font-size: 12px; color: #94a3b8; white-space: nowrap; }

/* Под-вкладки объединённых разделов */
.section-subtabs {
    display: flex;
    gap: 4px;
    margin-bottom: 18px;
    border-bottom: 1px solid #e5e7eb;
}
.section-subtabs .subtab {
    padding: 8px 18px;
    border: none;
    background: transparent;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    font-size: 14px;
    font-weight: 600;
    color: #94a3b8;
    cursor: pointer;
    transition: color .15s, border-color .15s;
}
.section-subtabs .subtab:hover { color: #6366f1; }
.section-subtabs .subtab.active {
    color: #6366f1;
    border-bottom-color: #6366f1;
}

/* Подсветка найденного блока */
.tree-node.search-hit {
    outline: 3px solid #f59e0b;
    outline-offset: 3px;
    border-radius: 12px;
}

/* Кнопка "Свернуть всё" - фиксирована внизу справа */
.collapse-all-btn {
    position: fixed !important;
    bottom: 30px !important;
    right: 30px !important;
    z-index: 100 !important;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 10px 16px;
    background: #fff;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    color: #475569;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.collapse-all-btn:hover {
    background: #f8fafc;
    border-color: #94a3b8;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.collapse-all-btn svg {
    transition: transform 0.2s;
}

.collapse-all-btn:active svg {
    transform: rotate(180deg);
}

/* Адаптив */
@media (max-width: 768px) {
    .content-controls {
        flex-direction: column;
        align-items: stretch;
    }

    .content-controls #contentBotSelect,
    .content-controls .btn {
        width: 100%;
        margin: 0 !important;
    }

    .button-row {
        flex-direction: column;
        align-items: stretch;
    }

    .button-row .btn-danger {
        width: 100%;
        height: 38px;
    }
}

/* === Инфо-плашка «Кнопка управляется глобально» === */
.info-banner-ask-question {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 14px;
    margin-bottom: 12px;
    background: linear-gradient(135deg, #eef2ff 0%, #e0e7ff 100%);
    border: 1px solid #c7d2fe;
    border-left: 4px solid #6366f1;
    border-radius: 8px;
    font-size: 13px;
    color: #3730a3;
    line-height: 1.5;
}

.info-banner-ask-question .info-banner-icon {
    font-size: 18px;
    flex-shrink: 0;
    line-height: 1;
    margin-top: 1px;
}

.info-banner-ask-question b {
    font-weight: 600;
    color: #1e1b4b;
}
