﻿/* ── InputGrid: общий вид редакторов ячейки ─────────────────────────────── */

:root {
    --b2-grid-cell-height: 28px;
    --b2-grid-editor-height: 28px;
}

.b2-dropdown-button {
    width: 100%;
    height: var(--b2-grid-editor-height);
    min-height: var(--b2-grid-editor-height);

    display: flex;
    justify-content: space-between;
    align-items: center;

    padding: 0 8px;
    line-height: 1;
}

.b2-dropdown-button .anticon {
    color: #1677FF;
}

.b2-dropdown-button.b2-dropdown-input .anticon {
    color: #22B14C;
}

/* ── Выравнивание ─────────────────────────────── */

.b2-editor-align-left {
    text-align: left !important;
}

.b2-editor-align-center {
    text-align: center !important;
}

.b2-editor-align-right {
    text-align: right !important;
}

/* ── Фоны ячеек ─────────────────────────────── */

.b2-editor-bg-calculated {
    background-color: #FFFFC0 !important;
}

.b2-editor-bg-readonly {
    background-color: #E2E2E2 !important;
}

.b2-editor-bg-selected {
    background-color: #FFC0FF !important;
}

.b2-editor-bg-dynamic {
    background-color: #C0FFFF !important;
}

.b2-editor-bg-dictionary,
.b2-editor-bg-dialog,
.b2-editor-bg-ordinary {
    background-color: #FFFFFF !important;
}

.b2-editor-bg-merge {
    background-color: #E0FFFF !important;
}

.b2-editor-bg-dim {
    background-color: #A9A9A9 !important;
}

.b2-editor-bg-error-cell {
    background-color: #FFD700 !important;
}

.b2-editor-bg-error-row-bigdata {
    background-color: #FFE4E1 !important;
}

.b2-editor-bg-none {
    background-color: transparent !important;
}

.b2-editor-bg-arbitrary {
    background-color: var(--b2-cell-bg) !important;
}

/* ── Хост интерактивного редактора внутри ячейки ─────────────────────────────── */

.b2-cell-host {
    width: 100%;
    height: 100%;
    min-height: var(--b2-grid-editor-height);

    display: flex;
    align-items: stretch;
    box-sizing: border-box;

    cursor: pointer;
}

.b2-cell-host:focus,
.b2-cell-host:focus-visible {
    outline: none;
}

.b2-cell-host .ant-btn:focus,
.b2-cell-host .ant-btn:focus-visible,
.b2-cell-host .ant-btn-focused {
    outline: none !important;
    box-shadow: none !important;
}

/* ── GridCellView: внешняя рамка ячейки ─────────────────────────────── */

.b2-grid-cell,
.b2-grid-cell--selected {
    width: 100%;
    height: 100%;
    min-height: var(--b2-grid-cell-height);

    margin: 0;

    display: flex;
    align-items: stretch;
    box-sizing: border-box;

    border: 1px solid transparent;

    cursor: pointer;
}

.b2-grid-cell--selected {
    border: 2px solid #1677ff;
}

.b2-grid-cell:focus,
.b2-grid-cell--selected:focus {
    outline: none;
}

/* ── Обычная текстовая ячейка без InputGrid ─────────────────────────────── */

.b2-grid-cell__text {
    width: 100%;
    height: 100%;
    min-height: var(--b2-grid-editor-height);

    display: flex;
    align-items: center;
    box-sizing: border-box;

    padding: 0 4px;

    white-space: pre-wrap;
    word-break: break-word;
    overflow-wrap: break-word;
}

/* ── Общий контейнер содержимого InputGrid ─────────────────────────────── */

.b2-grid-cell__editor-host {
    width: 100%;
    height: 100%;
    min-height: var(--b2-grid-editor-height);

    display: flex;
    align-items: stretch;
    box-sizing: border-box;
}

.b2-grid-cell__editor-host--marked {
    border: dashed red;
}

/* ── Display-режим редакторов: до редактирования / readonly ─────────────────────────────── */

.b2-grid-cell__display {
    width: 100%;
    height: 100%;
    min-height: var(--b2-grid-editor-height);

    display: flex;
    align-items: center;
    box-sizing: border-box;

    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.b2-grid-cell__display.b2-editor-align-left {
    justify-content: flex-start;
}

.b2-grid-cell__display.b2-editor-align-center {
    justify-content: center;
}

.b2-grid-cell__display.b2-editor-align-right {
    justify-content: flex-end;
}

/* ── Реальные AntDesign-редакторы внутри ячейки ─────────────────────────────── */

.b2-grid-cell__editor-host .ant-input,
.b2-grid-cell__editor-host .ant-picker,
.b2-grid-cell__editor-host .ant-btn,
.b2-grid-cell__editor-host .ant-input-number {
    width: 100%;
    height: var(--b2-grid-editor-height);
    min-height: var(--b2-grid-editor-height);

    box-sizing: border-box;
}

.b2-grid-cell__editor-host .ant-input-number-input {
    height: var(--b2-grid-editor-height);
    min-height: var(--b2-grid-editor-height);
}

/* ── DatePicker как справочник: видим всегда, открывается по двойному клику ─────────────────────────────── */

.b2-date-host {
    cursor: pointer;
}

.b2-date-host .ant-picker {
    width: 100%;
    height: var(--b2-grid-editor-height);
    min-height: var(--b2-grid-editor-height);
}

.b2-date-host .ant-picker-input {
    height: 100%;
}

.b2-date-host .ant-picker input {
    cursor: pointer;
}

.b2-date-picker {
    cursor: pointer;
}

/* ── Display даты с иконкой календаря ─────────────────────────────── */

.b2-date-display {
    gap: 6px;
}

.b2-date-display__value {
    flex: 1;
    min-width: 0;
}

.b2-date-display__icon {
    flex-shrink: 0;

    opacity: 0.65;
    font-size: 14px;
    color: #1677FF;
}