/* ФАЙЛ: .rontend\moduleseference_editoreference_editor.css */

/* =================================================================================
   TABULATOR CUSTOMIZATIONS & REFERENCE EDITOR STYLES (PATCHED v29.0)
================================================================================= */

.tabulator { 
    background-color: var(--bg-card) !important; 
    border: none !important; 
    font-size: 14px !important; 
}

.tabulator-tableholder .tabulator-table,
.tabulator-row,
.tabulator-header {
    min-width: 100% !important;
}

.tabulator .tabulator-header,
.tabulator .tabulator-header .tabulator-col,
.tabulator .tabulator-header .tabulator-frozen {
    background-color: var(--bg-card) !important;
    color: var(--text-main) !important;
}

.tabulator .tabulator-header {
    border-bottom: 1px solid var(--tabulator-grid) !important;
}

.tabulator-header .tabulator-col .tabulator-col-content {
    position: relative !important;
    padding: 8px 4px !important; 
    min-height: 40px !important;
    height: 100% !important;
    display: flex !important;
    flex-direction: column !important;
    justify-content: center !important;
}

.tabulator-header .tabulator-col .tabulator-col-content .tabulator-col-title-holder {
    position: static !important;
}

.tabulator-header .tabulator-col .tabulator-col-content .tabulator-col-title {
    padding: 0 5px !important; 
    white-space: normal !important; 
    word-wrap: break-word !important; 
    text-overflow: clip !important; 
    overflow: visible !important;
    display: flex !important; 
    flex-direction: column !important;
    justify-content: center !important; 
    align-items: center !important; 
    text-align: center !important;
    height: 100% !important;
    width: 100% !important;
}

.tabulator-header .tabulator-col .tabulator-col-content .tabulator-col-sorter {
    position: absolute !important;
    top: 8px !important;
    right: 4px !important;
    bottom: auto !important;
}

.tabulator-arrow {
    border-bottom-color: var(--text-muted) !important; 
    border-top-color: var(--text-muted) !important; 
}

.tabulator-col.tabulator-sortable[aria-sort="ascending"] .tabulator-arrow {
    border-bottom-color: var(--text-muted) !important; 
}

.tabulator-col.tabulator-sortable[aria-sort="descending"] .tabulator-arrow {
    border-top-color: var(--text-muted) !important; 
}

.tabulator .tabulator-tableholder .tabulator-table { 
    background-color: transparent !important; 
}

.tabulator-row .tabulator-cell, 
.tabulator .tabulator-header .tabulator-col {
    border-right: 1px solid var(--tabulator-grid) !important;
}
.tabulator-row .tabulator-cell:last-child, 
.tabulator .tabulator-header .tabulator-col:last-child {
    border-right: none !important;
}

.custom-app-tooltip {
    position: fixed; 
    background-color: var(--bg-card); 
    color: var(--text-main); 
    border: 1px solid var(--tabulator-grid); 
    border-radius: var(--element-radius); 
    padding: 6px 12px; 
    font-size: 13px; 
    box-shadow: 0 4px 15px rgba(0,0,0,0.3); 
    z-index: 100000; 
    pointer-events: none; 
    opacity: 0; 
    visibility: hidden; 
    transition: opacity 0.15s ease-in-out; 
    max-width: 320px; 
    word-wrap: break-word; 
    white-space: pre-wrap;
}

@media (hover: hover) and (pointer: fine) {
    html body .tabulator .tabulator-header .tabulator-col.tabulator-sortable.tabulator-col-sorter-element[tabulator-field="_index"]:hover,
    html body .tabulator .tabulator-header .tabulator-col.tabulator-sortable[tabulator-field="_index"]:hover {
        background-color: var(--bg-card) !important;
        background-image: none !important;
        cursor: default !important;
    }
}

html body .tabulator .tabulator-header .tabulator-col[tabulator-field="_index"]:hover,
html body .tabulator .tabulator-header .tabulator-col[tabulator-field="_index"] *:hover {
    background-image: none !important;
    cursor: default !important;
}

.tabulator-cell { padding: 4px !important; box-sizing: border-box !important; position: relative !important; }

.tabulator-cell.tabulator-editing { 
    padding: 0 !important; 
    border: none !important; 
    outline: 2px solid var(--accent-blue) !important;
    outline-offset: -2px !important;
}

html[data-theme="dark"] .tabulator-cell.tabulator-editing { border-right: 1px solid var(--tabulator-grid) !important; }
html[data-theme="light"] .tabulator-cell.tabulator-editing { border-right: 1px solid var(--tabulator-grid) !important; }

