/* ===== СПЕЦИФИЧЕСКИЕ СТИЛИ ДЛЯ ВКЛАДКИ ВВОДА ДАННЫХ ===== */

/* Панель управления периодом */
.period-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #f0f7fa;
    padding: 16px 20px;
    margin-bottom: 20px;
    border-radius: 6px;
    flex-wrap: wrap;
    gap: 16px;
}

.period-controls-left {
    display: flex;
    align-items: center;
    gap: 24px;
    flex-wrap: wrap;
    flex: 1;
}

.period-controls-center {
    display: flex;
    align-items: center;
}

.period-controls-right {
    display: flex;
    align-items: center;
}

.period-input-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.period-input {
    width: 100px !important;
    text-align: center;
}

.period-separator {
    color: #6c8a9a;
    font-weight: 600;
}

.year-controls {
    display: flex;
    gap: 8px;
}

/* Обертка таблицы */
.table-wrapper {
    overflow-x: auto;
    border: 2px solid #cbd8df;
    border-radius: 4px;
    background: white;
    margin-bottom: 16px;
}

/* Excel-подобная таблица */
.excel-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    min-width: 1200px;
    table-layout: fixed;
}

/* Заголовки таблицы */
.excel-table th {
    background: #1e4a5f;
    color: white;
    font-weight: 600;
    padding: 12px 8px;
    border: 1px solid #2d5e73;
    position: sticky;
    top: 0;
    z-index: 10;
    text-align: center !important;
    vertical-align: middle !important;
    white-space: normal !important;
    word-wrap: break-word;
    word-break: break-word;
    line-height: 1.4;
    min-height: 48px;
    height: auto;
    overflow-wrap: break-word;
    hyphens: auto;
}

.excel-table th i {
    margin-left: 6px;
    opacity: 0.8;
    display: inline-block;
    vertical-align: middle;
}

.th-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 48px;
    width: 100%;
}

.th-content i {
    margin-top: 4px;
}

/* Фиксированная ширина колонок */
.excel-table th:nth-child(1) { min-width: 70px; width: 70px; }
.excel-table th:nth-child(2) { min-width: 140px; }
.excel-table th:nth-child(3) { min-width: 140px; }
.excel-table th:nth-child(4) { min-width: 140px; }
.excel-table th:nth-child(5) { min-width: 120px; }
.excel-table th:nth-child(6) { min-width: 160px; }
.excel-table th:nth-child(7) { min-width: 160px; }
.excel-table th:nth-child(8) { min-width: 140px; }
.excel-table th:nth-child(9) { min-width: 140px; }
.excel-table th:nth-child(10) { min-width: 150px; }
.excel-table th:nth-child(11) { min-width: 140px; }

/* Ячейки таблицы */
.excel-table td {
    border: 1px solid #d3e0e5;
    padding: 0;
    position: relative;
    height: 40px;
    text-align: inherit;
}

/* Содержимое ячейки */
.cell-content {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
}

/* Отображение значения */
.cell-display {
    display: block;
    padding: 8px 10px;
    cursor: pointer;
    width: 100%;
    height: 100%;
    line-height: 24px;
    text-align: inherit;
}

.cell-display:hover {
    background: #f0f7fa;
    cursor: cell;
}

/* Поле ввода */
.cell-input {
    width: 100%;
    height: 100%;
    border: 2px solid #2c5f2d;
    padding: 7px 9px;
    font-family: 'Roboto Mono', monospace;
    font-size: 13px;
    background: white;
    outline: none;
    box-shadow: 0 0 0 2px rgba(44, 95, 45, 0.2);
    z-index: 20;
    position: relative;
    text-align: inherit;
}

.cell-input:focus {
    background: #fff9e6;
}

/* Только для чтения */
.read-only-value {
    display: block;
    padding: 8px 10px;
    background: #f0f7fa;
    color: #0a3143;
    font-weight: 500;
    width: 100%;
    height: 100%;
    line-height: 24px;
    text-align: inherit;
}

/* Активная ячейка */
td.active-cell {
    outline: 3px solid #2c5f2d;
    outline-offset: -1px;
    z-index: 5;
    position: relative;
    box-shadow: inset 0 0 0 1px rgba(44, 95, 45, 0.3);
}

/* Ячейка с ошибкой */
td.error-cell {
    background: #fff0f0;
}

/* Индикатор ошибки */
.error-indicator {
    position: absolute;
    top: 2px;
    right: 2px;
    color: #b22222;
    font-size: 12px;
    cursor: help;
    z-index: 20;
}

/* Футер таблицы */
.table-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 16px;
    padding: 8px 16px;
    background: #f0f7fa;
    border-radius: 4px;
    font-size: 12px;
    color: #4f6f7f;
}

/* Информация о периоде */
.period-info {
    display: flex;
    align-items: center;
    gap: 16px;
}

/* Сводка валидации */
.validation-summary {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 13px;
}

.validation-summary.has-errors {
    background: #ffe6e6;
    color: #b22222;
}

.validation-summary.no-errors {
    background: #e1f0e5;
    color: #1f6e43;
}

/* Информация о ячейке */
.cell-info {
    display: flex;
    gap: 16px;
    align-items: center;
    background: white;
    padding: 4px 16px;
    border-radius: 20px;
    border: 1px solid #cbd8df;
}

/* Подсказка по валидации */
.validation-hint {
    background: #e3edf0;
    padding: 4px 12px;
    border-radius: 20px;
    color: #0a3143;
    font-weight: 500;
    font-family: 'Roboto Mono', monospace;
}

/* Координаты ячейки */
.cell-coordinates {
    font-weight: 600;
    color: #0a3143;
}

/* Значение ячейки */
.cell-value {
    font-family: 'Roboto Mono', monospace;
    background: #eef5f7;
    padding: 2px 8px;
    border-radius: 12px;
}

/* Статус OK */
.cell-ok {
    color: #1f6e43;
}

/* Статус ошибки */
.cell-error {
    color: #b22222;
}

/* Статус только для чтения */
.cell-readonly {
    color: #8ba3ad;
    font-size: 11px;
}

/* Адаптивность для мобильных устройств */
@media (max-width: 768px) {
    .period-controls {
        flex-direction: column;
        align-items: stretch;
    }
    
    .period-controls-left {
        flex-direction: column;
        align-items: stretch;
    }
    
    .period-input-group {
        flex-wrap: wrap;
    }
    
    .period-controls-right {
        justify-content: flex-start;
    }
    
    .table-footer {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
    
    .cell-info {
        flex-wrap: wrap;
    }
}
