* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

body {
    background: #f0f2f5;
    color: #333;
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 100%;
    margin: 0 auto;
}

.header {
    background: white;
    padding: 15px 25px;
    border-radius: 10px;
    margin-bottom: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.duration-selector {
    display: flex;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
}

.duration-selector label {
    font-weight: 700;
    font-size: 15px;
    color: #333;
}

.duration-selector select {
    padding: 10px 16px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 14px;
    background: white;
    cursor: pointer;
    outline: none;
    transition: all 0.2s;
}

.duration-selector select:hover {
    border-color: #4CAF50;
}

.duration-selector select:focus {
    border-color: #4CAF50;
    box-shadow: 0 0 0 3px rgba(76, 175, 80, 0.1);
}

#search-box {
    padding: 10px 16px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 14px;
    background: white;
    outline: none;
    transition: all 0.2s;
    min-width: 250px;
}

#search-box:focus {
    border-color: #4CAF50;
    box-shadow: 0 0 0 3px rgba(76, 175, 80, 0.1);
}

#search-box::placeholder {
    color: #999;
}

.column-toggles {
    display: flex;
    gap: 15px;
    padding: 5px 10px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
}

.toggle-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    color: #555;
    -webkit-user-select: none;
    user-select: none;
    transition: color 0.2s;
}

.toggle-label:hover {
    color: #4CAF50;
}

.toggle-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: #4CAF50;
}

.toggle-label span {
    font-weight: 600;
}

.duration-selector .note {
    font-size: 13px;
    color: #777;
    margin-left: auto;
}

.loading {
    text-align: center;
    padding: 60px 20px;
    color: #666;
    font-size: 16px;
    background: white;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.hidden {
    display: none !important;
}

.data-table-container {
    background: white;
    border-radius: 10px;
    padding: 25px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.08);
    overflow-x: auto;
    overflow-y: visible;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    table-layout: auto;
    min-width: 1200px;
}

.data-table thead th {
    width: 25%;
}

.data-table thead tr {
    display: table-row;
}

.data-table thead th {
    background: #f8f9fa;
    padding: 0;
    border-right: 2px solid #dee2e6;
    vertical-align: top;
    display: table-cell;
}

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

.category-header {
    padding: 15px 12px;
    display: block;
    width: 25%;
    min-width: 350px;
}

.category-name {
    font-size: 16px;
    font-weight: 700;
    color: #2c3e50;
    margin-bottom: 12px;
    text-align: left;
    padding-left: 0;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    cursor: pointer;
    transition: color 0.2s;
}

.category-name:hover {
    color: #4CAF50;
}

.category-name .sort-icon {
    font-size: 14px;
    opacity: 0.6;
}

.metric-headers {
    display: flex;
    flex-direction: row;
    gap: 5px;
    text-align: center;
    align-items: center;
    justify-content: flex-start;
    padding-left: 98px;
    margin-bottom: 8px;
}

.metric-headers span {
    font-size: 11px;
    font-weight: 700;
    color: #555;
    padding: 6px 0;
    background: #f0f0f0;
    border-radius: 6px;
    border: 1px solid #ddd;
    width: 62px;
    text-align: center;
    white-space: nowrap;
}

.metric-headers span.sortable {
    cursor: pointer;
    transition: all 0.2s;
    border-radius: 4px;
}

.metric-headers span.sortable:hover {
    background: #e0e0e0;
    color: #333;
}

.sort-icon {
    font-size: 9px;
    opacity: 0.5;
    margin-left: 2px;
    cursor: pointer;
    -webkit-user-select: none;
    user-select: none;
}

.data-table tbody td {
    padding: 2px 10px;
    border-right: 2px solid #dee2e6;
    border-bottom: 1px solid #f0f0f0;
    vertical-align: top;
}

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

.index-row {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    margin-bottom: 6px;
    padding: 0;
    gap: 8px;
}

.index-row:last-child {
    margin-bottom: 0;
}

.index-name-cell {
    font-size: 13px;
    font-weight: 500;
    color: #333;
    cursor: pointer;
    transition: all 0.2s;
    width: 90px;
    min-width: 90px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-align: left;
    flex-shrink: 0;
    margin-right: 8px;
}

.index-name-cell:hover {
    color: #4CAF50;
    font-weight: 500;
}

.metrics-grid {
    display: flex;
    flex-direction: row;
    gap: 5px;
    flex-shrink: 0;
    align-items: center;
}

.metric-cell {
    text-align: center;
    padding: 0;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 700;
    color: white;
    transition: all 0.2s;
    cursor: default;
    position: relative;
    width: 62px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
}

.metric-cell:hover {
    transform: scale(1.05);
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
    z-index: 10;
}

/* Color coding for metric cells - matching reference */
.metric-cell.green-dark { 
    background: #059669;
    color: white;
}
.metric-cell.green-med { 
    background: #10b981;
    color: white;
}
.metric-cell.green-light { 
    background: #34d399;
    color: white;
}
.metric-cell.light-green { 
    background: #6ee7b7;
    color: #1a1a1a;
}
.metric-cell.yellow { 
    background: #fbbf24;
    color: #1a1a1a;
}
.metric-cell.orange { 
    background: #f97316;
    color: white;
}
.metric-cell.red-light { 
    background: #fca5a5;
    color: white;
}
.metric-cell.red { 
    background: #ef4444;
    color: white;
}

/* Tooltip for cells */
.metric-cell::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.9);
    color: white;
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 11px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
    margin-bottom: 5px;
    z-index: 1000;
}

.metric-cell:hover::after {
    opacity: 1;
}

/* Scrollbar styling */
.data-table-container::-webkit-scrollbar {
    height: 10px;
}

.data-table-container::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

.data-table-container::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 10px;
}

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

/* Animation for loading */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.index-row {
    animation: fadeIn 0.3s ease-out;
}

@media (max-width: 768px) {
    .data-table-container {
        padding: 15px;
    }
    
    .category-name {
        font-size: 14px;
    }
    
    .metric-headers span {
        font-size: 10px;
    }
    
    .metric-cell {
        font-size: 11px;
        padding: 8px 4px;
    }
    
    .duration-selector {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .duration-selector .note {
        margin-left: 0;
    }
}