.tabulator-cell.tabulator-editing input[type="text"],
.tabulator-cell.tabulator-editing input[type="number"],
.tabulator-cell.tabulator-editing textarea,
.tabulator-edit-box,
.tabulator-editor {
    background-color: transparent !important;
    color: inherit !important;
    border: none !important;
    box-shadow: none !important;
    outline: none !important;
    padding: 4px !important; 
    margin: 0 !important;
    width: 100% !important;
    min-height: 24px !important;
    box-sizing: border-box !important;
    font-family: inherit !important;
    font-size: inherit !important;
    line-height: 1.4 !important;
    resize: none !important;
    overflow: hidden !important; 
    border-radius: 0 !important;
}

.tabulator-cell.copied-cell-dashed {
    outline: none !important;
    box-shadow: none !important;
}

.tabulator-cell.copied-cell-dashed input[type="text"],
.tabulator-cell.copied-cell-dashed input[type="number"],
.tabulator-cell.copied-cell-dashed textarea,
.tabulator-cell.copied-cell-dashed .tabulator-editor {
    outline: none !important;
    box-shadow: none !important;
}

.tabulator-cell.copied-cell-dashed::after {
    content: '';
    position: absolute;
    inset: 0;
    border: 2px dashed var(--accent-blue) !important;
    box-sizing: border-box !important; 
    pointer-events: none; 
    z-index: 10;
}

.tabulator-row.duplicate-row { background-color: #cc3333 !important; color: white !important; }
.tabulator-row.duplicate-row .tabulator-cell { background-color: #cc3333 !important; color: white !important; }

.row-header-cell { cursor: pointer; text-align: center; background-color: inherit !important; }
.row-header-cell:hover { background-image: linear-gradient(0deg, rgba(120,120,120,0.15), rgba(120,120,120,0.15)) !important; }

html[data-theme="dark"] .tabulator-row.tabulator-row-even:not(.duplicate-row).tabulator-selected { background-color: #333 !important; } 
html[data-theme="dark"] .tabulator-row.tabulator-row-odd:not(.duplicate-row).tabulator-selected { background-color: #444 !important; } 
html[data-theme="light"] .tabulator-row.tabulator-row-even:not(.duplicate-row).tabulator-selected { background-color: #EFEFEF !important; }
html[data-theme="light"] .tabulator-row.tabulator-row-odd:not(.duplicate-row).tabulator-selected { background-color: #fff !important; }

.tabulator-row.tabulator-selected, 
.tabulator-row.tabulator-selected .row-header-cell, 
.tabulator-row.tabulator-selected:hover, 
.tabulator-row.tabulator-selected:hover .row-header-cell {
    background-image: linear-gradient(0deg, rgba(100, 150, 255, 0.25), rgba(100, 150, 255, 0.25)) !important;
}

.tabulator-row.tabulator-selected .tabulator-cell:not(.row-header-cell), 
.tabulator-row.tabulator-selected:hover .tabulator-cell:not(.row-header-cell) { 
    background-color: transparent !important; 
    background-image: none !important;
}

.tabulator-menu {
    background-color: var(--bg-card) !important;
    border: 1px solid var(--tabulator-grid) !important;
    box-shadow: 0 4px 15px rgba(0,0,0,0.3) !important;
    border-radius: var(--element-radius) !important;
    padding: 0 !important; 
    overflow: hidden !important; 
    z-index: 999999 !important; 
}

.tabulator-menu .tabulator-menu-item {
    color: var(--text-main) !important;
    padding: 10px 15px !important; 
    font-size: 14px !important;
    margin: 0 !important;
    border: none !important;
    border-radius: 0 !important;
    width: 100% !important;
    box-sizing: border-box !important;
    transition: background-color 0.2s !important;
}

.tabulator-menu .tabulator-menu-item:hover {
    background-color: var(--accent-blue) !important;
    color: white !important;
}

.tabulator-menu .tabulator-menu-separator {
    border-top: 1px solid var(--tabulator-grid) !important;
    margin: 0 !important; 
}

/* =================================================================================
   ИКОНОЧНЫЕ ВЫПАДАЮЩИЕ СПИСКИ (ICON DROPDOWNS)
================================================================================= */
.icon-dropdown-wrapper { position: relative; display: inline-flex; }
.icon-dropdown-options { 
    position: absolute; 
    top: calc(100% + 4px); 
    left: 50%;
    transform: translateX(-50%);
    background-color: var(--bg-card); 
    border: 1px solid var(--border-color); 
    border-radius: var(--element-radius); 
    box-shadow: 0 4px 15px rgba(0,0,0,0.3); 
    z-index: 1000; 
    display: none; 
    flex-direction: row; 
    gap: 4px; 
    padding: 4px; 
}
.icon-dropdown-wrapper.open .icon-dropdown-options { display: flex; }
.icon-dropdown-option {
    width: 32px; height: 32px;
    border-radius: var(--element-radius);
    display: flex; align-items: center; justify-content: center;
    cursor: pointer;
    background-color: transparent;
    color: var(--text-main);
    transition: background-color 0.2s;
}
.icon-dropdown-option:hover { background-color: var(--btn-secondary-hover); }
.icon-dropdown-option.selected { background-color: var(--btn-secondary); }
