/* TTC Data Visualization & Tables */

/* Enhanced Table */
.ttc-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--ttc-bg-card);
    border-radius: var(--ttc-radius-md);
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.ttc-table thead {
    background: var(--ttc-bg-muted);
    border-bottom: 2px solid var(--ttc-border-light);
}

.ttc-table th {
    padding: var(--ttc-space-md) var(--ttc-space-lg);
    text-align: left;
    font-weight: var(--ttc-fw-semibold);
    color: var(--ttc-text-main);
    cursor: pointer;
    user-select: none;
    transition: background var(--ttc-transition-fast);
}

.ttc-table th:hover {
    background: rgba(99, 102, 241, 0.05);
}

.ttc-table tbody tr {
    border-bottom: 1px solid var(--ttc-border-subtle);
    transition: background var(--ttc-transition-fast);
}

.ttc-table tbody tr:hover {
    background: rgba(99, 102, 241, 0.02);
}

.ttc-table td {
    padding: var(--ttc-space-md) var(--ttc-space-lg);
    color: var(--ttc-text-main);
}

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

/* Table Striped */
.ttc-table.striped tbody tr:nth-child(even) {
    background: rgba(99, 102, 241, 0.02);
}

/* Table Compact */
.ttc-table.compact th,
.ttc-table.compact td {
    padding: var(--ttc-space-sm) var(--ttc-space-md);
    font-size: var(--ttc-fs-xs);
}

/* Table Sorting Indicator */
.ttc-table th.sortable::after {
    content: '';
    display: inline-block;
    width: 12px;
    height: 12px;
    margin-left: var(--ttc-space-xs);
    opacity: 0.3;
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M7 15l5-5 5 5M7 9l5-5 5 5"/></svg>');
    background-size: contain;
    background-repeat: no-repeat;
}

.ttc-table th.sortable.asc::after {
    opacity: 1;
    transform: rotate(180deg);
}

.ttc-table th.sortable.desc::after {
    opacity: 1;
}

/* Table Cell Status */
.ttc-cell-status {
    display: inline-flex;
    align-items: center;
    gap: var(--ttc-space-xs);
    padding: var(--ttc-space-xs) var(--ttc-space-md);
    border-radius: var(--ttc-radius-sm);
    font-size: var(--ttc-fs-xs);
    font-weight: var(--ttc-fw-semibold);
}

.ttc-cell-status.active {
    background: rgba(16, 185, 129, 0.1);
    color: #10b981;
}

.ttc-cell-status.inactive {
    background: rgba(107, 114, 128, 0.1);
    color: #6b7280;
}

.ttc-cell-status.pending {
    background: rgba(245, 158, 11, 0.1);
    color: #f59e0b;
}

.ttc-cell-status.error {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
}

/* Progress Ring */
.ttc-progress-ring {
    width: 60px;
    height: 60px;
    transform: rotate(-90deg);
    margin: var(--ttc-space-md) auto;
}

.ttc-progress-ring-circle {
    transition: stroke-dashoffset 0.35s;
    stroke: var(--ttc-primary);
    stroke-linecap: round;
}

.ttc-progress-ring-bg {
    stroke: var(--ttc-border-subtle);
}

.ttc-progress-ring-label {
    text-align: center;
    font-weight: var(--ttc-fw-semibold);
    color: var(--ttc-primary);
    font-size: var(--ttc-fs-sm);
}

/* Gauge Chart */
.ttc-gauge {
    width: 120px;
    height: 120px;
    position: relative;
    margin: var(--ttc-space-lg) auto;
}

.ttc-gauge-track {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: conic-gradient(
        var(--ttc-primary) 0deg,
        var(--ttc-primary) var(--percentage),
        var(--ttc-border-subtle) var(--percentage),
        var(--ttc-border-subtle) 360deg
    );
    display: flex;
    align-items: center;
    justify-content: center;
}

