/* Custom table styling for better spacing and organization */

.table-responsive {
    overflow-x: auto;
    overflow-y: visible;
    max-height: 800px;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    -webkit-overflow-scrolling: touch;
}

/* Custom scrollbar styling */
.table-responsive::-webkit-scrollbar {
    height: 8px;
    width: 8px;
}

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

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

.table-responsive::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* Firefox scrollbar */
.table-responsive {
    scrollbar-color: #888 #f1f1f1;
    scrollbar-width: thin;
}

table.display {
    width: 100%;
    border-collapse: collapse;
    min-width: 1200px;
}

table.display thead {
    background-color: #f8f9fa;
    border-top: 2px solid #dee2e6;
    border-bottom: 2px solid #dee2e6;
    position: sticky;
    top: 0;
    z-index: 10;
}

table.display thead th {
    padding: 12px 15px;
    font-weight: 600;
    font-size: 13px;
    color: #333;
    text-align: left;
    white-space: nowrap;
    vertical-align: middle;
    border-right: 1px solid #dee2e6;
}

table.display thead th:last-child {
    border-right: none;
}

table.display tbody td {
    padding: 12px 15px;
    border-right: 1px solid #dee2e6;
    border-bottom: 1px solid #f1f1f1;
    vertical-align: middle;
    color: #555;
    font-size: 13px;
}

table.display tbody td:last-child {
    border-right: none;
}

table.display tbody tr {
    transition: background-color 0.2s ease;
}

table.display tbody tr:hover {
    background-color: #f8f9fa;
}

table.display tbody tr:last-child td {
    border-bottom: 2px solid #dee2e6;
}

/* Sticky first column for row numbers */
table.display tbody td:first-child {
    position: sticky;
    left: 0;
    background-color: white;
    z-index: 5;
    font-weight: 500;
    min-width: 60px;
}

table.display tbody tr:hover td:first-child {
    background-color: #f8f9fa;
}

table.display thead th:first-child {
    position: sticky;
    left: 0;
    background-color: #f8f9fa;
    z-index: 11;
}

/* Make images display nicely in tables */
table.display tbody td img {
    border-radius: 4px;
    object-fit: cover;
}

/* Badge styling */
table.display tbody .badge {
    padding: 6px 10px;
    font-size: 12px;
    font-weight: 500;
    border-radius: 4px;
}

table.display tbody .badge-success {
    background-color: #28a745;
    color: white;
}

table.display tbody .badge-danger {
    background-color: #dc3545;
    color: white;
}

table.display tbody .badge-info {
    background-color: #17a2b8;
    color: white;
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    transition: background-color 0.2s ease;
}

table.display tbody .badge-info:hover {
    background-color: #138496;
}

/* Action buttons styling */
table.display .d-flex {
    gap: 6px;
}

/* Align numeric values to the right */
table.display tbody td:nth-child(4),
table.display tbody td:nth-child(5),
table.display tbody td:nth-child(6),
table.display tbody td:nth-child(7),
table.display tbody td:nth-child(8),
table.display tbody td:nth-child(9),
table.display tbody td:nth-child(10),
table.display tbody td:nth-child(11),
table.display tbody td:nth-child(12),
table.display tbody td:nth-child(13),
table.display tbody td:nth-child(14) {
    text-align: right;
    font-family: 'Courier New', monospace;
}

/* Responsive adjustments */
@media (max-width: 1200px) {
    table.display thead th,
    table.display tbody td {
        padding: 10px 12px;
        font-size: 12px;
    }
}

@media (max-width: 768px) {
    table.display thead th,
    table.display tbody td {
        padding: 8px 10px;
        font-size: 11px;
    }
    
    table.display thead th {
        font-weight: 500;
    }
}
