.purchase-page {
    max-width: 98%;
}

.purchase-page .card {
    border: 1px solid #dee2e6;
    border-radius: 0.5rem;
    box-shadow: none;
}

.purchase-card-header {
    background-color: #f8f9fa;
    color: #495057;
    border-bottom: 1px solid #dee2e6;
    border-radius: 0.5rem 0.5rem 0 0 !important;
}

#purchaseTable {
    table-layout: auto;
    border-collapse: separate;
    border-spacing: 0;
}

.purchase-page .table-responsive {
    overflow-x: auto;
    overflow-y: visible !important;
}

.purchase-page .card,
.purchase-page .card-body,
#purchaseTable,
#purchaseTable tbody,
#purchaseTable tr,
#purchaseTable td {
    overflow: visible;
}

#purchaseTable th,
#purchaseTable td {
    display: table-cell !important;
    width: auto !important;
    text-align: center;
    vertical-align: middle;
    padding: 0.7rem 0.6rem;
    font-size: 14px;
}

#purchaseTable thead th {
    border-bottom: 1px solid #dee2e6 !important;
}

#purchaseTable tbody td {
    border-top: 0 !important;
    border-bottom: 1px solid #edf0f3 !important;
}

#purchaseTable tbody tr:last-child td {
    border-bottom: 0 !important;
}

#purchaseTable th {
    font-size: 13px;
    font-weight: 600;
}

#purchaseTable .form-control,
#purchaseTable .form-select {
    min-height: 42px;
    font-size: 14px;
}

#purchaseTable textarea.form-control {
    min-height: 70px;
    line-height: 1.35;
}

#purchaseTable th:first-child,
#purchaseTable td:first-child,
#purchaseTable th:nth-child(6),
#purchaseTable td:nth-child(6) {
    text-align: left;
}

#purchaseTable .product-code-cell {
    position: relative;
    vertical-align: middle;
}

#purchaseTable .product-code-cell .product-code {
    position: relative;
    z-index: 10001;
}

#purchaseTable .product-code-cell .product-code:focus {
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
}

#purchaseTable .suggestions {
    position: fixed;
    top: 0;
    left: 0;
    right: auto;
    width: 420px;
    max-width: min(90vw, 620px);
    background: #fff;
    border: 1px solid #ced4da;
    border-top: 0 !important;
    border-radius: 0.25rem;
    border-top-left-radius: 0;
    border-top-right-radius: 0;
    max-height: 220px;
    overflow-y: auto;
    z-index: 20000;
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.14);
    margin-top: 0;
    display: none;
}

#purchaseTable .suggestions:empty {
    display: none;
}

#purchaseTable .suggestion-item,
#purchaseTable .suggestions > div {
    padding: 8px 12px;
    cursor: pointer;
    border-top: 0 !important;
    border-bottom: 1px solid #f1f3f5;
    white-space: normal;
    word-break: break-word;
}

#purchaseTable .suggestion-item:last-child,
#purchaseTable .suggestions > div:last-child {
    border-bottom: 0;
}

#purchaseTable .suggestion-item:first-child,
#purchaseTable .suggestions > div:first-child {
    border-top: 0 !important;
}

#purchaseTable .suggestion-item:hover,
#purchaseTable .suggestions > div:hover {
    background-color: #f8f9fa;
}

#purchaseTable tfoot .total-row {
    background-color: #f8f9fa;
    font-weight: 600;
}

.purchase-page .action-buttons {
    display: flex;
    gap: 10px;
}

@media (max-width: 768px) {
    .purchase-page .table-responsive {
        font-size: 0.85rem;
        overflow-x: auto;
        overflow-y: visible;
    }

    #purchaseTable th,
    #purchaseTable td {
        padding: 0.6rem 0.45rem;
        font-size: 13px;
    }

    #purchaseTable .form-control,
    #purchaseTable .form-select {
        min-height: 40px;
        font-size: 13px;
    }

    #purchaseTable .suggestions {
        width: min(96vw, 420px);
        max-width: 96vw;
        margin-top: 0;
    }

    .purchase-page .action-buttons {
        flex-direction: column;
        width: 100%;
    }

    .purchase-page .action-buttons .btn,
    .purchase-page #addProductBtn {
        width: 100%;
    }
}
