/* temp/web/style-river.css */
#river-container {
    display: flex;
    flex-direction: column;
    gap: 20px;
    padding: 20px; /* Отступ от краев экрана */
    /* Убираем лишние скроллбары если есть */
    box-sizing: border-box; }
/* --- КАРТОЧКА ФРЕЙМА (Clean Style) --- */
.wiki-card {
    background-color: white;
    /* УБРАЛИ РАМКУ: border: 1px solid #ddd; */
    border: none; 
    border-radius: 8px; /* Чуть больше скругление */
    /* ДОБАВИЛИ ТЕНЬ: Мягкая, современная */
    box-shadow: 0 1px 3px rgba(0,0,0,0.08), 0 4px 12px rgba(0,0,0,0.05);
    padding: 20px 25px; /* Больше воздуха внутри */
    box-sizing: border-box;
    transition: box-shadow 0.2s;}
.wiki-card:hover {box-shadow: 0 4px 15px rgba(0,0,0,0.1);} /* Тень чуть глубже при наведении */
/* Заголовок карточки */
.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    border-bottom: 1px solid #f0f0f0; 
    padding: 0 0 10px 0;
    background: transparent;
    height: auto;
    position: static;
    z-index: auto;}
.card-title-view {
    margin: 0;
    font-size: 1.5em;
    color: #222;
    font-weight: 700;
    line-height: 1.3;}
/* Кнопки управления (кружочки) */
.card-controls {
    display: flex;
    gap: 8px;
    margin-left: auto; /* Всегда прижимает блок вправо, даже если слева пусто */
    flex-shrink: 0;}
.control-button {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: none; /* Убрали рамку кнопок */
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.1s, opacity 0.2s;
    opacity: 0.3;} /* По умолчанию бледные */
