/* tables.css – стили модуля Таблицы */
.tables-columns-panel .form-columns {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    align-items: stretch;
    padding: 10px 0;
}
.tables-columns-panel .form-column {
    flex: 0 0 auto;
    border: 1px solid #ddd;
    border-radius: 6px;
    padding: 10px 12px;
    background: #f8f9fa;
    min-width: 160px;
    transition: box-shadow 0.2s;
    position: relative;
}
.tables-columns-panel .form-column:hover {
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}
.tables-columns-panel .form-column .field-admin-controls {
    display: none;
    position: absolute;
    top: -10px;
    right: 5px;
    background: rgba(255,255,255,0.95);
    border-radius: 12px;
    padding: 2px 6px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    border: 1px solid #ccc;
    z-index: 10;
}
.tables-columns-panel .form-column:hover .field-admin-controls {
    display: flex;
}
.field-control-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: #f0f0f0;
    border: 1px solid #ddd;
    cursor: pointer;
    font-size: 14px;
    color: #6c757d;
    transition: background 0.2s;
    user-select: none;
}
.field-control-btn:hover {
    background: #e0e0e0;
}

#data-table th {
    background: #f0f0f0;
}
#data-table .btn-sm {
    padding: 0.1rem 0.4rem;
    font-size: 0.7rem;
}
.modal-body .form-group {
    margin-bottom: 0.8rem;
}
.modal-body label {
    font-weight: 500;
}

/* тёмная тема */
body.theme-dark .tables-columns-panel .form-column {
    background: #2a2a2a;
    border-color: #444;
    color: #e0e0e0;
}
body.theme-dark .tables-columns-panel .form-column:hover {
    box-shadow: 0 2px 8px rgba(0,0,0,0.4);
}
body.theme-dark .tables-columns-panel .form-column .field-admin-controls {
    background: rgba(40,40,40,0.95);
    border-color: #555;
}
body.theme-dark .field-control-btn {
    background: #444;
    border-color: #666;
    color: #e0e0e0;
}
body.theme-dark .field-control-btn:hover {
    background: #555;
}
body.theme-dark #data-table th {
    background: #333;
    color: #e0e0e0;
    border-color: #444;
}
body.theme-dark #data-table td {
    background: #2a2a2a;
    color: #e0e0e0;
    border-color: #444;
}
body.theme-dark .modal-content {
    background: #2a2a2a;
    color: #e0e0e0;
}
body.theme-dark .modal-header,
body.theme-dark .modal-footer {
    border-color: #444;
}
body.theme-dark .modal-body .form-control,
body.theme-dark .modal-body .form-select {
    background: #333;
    color: #e0e0e0;
    border-color: #555;
}

/* Инлайн-редактор */
.editable-cell {
    position: relative;
    cursor: pointer;
}
.editable-cell:hover {
    text-decoration: underline dotted #0d6efd;
}
.inline-edit-icon {
    display: none;
    margin-left: 5px;
    font-size: 12px;
    color: #0d6efd;
}
.editable-cell:hover .inline-edit-icon {
    display: inline !important;
}
.inline-editor-input {
    width: 100%;
    padding: 2px 4px;
    border: 1px solid #0d6efd;
    border-radius: 3px;
}
/* Скрытая колонка на панели администратора (глазик 🙈): бледная, пунктир —
   как скрытое поле в конструкторе форм. В таблицу посетителя не выводится. */
#columnsContainer .form-column.column-hidden {
    opacity: .55;
    /* outline, а не border: рамку блока задаёт редактор стилей инлайном */
    outline: 2px dashed #adb5bd;
    outline-offset: -2px;
}
#columnsContainer .form-column .toggle-column-visibility-btn { cursor: pointer; }

/* ===== 2026-10-21: кнопка настроек справа, своя прокрутка таблицы, перетаскивание ===== */
.tables-admin-bar { display: flex; justify-content: flex-end; margin-bottom: 10px; }
.tables-columns-panel .form-columns { display: flex; flex-wrap: wrap; gap: 15px; align-items: stretch; padding: 14px 0 6px; }
/* Таблица шире экрана — прокручивается в своей области: полоса прокрутки видна
   внизу окна, а не под последней строкой; шапка и фильтры остаются сверху. */
.tables-scroll {
    max-width: 100%;
    max-height: calc(100vh - 160px);
    min-height: 160px;
    overflow: auto;
    margin-bottom: 0;
    cursor: grab;
    overscroll-behavior: contain;
}
.tables-scroll.is-grabbing, .tables-scroll.is-grabbing * { cursor: grabbing !important; user-select: none; }
.tables-scroll #data-table { margin-bottom: 0; }
.tables-scroll #data-table thead th,
.tables-scroll #data-table thead .filter-row td { position: sticky; z-index: 2; background-clip: padding-box; }
.tables-scroll #data-table thead tr:first-child th { top: 0; }
.tables-scroll #data-table thead .filter-row td { top: var(--tables-head-h, 41px); background: var(--bs-body-bg, #fff); }
.tables-scroll #data-table td, .tables-scroll #data-table th { white-space: nowrap; }
.tables-scroll #data-table td { max-width: 360px; overflow: hidden; text-overflow: ellipsis; }
.tables-scroll input, .tables-scroll select, .tables-scroll textarea, .tables-scroll button, .tables-scroll a { cursor: auto; }
.tables-scroll button, .tables-scroll a { cursor: pointer; }
/* Правка на месте — только по тексту (и ✎ в пустой ячейке). */
.tables-cell-text { cursor: text; border-radius: 3px; padding: 0 2px; margin: 0 -2px; }
.tables-cell-text:hover { background: rgba(13, 110, 253, .1); box-shadow: inset 0 -1px 0 rgba(13, 110, 253, .55); }
#data-table .inline-edit-icon { display: inline-block; margin-left: 5px; color: #0d6efd; font-size: 12px; cursor: pointer; }
.tables-scroll .inline-editor-input { min-width: 140px; cursor: text; }
body.theme-dark .tables-scroll #data-table thead .filter-row td { background: #1f1f1f; }

/* Список / переключатель (2026-10-21): значение — обычный текст, ✎ появляется при наведении. */
.tables-cell-choice { display: inline-flex; align-items: center; gap: 6px; }
.tables-cell-pick { color: #0d6efd; font-size: 12px; cursor: pointer; opacity: 0; transition: opacity .12s; padding: 0 2px; border-radius: 3px; }
.tables-cell-choice:hover .tables-cell-pick, td:hover > .tables-cell-choice .tables-cell-pick, .tables-cell-pick:focus { opacity: 1; }
.tables-cell-pick:hover { background: rgba(13, 110, 253, .12); }
@media (hover: none) { .tables-cell-pick { opacity: .6; } }
.tables-scroll select.inline-editor-input { min-width: 140px; cursor: pointer; }
