* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', sans-serif;
    background-color: #f5f5f5;
    color: #333;
    line-height: 1.4;
}

.container {
    max-width: 1600px;
    margin: 0 auto;
    padding: 10px;
}

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding: 20px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

header h1 {
    color: #2c3e50;
    font-size: 2rem;
    font-weight: 600;
}

.health-status {
    padding: 8px 16px;
    border-radius: 4px;
    font-weight: 500;
    font-size: 0.9rem;
}

.health-status.healthy {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.health-status.error {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.version-info {
    text-align: right;
}

.app-version {
    font-weight: 600;
    font-size: 0.9rem;
    margin-bottom: 2px;
}

.lance-version {
    font-size: 0.8rem;
    opacity: 0.8;
    font-weight: 500;
}

.main-content {
    display: grid;
    grid-template-columns: 320px 1fr;
    gap: 15px;
    min-height: 600px;
}

.sidebar {
    background: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    max-height: 80vh;
    overflow-y: auto;
}

.sidebar-section {
    margin-bottom: 20px;
}

.sidebar-section h3 {
    margin-bottom: 16px;
    color: #2c3e50;
    border-bottom: 2px solid #3498db;
    padding-bottom: 8px;
    font-size: 1rem;
}

.dataset-list .dataset-item {
    padding: 12px 16px;
    margin: 4px 0;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 1px solid transparent;
}

.dataset-list .dataset-item:hover {
    background-color: #f8f9fa;
    border-color: #dee2e6;
}

.dataset-list .dataset-item.active {
    background-color: #3498db;
    color: white;
    border-color: #2980b9;
}

.content {
    background: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    overflow: hidden;
}

.dataset-header {
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid #dee2e6;
}

.header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
}

.dataset-header h2 {
    color: #2c3e50;
    margin: 0;
    flex: 1;
}

.controls {
    display: flex;
    gap: 20px;
    align-items: flex-start;
    flex-wrap: wrap;
}

.sidebar .column-selector {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.sidebar .column-selector select {
    width: 100%;
    padding: 4px 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 0.85rem;
    max-height: 120px;
}

.column-controls {
    display: flex;
    gap: 4px;
}

.column-controls button, .pagination-controls button, .pagination-controls select {
    padding: 6px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: white;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.2s ease;
}

.column-controls button:hover, .pagination-controls button:hover {
    background-color: #f8f9fa;
    border-color: #adb5bd;
}

.column-controls button:active, .pagination-controls button:active {
    background-color: #e9ecef;
}

.pagination-controls {
    display: flex;
    align-items: center;
    gap: 8px;
}

.pagination-controls button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}


.schema-display {
    font-family: 'SF Mono', 'Monaco', 'Consolas', monospace;
    font-size: 0.8rem;
    background: white;
    padding: 10px;
    border-radius: 4px;
    border: 1px solid #dee2e6;
    max-height: 150px;
    overflow-y: auto;
}

.schema-field {
    margin: 4px 0;
    padding: 4px 8px;
    border-radius: 3px;
}

.schema-field.vector {
    background-color: #e3f2fd;
    border-left: 3px solid #2196f3;
}

.table-container {
    overflow: auto;
    max-height: 70vh;
    border: 1px solid #dee2e6;
    border-radius: 6px;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

table th {
    background-color: #f8f9fa;
    padding: 12px 8px;
    text-align: left;
    border-bottom: 2px solid #dee2e6;
    font-weight: 600;
    color: #495057;
    position: sticky;
    top: 0;
    z-index: 10;
}

table td {
    padding: 10px 8px;
    border-bottom: 1px solid #f1f3f4;
    vertical-align: top;
}

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

.vector-cell {
    max-width: 200px;
    position: relative;
}

.vector-preview {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.vector-info {
    font-size: 0.8rem;
    color: #6c757d;
    font-family: 'SF Mono', 'Monaco', 'Consolas', monospace;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
}

.vector-model {
    background: #4caf50;
    color: white;
    padding: 2px 6px;
    border-radius: 3px;
    font-weight: 500;
    font-size: 0.7rem;
}

.vector-dim, .vector-norm {
    font-size: 0.75rem;
}

.vector-info.normalized .vector-norm {
    color: #4caf50;
    font-weight: 500;
}

.vector-cell.error {
    background-color: #fff3cd;
    border: 1px solid #ffeaa7;
    border-radius: 4px;
    padding: 8px;
    color: #856404;
    font-size: 0.8rem;
}

.vector-sparkline {
    height: 20px;
    width: 100%;
    border: 1px solid #dee2e6;
    border-radius: 2px;
    cursor: pointer;
    background: linear-gradient(90deg, #e3f2fd 0%, #1976d2 50%, #0d47a1 100%);
}

.loading {
    text-align: center;
    padding: 40px;
    color: #6c757d;
    font-style: italic;
}

.error {
    padding: 16px;
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
    border-radius: 4px;
    margin: 16px 0;
}

.tooltip {
    position: absolute;
    background: rgba(0, 0, 0, 0.9);
    color: white;
    padding: 8px 12px;
    border-radius: 4px;
    font-size: 0.8rem;
    font-family: 'SF Mono', 'Monaco', 'Consolas', monospace;
    z-index: 1000;
    pointer-events: none;
    max-width: 300px;
    word-wrap: break-word;
}

.tooltip-content {
    line-height: 1.3;
}

.model-badge {
    background: #2196f3;
    color: white;
    padding: 2px 6px;
    border-radius: 3px;
    font-weight: 500;
    font-size: 0.7rem;
    margin-right: 4px;
}

@media (max-width: 1024px) {
    .main-content {
        grid-template-columns: 1fr;
    }

    .controls {
        flex-direction: column;
        align-items: stretch;
    }

    .column-selector select {
        min-width: auto;
        width: 100%;
    }
}