/* =============================================================================
   FOREMAN.CSS - Стили страницы бригадира фасовки
   ============================================================================= */

.foreman-page {
    padding: 16px;
    max-width: 100%;
}

.foreman-page .page-header {
    margin-bottom: 16px;
}

.foreman-page .page-title {
    font-size: 20px;
    font-weight: 600;
    color: #1e293b;
    margin: 0;
}

/* Таблица бригадира */
.foreman-table-container {
    background: white;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    overflow: hidden;
    max-width: 100%;
}

.foreman-table-container .tabulator {
    max-width: 100%;
}

/* Кнопка действия в таблице */
.action-btn-add {
    width: 28px;
    height: 28px;
    padding: 0;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    border-radius: 6px;
    color: white;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s, box-shadow 0.2s;
}

.action-btn-add:hover {
    transform: scale(1.1);
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.4);
}

/* Кнопка "Применить" в бригадире */
#foremanFilterBtn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    color: white;
    padding: 6px 16px;
    font-weight: 500;
}

#foremanFilterBtn:hover {
    background: linear-gradient(135deg, #5a6fd6 0%, #6a4190 100%);
    transform: translateY(-1px);
    color: white;
}

/* =============================================================================
   Модалка производства (UX-редизайн)
   ============================================================================= */

.production-modal .modal-dialog {
    max-width: 90vw;
}

.production-modal .modal-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-bottom: none;
    padding: 16px 20px;
}

.production-modal .modal-title {
    font-size: 16px;
    font-weight: 600;
}

/* .btn-close стили вынесены в base.css */

.production-modal .modal-body {
    padding: 20px;
}

/* =============================================================================
   Шапка заказа
   ============================================================================= */

.order-info-card {
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    border-radius: 10px;
    padding: 16px 20px;
    margin-bottom: 20px;
    border-left: 4px solid #667eea;
}

.order-info-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.order-info-card .order-number {
    font-size: 16px;
    font-weight: 600;
    color: #1e293b;
}

.order-info-card .order-date {
    font-size: 13px;
    color: #64748b;
    background: white;
    padding: 4px 10px;
    border-radius: 6px;
}

.order-info-card .order-product {
    font-size: 14px;
    color: #475569;
    margin-bottom: 8px;
}

.order-info-card .order-plan {
    display: flex;
    align-items: center;
    gap: 6px;
}

.order-info-card .plan-label {
    font-size: 13px;
    color: #64748b;
}

.order-info-card .plan-value {
    font-size: 15px;
    font-weight: 600;
    color: #667eea;
}

/* =============================================================================
   Секция результат (главная)
   ============================================================================= */

.result-section {
    background: white;
    border: 2px solid #667eea;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 16px;
}

.result-section-title {
    font-size: 12px;
    font-weight: 600;
    color: #667eea;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 16px;
}

/* =============================================================================
   Пять колонок: Количество, Старт, Финиш, Оборудование, Ответственный
   ============================================================================= */

.result-five-cols {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
    align-items: flex-start;
}

.result-col {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.result-col-label {
    font-weight: 500;
    color: #475569;
    font-size: 14px;
}

.result-col input[type="number"] {
    width: 100px;
}

.result-col input[type="date"],
.result-col input[type="time"] {
    width: 130px;
}

.result-col-wide {
    min-width: 200px;
}

.result-col-wide .form-select {
    width: 100%;
}

/* Поле ответственного - приглушено */
.result-col input[readonly] {
    background-color: #f8fafc;
    border-color: #e2e8f0;
    color: #64748b;
    width: 100px;
}

/* =============================================================================
   Разделитель в секции результат
   ============================================================================= */

.result-divider {
    border: none;
    border-top: 1px solid #e2e8f0;
    margin: 16px 0;
}

/* =============================================================================
   Время внутри секции результат
   ============================================================================= */

.time-inputs-group {
    margin-bottom: 0;
}

.time-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 8px;
}

.time-row:last-child {
    margin-bottom: 0;
}

.time-label {
    font-size: 14px;
    font-weight: 500;
    color: #1e293b;
    width: 50px;
}

.time-inputs-group .form-control {
    max-width: 150px;
}

/* =============================================================================
   Секция брак
   ============================================================================= */

.defects-section {
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    overflow: hidden;
}

.defects-section-title {
    font-size: 12px;
    font-weight: 500;
    color: #64748b;
    background: #f8fafc;
    padding: 10px 16px;
    border-bottom: 1px solid #e2e8f0;
    margin: 0;
}

