/* ui/table.css */
/* Styles for the interactive table, filters, totals, and interactive charts */

:root {
    /* Define variables if necessary, but generally rely on main style.css for core variables */
    --bg-card: #ffffff;
    --text-primary: #0b1220;
    --text-muted: #64748b;
    --border-color: #e2e8f0;
    --accent: #06b6d4;
}

/* General table structure for interactive table */
.report-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 12px;
}

.report-table th,
.report-table td {
    padding: 10px 12px;
    border-bottom: 1px solid var(--border-color);
    text-align: left;
    font-size: 13px;
}

.report-table th {
    background: #fafbfc;
    font-weight: 600;
    position: relative;
}

.report-table tbody tr:hover {
    background: #fafbfc;
}

/* Sortable Headers */
.report-table th.sortable {
    cursor: pointer;
    user-select: none;
}

.report-table th.sortable:hover {
    background: #f1f5f9;
}

.report-table th .sort-icon {
    margin-left: 4px;
    color: var(--accent);
}

/* Column Filters */
.filter-input-wrapper {
    margin-top: 8px;
    padding: 4px;
    background: #f8fafc;
    border-radius: 4px;
}

.column-filter-input {
    width: 100%;
    padding: 6px 8px;
    font-size: 12px;
    border: 2px solid var(--border-color);
    border-radius: 4px;
    background: white;
    transition: all 0.2s ease;
}

.column-filter-input:focus {
    outline: none;
    border-color: var(--accent);
    background: #f0f9ff;
    box-shadow: 0 0 0 3px rgba(6, 182, 212, 0.1);
}

.column-filter-input:not(:placeholder-shown) {
    border-color: #fbbf24;
    background: #fffbeb;
}

.table-controls {
    margin-bottom: 12px;
}

/* Totals Summary (General) */
.totals-summary {
    background: #f8fafc;
    padding: 12px 16px;
    border-radius: 6px;
    margin-bottom: 16px;
}

.totals-summary h4 {
    margin: 0 0 8px 0;
    color: var(--text-primary);
}

.totals-summary p {
    margin: 4px 0;
    font-size: 14px;
}

/* Active Filters Display */
.active-filters {
    display: none;
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    border: 2px solid #fbbf24;
    border-radius: 8px;
    padding: 12px 16px;
    margin-bottom: 16px;
    font-size: 13px;
    box-shadow: 0 2px 8px rgba(251, 191, 36, 0.2);
}

.active-filters.visible {
    display: block;
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.active-filters h4 {
    margin: 0 0 8px 0;
    font-size: 14px;
    font-weight: 600;
    color: #92400e;
    display: flex;
    align-items: center;
    gap: 6px;
}

.active-filters h4::before {
    content: "🔍";
    font-size: 16px;
}

.active-filters > div {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.active-filters .filter-tag {
    display: inline-flex;
    align-items: center;
    background: white;
    border: 1px solid #f59e0b;
    border-radius: 6px;
    padding: 4px 10px;
    margin: 0;
    font-size: 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    transition: all 0.2s ease;
}

.active-filters .filter-tag:hover {
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
    transform: translateY(-1px);
}

.active-filters .filter-tag strong {
    color: #92400e;
    margin-right: 4px;
}

/* Interactive Table Statistics & Charts */
.interactive-stats-section {
    margin-bottom: 20px;
    padding: 16px;
    background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
    border-radius: 8px;
    border: 1px solid #bae6fd;
}

.interactive-stats-section h4 {
    margin: 0 0 12px 0;
    color: #0c4a6e;
    font-size: 15px;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 12px;
    margin-bottom: 16px;
}

.stat-card {
    background: white;
    padding: 12px;
    border-radius: 6px;
    border: 1px solid #bae6fd;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.stat-card .stat-label {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.stat-card .stat-value {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
}

.interactive-charts-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 16px;
    margin-top: 16px;
}

.interactive-chart-wrapper {
    background: white;
    padding: 12px;
    border-radius: 6px;
    border: 1px solid #bae6fd;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.interactive-chart-wrapper h5 {
    margin: 0 0 10px 0;
    font-size: 13px;
    color: #0c4a6e;
    text-align: center;
}