/**
 * Table Message Type Styles
 * Styles for data tables with sorting functionality
 */

/* Table Container */
.table-message-container {
    width: 100%;
    margin: 8px 0;
}

/* Table Wrapper for horizontal scrolling */
.table-wrapper {
    overflow-x: auto;
    margin-bottom: 8px;
    border-radius: 6px;
    border: 1px solid #e0e0e0;
    background: #fff;
}

/* Data Table */
.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
    min-width: 400px;
}

/* Table Headers */
.data-table thead {
    background: #f5f5f5;
    border-bottom: 2px solid #e0e0e0;
}

.data-table th {
    padding: 12px 16px;
    text-align: left;
    font-weight: 600;
    color: #333;
    white-space: nowrap;
    position: relative;
}

/* Sortable table headers */
.data-table.sortable th[data-column] {
    user-select: none;
    padding-right: 30px;
}

.data-table.sortable th[data-column]:hover {
    background: #ebebeb;
}

/* Sort Indicator */
.sort-indicator {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    color: #666;
    font-size: 12px;
}

/* Table Body */
.data-table tbody tr {
    border-bottom: 1px solid #e0e0e0;
    transition: background-color 0.2s ease;
}

.data-table tbody tr:hover {
    background: #f9f9f9;
}

.data-table tbody tr:last-child {
    border-bottom: none;
}

/* Table Cells */
.data-table td {
    padding: 10px 16px;
    color: #555;
}

/* Alternating row colors */
.data-table tbody tr:nth-child(even) {
    background: #fafafa;
}

.data-table tbody tr:nth-child(even):hover {
    background: #f5f5f5;
}

/* Table Info (row count) */
.table-info {
    font-size: 12px;
    color: #666;
    padding: 4px 8px;
    text-align: right;
    font-style: italic;
}

/* Table Error */
.table-error {
    padding: 12px;
    background: #ffebee;
    color: #c62828;
    border-radius: 4px;
    border-left: 4px solid #c62828;
    font-size: 14px;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .data-table {
        font-size: 12px;
        min-width: 300px;
    }
    
    .data-table th,
    .data-table td {
        padding: 8px 10px;
    }
    
    .data-table.sortable th[data-column] {
        padding-right: 24px;
    }
    
    .sort-indicator {
        right: 6px;
        font-size: 10px;
    }
    
    .table-info {
        font-size: 11px;
    }
}

/* Small Mobile */
@media (max-width: 480px) {
    .data-table {
        font-size: 11px;
        min-width: 280px;
    }
    
    .data-table th,
    .data-table td {
        padding: 6px 8px;
    }
}

/* Dark Mode Support (if chat has dark mode) */
@media (prefers-color-scheme: dark) {
    .table-wrapper {
        border-color: #444;
        background: #2a2a2a;
    }
    
    .data-table thead {
        background: #333;
        border-bottom-color: #444;
    }
    
    .data-table th {
        color: #e0e0e0;
    }
    
    .data-table.sortable th[data-column]:hover {
        background: #3a3a3a;
    }
    
    .data-table tbody tr {
        border-bottom-color: #444;
    }
    
    .data-table tbody tr:hover {
        background: #333;
    }
    
    .data-table td {
        color: #ccc;
    }
    
    .data-table tbody tr:nth-child(even) {
        background: #252525;
    }
    
    .data-table tbody tr:nth-child(even):hover {
        background: #2f2f2f;
    }
    
    .table-info {
        color: #999;
    }
    
    .table-error {
        background: #3a1f1f;
        color: #ff6b6b;
        border-left-color: #ff6b6b;
    }
}

/* Print Styles */
@media print {
    .table-wrapper {
        border: 1px solid #000;
        overflow: visible;
    }
    
    .data-table {
        page-break-inside: auto;
    }
    
    .data-table tr {
        page-break-inside: avoid;
        page-break-after: auto;
    }
    
    .data-table thead {
        display: table-header-group;
    }
    
    .sort-indicator {
        display: none;
    }
}