.defects-list {
    max-height: 250px;
    overflow-y: auto;
}

.defect-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
    border-bottom: 1px solid #f1f5f9;
}

.defect-row:last-child {
    border-bottom: none;
}

.defect-row .defect-name {
    flex: 1;
    font-size: 13px;
    color: #475569;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    padding-right: 12px;
}

.defect-input-wrapper {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

.defects-list .defect-row .defect-input {
    width: 70px;
    text-align: center;
    font-size: 13px;
    padding: 4px 8px;
}

.defect-unit {
    font-size: 12px;
    color: #94a3b8;
    min-width: 25px;
}

/* Footer модалки */
.production-modal .modal-footer {
    border-top: 1px solid #e2e8f0;
    padding: 16px 20px;
    background: #fafbfc;
}

.production-modal .modal-footer .btn {
    padding: 10px 24px;
    font-size: 14px;
    font-weight: 500;
    line-height: 1.5;
}

.production-modal .modal-footer .btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    color: white;
    transition: all 0.2s;
}

.production-modal .modal-footer .btn-primary:hover {
    background: linear-gradient(135deg, #5a6fd6 0%, #6a4190 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.production-modal .modal-footer .btn-primary:active {
    transform: translateY(0);
    box-shadow: 0 2px 6px rgba(102, 126, 234, 0.3);
}

.production-modal .modal-footer .btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.production-modal .modal-footer .btn-secondary {
    background: white;
    border: 1px solid #e2e8f0;
    color: #64748b;
}

/* =============================================================================
   Ссылки на производства в таблице
   ============================================================================= */

.production-link {
    color: #667eea;
    text-decoration: none;
    font-size: 12px;
}

.production-link:hover {
    color: #764ba2;
    text-decoration: underline;
}

/* =============================================================================
   Секция заказ (дополнения)
   ============================================================================= */

.order-details {
    display: flex;
    gap: 20px;
    margin-bottom: 8px;
    font-size: 13px;
    color: #64748b;
}

.order-detail strong {
    color: #1e293b;
}

.order-plan .plan-unit {
    font-size: 13px;
    color: #64748b;
}

/* =============================================================================
   Секция оборудование
   ============================================================================= */

.equipment-row {
    margin-top: 16px;
}

.equipment-row .form-select {
    max-width: 300px;
}

/* =============================================================================
   Секция материалы
   ============================================================================= */

.materials-section {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 12px;
    margin-top: 16px;
}

.materials-section-title {
    font-size: 12px;
    font-weight: 600;
    color: #475569;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}

/* Таблица материалов */
.materials-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.materials-table thead th {
    font-size: 11px;
    font-weight: 600;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    padding: 6px 4px;
    border-bottom: 1px solid #e2e8f0;
    vertical-align: bottom;
}

.materials-table thead th.two-line-header {
    line-height: 1.3;
    text-align: center;
}

.materials-table tbody td {
    padding: 4px;
    vertical-align: middle;
}

.materials-table .material-row {
    border-bottom: 1px solid #f1f5f9;
}

.materials-table .material-row:hover {
    background: #f8fafc;
}

.materials-table .material-row.additional-batch {
    background: #fafbfc;
}

.materials-table .material-row.additional-batch:hover {
    background: #f1f5f9;
}

.materials-table .material-name-cell {
    font-weight: normal;
    color: #1e293b;
}


.materials-table .action-cell {
    width: 30px;
    text-align: center;
}

/* Инпуты в таблице */
.materials-table input.form-control {
    padding: 2px 6px;
    font-size: 13px;
    height: auto;
}

.materials-table input[type="text"] {
    width: 60px;
}

.materials-table input[type="number"] {
    width: 60px;
    text-align: right;
}

/* Кнопки в таблице */
.materials-table .add-batch-btn,
.materials-table .remove-batch-btn {
    font-size: 18px;
    font-weight: bold;
    line-height: 1;
}

/* Колонка производств в таблице бригадира */
.production-row {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-bottom: 2px;
}

.production-row:last-child {
    margin-bottom: 0;
}

.production-pdf-btn {
    font-size: 12px;
    text-decoration: none;
    opacity: 0.5;
    cursor: pointer;
}

.production-pdf-btn:hover {
    opacity: 1;
}

/* Перенос текста для колонки продукции */
.product-cell-wrap {
    white-space: normal;
    word-break: break-word;
    line-height: 1.3;
}
