/* Supplier list container */
#supplierList {
    max-height: 600px;
    overflow-y: auto;
    padding: 10px;
}

/* Supplier row styles */
.supplier-row {
    border: 1px solid #ddd;
    margin: 16px 0;
    padding: 0;
    border-radius: 4px;
    background: white;
    transition: box-shadow 0.3s ease, background-color 0.3s ease;
    cursor: pointer;
    display: flex;
    flex-direction: column;
}

.supplier-row:hover {
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

/* Supplier title section */
.supplier-title {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 15px;
    font-size: 1.1em;
    cursor: pointer;
    background: #f8f8f8;
}

.supplier-name {
    flex: 1;
    font-weight: bold;
}

/* Supplier details section */
.supplier-details {
    max-height: 0;
    opacity: 0;
    overflow: hidden;
    padding: 0 15px;
    border-top: none;
    transition: max-height 0.3s ease, opacity 0.3s ease, padding 0.3s ease;
}

.supplier-row.expanded .supplier-details {
    max-height: 400px;
    opacity: 1;
    padding: 15px;
    border-top: 1px solid #eee;
    overflow: hidden;
}

/* Table containers with scrollbar width compensation */
.supplier-details > table {
    width: calc(100% - 8px); /* Compensate for scrollbar width */
    table-layout: fixed;
    border-collapse: collapse;
    margin: 0;
}

.supplier-details .table-wrapper > table {
    width: 100%; /* Full width for inner table */
    table-layout: fixed;
    border-collapse: collapse;
    margin: 0;
}

/* Scrollable wrapper */
.supplier-details .table-wrapper {
    max-height: 350px;
    overflow-y: scroll; /* Always show scrollbar to maintain consistent width */
    overflow-x: hidden;
    margin: 0;
    padding: 0;
}

/* Column widths */
.supplier-details th,
.supplier-details td {
    width: 20%;
    padding: 8px 12px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    box-sizing: border-box;
    border-bottom: 1px solid #eee;
}

/* Sortable header styles */
.supplier-details th.sortable {
    position: relative;
    padding-left: 28px;
}

/* Sort button styles */
.supplier-details .sort-button {
    position: absolute;
    left: 4px;
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    padding: 0;
    margin: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    cursor: pointer;
}

.supplier-details .sort-button i {
    font-size: 12px;
    width: 12px;
    height: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Right align numeric columns */
.supplier-details td:nth-child(3),
.supplier-details td:nth-child(4),
.supplier-details td:nth-child(5),
.supplier-details th:nth-child(3),
.supplier-details th:nth-child(4),
.supplier-details th:nth-child(5) {
    text-align: right;
}

/* Fixed header */
.supplier-details thead {
    position: sticky;
    top: 0;
    z-index: 1;
    background: white;
}

/* Scrollbar styling */
.supplier-details .table-wrapper::-webkit-scrollbar {
    width: 8px;
}

.supplier-details .table-wrapper::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.supplier-details .table-wrapper::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 4px;
}

.supplier-details .table-wrapper::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* Savings styles */
.supplier-row.has-savings {
    border-color: rgba(40, 167, 69, 0.2);
}

.supplier-row.has-savings .supplier-title {
    background: rgba(40, 167, 69, 0.1);
}

.supplier-row.has-savings.expanded {
    background: rgba(40, 167, 69, 0.05);
}

.supplier-row.has-savings.expanded .supplier-details {
    background: transparent;
}

.supplier-row.has-savings.expanded .supplier-details th {
    background: rgba(40, 167, 69, 0.05);
}

/* View Savings button */
.view-savings-btn {
    background-color: #4CAF50;
    color: white;
    border: none;
    padding: 5px 10px;
    border-radius: 4px;
    cursor: pointer;
    margin-left: 10px;
    font-size: 0.9em;
    white-space: nowrap;
}

.view-savings-btn:hover {
    background-color: #45a049;
}

/* Add hover effect to sortable columns */
.supplier-details th.sortable:hover {
    background: #f0f0f0;
}