/**
 * Стили для формы создания документа
 */

/* Стили поиска материалов */
.search-container {
    position: relative;
}

#search-results {
    display: none;
    position: absolute;
    width: 100%;
    max-height: 300px;
    overflow-y: auto;
    z-index: 1000;
    background-color: var(--bs-body-bg);
    border: 1px solid var(--bs-border-color);
    border-radius: 0.375rem;
    margin-top: 5px;
}

#search-results.active {
    display: block;
}

/* Анимации для строк материалов */
.new-item {
    animation: highlight-new 1.5s ease-in-out;
}

.fade-out {
    opacity: 0;
    transform: translateX(10px);
    transition: all 0.3s ease-out;
}

@keyframes highlight-new {
    0% {
        background-color: rgba(var(--bs-primary-rgb), 0.2);
    }
    100% {
        background-color: transparent;
    }
}

/* Адаптивные кнопки */
.btn-responsive {
    white-space: normal;
}

@media (max-width: 576px) {
    .btn-responsive {
        font-size: 0.875rem;
        padding: 0.375rem 0.5rem;
    }
}

/* Стили для мобильных устройств */
@media (max-width: 768px) {
    table.table thead {
        display: none;
    }
    
    table.table tbody tr {
        display: block;
        margin-bottom: 1rem;
        border: 1px solid var(--bs-border-color);
        border-radius: 0.375rem;
        padding: 0.5rem;
    }
    
    table.table tbody td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        border-top: none;
        border-bottom: 1px solid var(--bs-border-color);
        padding: 0.5rem;
    }
    
    table.table tbody td:last-child {
        border-bottom: none;
    }
    
    table.table tbody td:before {
        content: attr(data-label);
        font-weight: bold;
        margin-right: 1rem;
    }
    
    table.table tbody td.text-end {
        justify-content: space-between;
    }
    
    table.table tfoot tr {
        display: block;
        margin-top: 1rem;
    }
    
    table.table tfoot th {
        display: block;
        text-align: left;
    }
    
    table.table tfoot th:first-child {
        display: block;
        text-align: center;
    }
}

/* Стили для предпросмотра документа */
.preview-document {
    font-size: 0.9rem;
}

@media print {
    .preview-document {
        font-size: 12pt;
    }
    
    .preview-document h4 {
        font-size: 16pt;
    }
    
    .preview-document h5 {
        font-size: 14pt;
    }
    
    .preview-document table {
        border-collapse: collapse;
        width: 100%;
    }
    
    .preview-document table, 
    .preview-document th, 
    .preview-document td {
        border: 1px solid #000;
    }
    
    .preview-document th, 
    .preview-document td {
        padding: 8px;
    }
}

/* Улучшения для таблицы материалов */
.quantity-input,
.price-input {
    text-align: center;
}

.total-cell.text-success {
    color: var(--bs-success) !important;
    font-weight: bold;
}