.wiki-card:hover .control-button {opacity: 1;} /* При наведении на карточку становятся яркими */
/* Цвета кнопок (iOS style) */
.card-state-button { background-color: #ffc107; } /* Желтый (Edit) */
.wiki-card.is-editing .card-state-button { background-color: #28a745; } /* Зеленый (Save) */
.card-close-button { background-color: #ff5f57; } /* Красный (Close) */
/* Теги (просмотр) */
.card-tags-view {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 15px;}
.tag-pill-view {
    background-color: #f1f3f5;
    color: #555;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.8em;
    font-weight: 500;}
/* Контент */
.card-content-view {
    font-size: 1.05em;
    line-height: 1.6;
    color: #333;}
.card-content-view p { margin-top: 0; margin-bottom: 10px; }
/* Футер карточки */
.card-footer {
    font-size: 0.75em; /* Мелкий шрифт */
    color: #bbb;       /* Бледный цвет */
    margin-top: 15px;
    padding-top: 10px;
    border-top: 1px dashed #eee; /* Легкая линия */
    text-align: right; /* Прижат вправо */
    font-family: monospace;} /* Моноширинный шрифт для ID выглядит стильно */
/* --- РЕДАКТОР (Исправление верстки) --- */
.card-editor-ui {
    display: flex;
    flex-direction: column;
    gap: 15px;}
/* Поля ввода */
.editor-input-field {
    width: 100%;
    padding: 8px 0;
    border: none;
    border-bottom: 1px solid #ddd;
    font-size: 1.3em; /* Крупный заголовок */
    font-weight: bold;
    outline: none;
    font-family: inherit;
    background: transparent;}
.editor-input-field:focus { border-bottom-color: #28a745; }
/* Контейнер тегов (FIX: flex-wrap чтобы не было вертикально) */
.editor-tags-wrapper {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    /* Увеличиваем отступ между элементами */
    gap: 8px; 
    padding: 8px 0;
    margin-bottom: 15px;
    border-bottom: 1px solid #eee;}
.tags-input-field {
    border: none;
    outline: none;
    font-size: 0.9em;
    flex-grow: 1;
    min-width: 120px;}
/* Тулбар (FIX: выравнивание) */
.editor-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 5px; /* Отступы между кнопками */
    background-color: #f8f9fa;
    padding: 5px;
    border-radius: 6px;
    border: 1px solid #eee;}
.toolbar-btn {
    width: 30px;
    height: 30px;
    background: white;
    border: 1px solid #ddd;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9em;
    color: #444;}
.toolbar-btn:hover { background-color: #fff; border-color: #aaa; }
/* Поле контента */
.editor-content-area {
    min-height: 200px;
    padding: 10px;
    border: 1px solid #eee;
    border-radius: 4px;
    outline: none;
    line-height: 1.6;
    font-size: 1em;}
.editor-content-area:focus { border-color: #ccc; }
/* Селектор типа */
.type-selector {
    margin-left: auto; /* Прижимаем вправо */
    padding: 4px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: white;
    font-size: 0.8em;}

/* === АВТОДОПОЛНЕНИЕ ТЕГОВ (Dropdown) === */
.editor-tags-wrapper {
    position: relative; /* Якорь для позиционирования списка */
    margin-bottom: 10px;}
.autocomplete-dropdown {
    position: absolute;
    top: 100%; /* Сразу под полем ввода */
    left: 0;
    width: 100%; /* На всю ширину поля */
    background-color: #fff;
    border: 1px solid #ccc;
    border-top: none;
    border-radius: 0 0 4px 4px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.15); /* Тень для объема */
    max-height: 200px;
    overflow-y: auto; /* Прокрутка, если тегов много */
    z-index: 1000;    /* Поверх всего */
    display: none;}    /* Скрыто по умолчанию */
.autocomplete-item {
    padding: 8px 12px;
    cursor: pointer;
    font-size: 14px;
    color: #333;
    border-bottom: 1px solid #f5f5f5;
    transition: background 0.1s;}
.autocomplete-item:last-child {border-bottom: none;}
.autocomplete-item:hover {
    background-color: #eef6fc; /* Подсветка при наведении */
    color: #000;}
/* === КОМПАКТНЫЙ РЕДАКТОР ПАРАМЕТРОВ === */
.editor-extra-fields {
    background: #f8f9fa;
    padding: 10px;
    border-radius: 4px;
    margin-top: 15px;
    border: 1px solid #eee;}
/* =========================================
   (Settings & Tags)
   ========================================= */
/* --- 1. КРАСИВЫЕ ТЕГИ (Blue Pills) --- */
.tag-pill, .tag-pill-view {
    background-color: #d1eaff; 
    color: #0056b3;
    padding: 5px 12px; /* Чуть больше воздуха внутри */
    border-radius: 15px;
    font-size: 0.9em;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    /* На всякий случай добавим маргин, если браузер плохо понимает flex gap */
    margin-right: 2px; 
    border: 1px solid rgba(0, 86, 179, 0.1);
    cursor: pointer; /* Делаем курсор "рукой" */
    transition: background-color 0.2s, transform 0.1s;}
.tag-pill-view:hover {
    background-color: #e2e6ea; /* Подсветка при наведении */
    transform: translateY(-1px);}
.tag-pill-remove {
    cursor: pointer;
    font-weight: bold;
    color: #0056b3;
    opacity: 0.6;}
.tag-pill-remove:hover { opacity: 1; }
/* --- 2. КРАСИВЫЕ НАСТРОЙКИ (Settings Card) --- */
.settings-form-container {
    padding: 10px 15px;
    display: flex;
    flex-direction: column;
    gap: 15px;
    max-width: 100%;}
.settings-group {
    display: flex;
    flex-direction: column;
    gap: 6px;}
.settings-group label {
    font-weight: 600;
    font-size: 0.9rem;
    color: #444;}
.settings-group input {
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 1rem;
    width: 100%;
    box-sizing: border-box;
    transition: border-color 0.2s, box-shadow 0.2s;}
.settings-group input:focus {
    border-color: #28a745;
    box-shadow: 0 0 0 3px rgba(40, 167, 69, 0.1);
    outline: none;}
.settings-actions {
    display: flex;
    justify-content: flex-end; /* Кнопки справа */
    gap: 10px;
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #eee;}
.btn-settings-save {
    background-color: #28a745;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 5px;
    font-size: 1rem;
    cursor: pointer;
    font-weight: 500;}
.btn-settings-save:hover { background-color: #218838; }
.btn-settings-cancel {
    background-color: white;
    color: #555;
    border: 1px solid #ddd;
    padding: 10px 20px;
    border-radius: 5px;
    font-size: 1rem;
    cursor: pointer;}
.btn-settings-cancel:hover { background-color: #f8f9fa; }
/* --- 3. ФИКС ТУЛБАРА (Чтобы кнопки не уезжали) --- */
.editor-toolbar {
    /* Принудительно слева, но аккуратно */
    justify-content: flex-start; 
    padding: 8px 10px;
    background-color: #f9f9f9;}
/* --- БЛОК ПОЛЬЗОВАТЕЛЬСКИХ ПАРАМЕТРОВ --- */
.editor-extra-fields {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px dashed #eee;}
.extra-fields-label {
    display: block;
    font-size: 0.85em;
    font-weight: 600;
    color: #999;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;}
.extra-fields-row {
    display: flex;
    gap: 10px;
    align-items: center;}
.extra-field-key {
    flex: 1;
    padding: 6px 10px;
    border: 1px solid #eee;
    border-radius: 4px;
    font-size: 0.9em;
    color: #555;
    background: #fdfdfd;}
.extra-field-value {
    flex: 2;
    padding: 6px 10px;
    border: 1px solid #eee;
    border-radius: 4px;
    font-size: 0.9em;
    color: #333;}
.btn-add-field {
    width: 30px;
    height: 30px;
    border: 1px solid #ddd;
    background: white;
    border-radius: 50%;
    cursor: pointer;
    font-weight: bold;
    color: #28a745;
    display: flex;
    align-items: center;
    justify-content: center;}
.btn-add-field:hover { background-color: #f0fff4; border-color: #28a745; }
/* === АДАПТИВНОЕ ВИДЕО (Youtube / Video) === */
.card-content-view iframe,
.card-content-view video,
.card-content-view embed,
.card-content-view object {
    max-width: 100%;
    /* !important перебивает атрибуты width="580" в старом HTML */
    width: 100% !important; 
    height: auto !important;
    /* Современное свойство для пропорций 16:9 */
    aspect-ratio: 16 / 9;
    /* Убираем рамки и добавляем скругление */
    border: none;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    display: block;
    margin: 10px 0;}
/* Для мобильных устройств убираем отступы карточки, чтобы видео было шире */
@media (max-width: 600px) {
    .card-content-view iframe {
        border-radius: 4px;} }
/* === АДАПТИВНЫЕ КАРТИНКИ === */
.card-content-view img {
    max-width: 100%;
    height: auto;
    display: block;       /* Убирает отступ снизу */
    margin: 10px 0;       /* Отступы сверху/снизу */
    border-radius: 4px;   /* Легкое скругление */
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);}
/* Иконка в заголовке фрейма */
.card-title-icon {
    width: 24px;
    height: 24px;
    object-fit: contain;
    vertical-align: middle;}
/* === TABS STYLES === */
.wiki-tabs-container {border: 1px solid #ddd; border-radius: 4px; overflow: hidden; margin: 15px 0;}
/* Horizontal Header */
.wiki-tabs-header { 
    background: #f9f9f9; 
    border-bottom: 1px solid #ddd; 
    display: flex; 
    flex-wrap: wrap; /* <-- РАЗРЕШАЕМ ПЕРЕНОС */
    overflow-x: visible;} /* Убираем скролл */
.tab-btn {
    padding: 6px 10px; /* Меньше отступы */
    border: none; background: transparent; cursor: pointer;
    border-right: 1px solid #eee; 
    border-bottom: 1px solid transparent; /* Резерв под активную линию */
    white-space: nowrap;
    font-size: 0.9rem; /* Чуть компактнее шрифт */
    flex-grow: 0;} /* Не растягиваться лишнего */
.tab-btn:hover { background: #eee; }
.tab-btn.active { background: #fff; font-weight: bold; border-bottom: 2px solid #2ecc71; }
/* Vertical Sidebar */
.wiki-tabs-container.mode-vertical { display: flex; min-height: 200px; }
.wiki-tabs-sidebar {
    width: 200px; background: #f4f4f4; border-right: 1px solid #ddd;
    display: flex; flex-direction: column; flex-shrink: 0;}
.tab-btn-v {
    padding: 8px 12px; text-align: left; border: none; background: transparent; cursor: pointer;
    border-bottom: 1px solid #eee;}
.tab-btn-v:hover { background: #e9e9e9; }
.tab-btn-v.active { background: #fff; font-weight: bold; border-left: 4px solid #2ecc71; }
/* Mixed Mode */
.wiki-nested-body { display: flex; min-height: 300px; }
.nested-sidebar { width: 180px; background: #fafafa; }
.wiki-tab-content { flex-grow: 1; padding: 20px; background: #fff; }
/* === ИКОНКИ В КАРТОЧКЕ === */
/* Картинки-иконки (png/jpg/svg файл) */
.card-icon {
    width: 24px;
    height: 24px;
    object-fit: contain;
    vertical-align: middle;
    display: inline-block;}
/* Обертка для SVG-кода (чтобы ограничить размер) */
.card-icon-wrapper {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    vertical-align: middle;}
/* SVG внутри обертки */
.card-icon-wrapper svg {
    width: 100%;
    height: 100%;
    fill: currentColor;} /* Чтобы SVG наследовал цвет текста, если нужно */
/* Иконки внутри таблеток тегов (чуть меньше) */
.tag-pill-view .card-icon,
.tag-pill-view .card-icon-wrapper {
    width: 16px;
    height: 16px;
    margin-right: 5px; /* Отступ от текста */
    vertical-align: text-bottom;}
/* === БЛОК КОДА (PRE) === */
.card-content-view pre {
    background-color: #f5f7f9;
    border: 1px solid #e1e4e8;
    border-radius: 6px;
    padding: 12px;
    margin: 10px 0;
    /* ГЛАВНОЕ ИЗМЕНЕНИЕ: ПЕРЕНОС СТРОК */
    white-space: pre-wrap;       /* Сохраняет пробелы, но переносит текст */
    word-wrap: break-word;       /* Разрывает длинные слова, если не влезают */
    overflow-wrap: break-word;   /* Современный аналог */
    max-width: 100%;
    font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
    font-size: 0.9em;
    line-height: 1.45;
    color: #24292e;}