.ttc-gauge-inner {
    width: 90%;
    height: 90%;
    border-radius: 50%;
    background: var(--ttc-bg-card);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.ttc-gauge-value {
    font-size: var(--ttc-fs-2xl);
    font-weight: var(--ttc-fw-bold);
    color: var(--ttc-primary);
}

.ttc-gauge-label {
    font-size: var(--ttc-fs-xs);
    color: var(--ttc-text-muted);
}

/* Chart Container */
.ttc-chart {
    position: relative;
    width: 100%;
    height: 300px;
    margin: var(--ttc-space-xl) 0;
    padding: var(--ttc-space-lg);
    background: var(--ttc-bg-card);
    border-radius: var(--ttc-radius-lg);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.ttc-chart canvas {
    max-width: 100%;
    height: auto;
}

/* Chart Legend */
.ttc-chart-legend {
    display: flex;
    flex-wrap: wrap;
    gap: var(--ttc-space-md);
    padding-top: var(--ttc-space-md);
    border-top: 1px solid var(--ttc-border-light);
    margin-top: var(--ttc-space-md);
    justify-content: center;
}

.ttc-chart-legend-item {
    display: flex;
    align-items: center;
    gap: var(--ttc-space-xs);
    font-size: var(--ttc-fs-xs);
}

.ttc-chart-legend-color {
    width: 12px;
    height: 12px;
    border-radius: 2px;
}

/* Bar Chart */
.ttc-bar-chart {
    display: flex;
    align-items: flex-end;
    justify-content: space-around;
    height: 200px;
    gap: var(--ttc-space-md);
    padding: var(--ttc-space-lg);
}

.ttc-bar-chart-bar {
    flex: 1;
    background: linear-gradient(180deg, var(--ttc-primary), #a855f7);
    border-radius: var(--ttc-radius-md) var(--ttc-radius-md) 0 0;
    position: relative;
    transition: all var(--ttc-transition-fast);
}

.ttc-bar-chart-bar:hover {
    opacity: 0.8;
    transform: translateY(-2px);
}

.ttc-bar-chart-label {
    position: absolute;
    bottom: -24px;
    left: 0;
    right: 0;
    text-align: center;
    font-size: var(--ttc-fs-xs);
    color: var(--ttc-text-muted);
}

.ttc-bar-chart-value {
    position: absolute;
    top: -24px;
    left: 0;
    right: 0;
    text-align: center;
    font-size: var(--ttc-fs-xs);
    font-weight: var(--ttc-fw-semibold);
}

/* Pie Chart */
.ttc-pie-chart {
    width: 200px;
    height: 200px;
    border-radius: 50%;
    position: relative;
    margin: var(--ttc-space-lg) auto;
    background: conic-gradient(var(--ttc-primary) 0deg 90deg, #10b981 90deg 200deg, #f59e0b 200deg 300deg, #ef4444 300deg 360deg);
}

.ttc-pie-chart-center {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 75%;
    height: 75%;
    border-radius: 50%;
    background: var(--ttc-bg-card);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
}

.ttc-pie-chart-value {
    font-size: var(--ttc-fs-2xl);
    font-weight: var(--ttc-fw-bold);
    color: var(--ttc-primary);
}

.ttc-pie-chart-label {
    font-size: var(--ttc-fs-xs);
    color: var(--ttc-text-muted);
}

/* Line Chart */
.ttc-line-chart {
    position: relative;
    width: 100%;
    height: 200px;
    padding: var(--ttc-space-lg);
}

.ttc-line-chart svg {
    width: 100%;
    height: 100%;
}

.ttc-line-chart-point {
    fill: var(--ttc-primary);
    stroke: white;
    stroke-width: 2;
    transition: all var(--ttc-transition-fast);
}

.ttc-line-chart-point:hover {
    r: 6;
    filter: drop-shadow(0 0 4px rgba(99, 102, 241, 0.5));
}

/* Tooltip */
.ttc-tooltip {
    position: absolute;
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: var(--ttc-space-sm) var(--ttc-space-md);
    border-radius: var(--ttc-radius-sm);
    font-size: var(--ttc-fs-xs);
    white-space: nowrap;
    pointer-events: none;
    z-index: 10;
    display: none;
}

.ttc-tooltip.show {
    display: block;
}

.ttc-tooltip::after {
    content: '';
    position: absolute;
    width: 0;
    height: 0;
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    border-top: 5px solid rgba(0, 0, 0, 0.8);
    bottom: -5px;
    left: 50%;
    transform: translateX(-50%);
}

/* Metrics Dashboard */
.ttc-metrics {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: var(--ttc-space-lg);
    margin: var(--ttc-space-xl) 0;
}

@media (max-width: 1200px) {
    .ttc-metrics {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .ttc-metrics {
        grid-template-columns: 1fr;
    }
}

.ttc-metric {
    background: var(--ttc-bg-card);
    border-radius: var(--ttc-radius-lg);
    padding: var(--ttc-space-lg);
    border: 1px solid var(--ttc-border-light);
    transition: all var(--ttc-transition-fast);
}

.ttc-metric:hover {
    transform: translateY(-2px);
    box-shadow: var(--ttc-shadow-md);
}

.ttc-metric-label {
    font-size: var(--ttc-fs-xs);
    color: var(--ttc-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: var(--ttc-space-sm);
}

.ttc-metric-value {
    font-size: var(--ttc-fs-3xl);
    font-weight: var(--ttc-fw-bold);
    color: var(--ttc-text-main);
}

.ttc-metric-change {
    font-size: var(--ttc-fs-xs);
    margin-top: var(--ttc-space-sm);
    display: flex;
    align-items: center;
    gap: var(--ttc-space-xs);
}

.ttc-metric-change.positive {
    color: #10b981;
}

.ttc-metric-change.negative {
    color: #ef4444;
}

.ttc-metric-change.positive::before {
    content: '↑';
}

.ttc-metric-change.negative::before {
    content: '↓';
}

/* Heatmap */
.ttc-heatmap {
    display: grid;
    gap: 2px;
    margin: var(--ttc-space-lg) 0;
}

.ttc-heatmap-row {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(16px, 1fr));
    gap: 2px;
}

.ttc-heatmap-cell {
    aspect-ratio: 1;
    border-radius: 2px;
    background: var(--ttc-border-subtle);
    transition: all var(--ttc-transition-fast);
    cursor: pointer;
}

.ttc-heatmap-cell:hover {
    transform: scale(1.2);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.ttc-heatmap-cell.level-0 {
    background: var(--ttc-border-subtle);
}

.ttc-heatmap-cell.level-1 {
    background: rgba(99, 102, 241, 0.25);
}

.ttc-heatmap-cell.level-2 {
    background: rgba(99, 102, 241, 0.5);
}

.ttc-heatmap-cell.level-3 {
    background: rgba(99, 102, 241, 0.75);
}

.ttc-heatmap-cell.level-4 {
    background: var(--ttc-primary);
}
