/* Vector Visualization Page Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: linear-gradient(135deg, #4B9CD3 0%, #13294B 100%);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding: 90px 20px 20px;
}

.container {
    width: 100%;
    max-width: 1600px;
    background: white;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
    height: 90vh;
    max-height: 900px;
}

.header {
    padding: 20px 30px;
    border-bottom: 1px solid #e0e0e0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: white;
    border-radius: 16px 16px 0 0;
}

.header h1 {
    font-size: 24px;
    color: #333;
}

.header-actions {
    display: flex;
    gap: 10px;
}

.settings-btn, .clear-btn {
    background: #4B9CD3;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    transition: background 0.3s;
}

.settings-btn:hover, .clear-btn:hover {
    background: #3A7BB0;
}

.clear-btn {
    background: #dc3545;
}

.clear-btn:hover {
    background: #c82333;
}

/* Main Content Layout */
.main-content {
    display: flex;
    flex: 1;
    overflow: hidden;
    gap: 10px;
    padding: 10px;
}

.visualization-panel {
    flex: 2;
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-width: 0;
}

.visualization-container {
    flex: 1;
    background: #f8f9fa;
    border-radius: 12px;
    padding: 20px;
    position: relative;
    overflow: hidden;
    border: 2px solid #e0e0e0;
}

#visualizationCanvas {
    width: 100%;
    height: 100%;
    display: none;
}

.empty-state {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    color: #666;
}

.empty-state h3 {
    font-size: 24px;
    margin-bottom: 10px;
    color: #4B9CD3;
}

.empty-state p {
    font-size: 16px;
    margin-bottom: 5px;
}

.empty-state .help-text {
    font-size: 14px;
    color: #999;
}

.visualization-controls {
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 15px;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
}

.control-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.control-group label {
    font-size: 14px;
    font-weight: 500;
    color: #333;
}

.control-group select,
.control-group input[type="range"] {
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

.control-group input[type="checkbox"] {
    margin-right: 5px;
}

#thresholdValue {
    display: inline-block;
    min-width: 40px;
    text-align: center;
    font-weight: 600;
    color: #4B9CD3;
}

/* Info Panel */
.info-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-width: 300px;
    max-width: 400px;
}

.embeddings-list,
.similarity-matrix {
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 15px;
    overflow-y: auto;
}

.embeddings-list {
    flex: 1;
}

.similarity-matrix {
    flex: 1;
}

.embeddings-list h3,
.similarity-matrix h3 {
    font-size: 16px;
    margin-bottom: 10px;
    color: #333;
    border-bottom: 2px solid #4B9CD3;
    padding-bottom: 8px;
}

#embeddingsListContent {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.embedding-item {
    background: #f8f9fa;
    border-left: 4px solid #4B9CD3;
    padding: 10px;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
}

.embedding-item:hover {
    background: #e9ecef;
    transform: translateX(5px);
}

.embedding-item.selected {
    background: #d4e9f7;
    border-left-color: #13294B;
}

.embedding-item .text {
    font-size: 14px;
    color: #333;
    margin-bottom: 5px;
    word-wrap: break-word;
}

.embedding-item .meta {
    font-size: 12px;
    color: #666;
}

.similarity-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
}

.similarity-table th,
.similarity-table td {
    padding: 8px;
    text-align: center;
    border: 1px solid #e0e0e0;
}

.similarity-table th {
    background: #f8f9fa;
    font-weight: 600;
    color: #333;
}

.similarity-cell {
    cursor: pointer;
    transition: background 0.2s;
}

.similarity-cell:hover {
    background: #f8f9fa;
}

.similarity-high {
    background: #d4edda;
    color: #155724;
    font-weight: 600;
}

.similarity-medium {
    background: #fff3cd;
    color: #856404;
}

.similarity-low {
    background: #f8d7da;
    color: #721c24;
}

/* Input Container */
.input-container {
    padding: 20px 30px;
    border-top: 1px solid #e0e0e0;
    background: white;
    border-radius: 0 0 16px 16px;
}

.input-wrapper {
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
}

#textInput {
    flex: 1;
    padding: 15px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 16px;
    transition: border-color 0.3s;
}

#textInput:focus {
    outline: none;
    border-color: #4B9CD3;
}

#embedBtn {
    background: #4B9CD3;
    color: white;
    border: none;
    padding: 15px 30px;
    border-radius: 8px;
    font-size: 16px;
    cursor: pointer;
    transition: background 0.3s;
    white-space: nowrap;
}

#embedBtn:hover {
    background: #3A7BB0;
}

#embedBtn:disabled {
    background: #ccc;
    cursor: not-allowed;
}

.model-info {
    text-align: center;
    font-size: 14px;
    color: #666;
    padding-top: 10px;
}

.model-info span {
    font-weight: 600;
    color: #4B9CD3;
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
}

.modal.show {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background-color: white;
    padding: 30px;
    border-radius: 16px;
    max-width: 600px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.modal-header {
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid #4B9CD3;
}

.modal-header h2 {
    font-size: 24px;
    color: #333;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #333;
}

.form-control {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

.help-text {
    font-size: 13px;
    color: #666;
    margin-top: 5px;
}

.warning-text {
    color: #dc3545;
    font-weight: 600;
}

.config-display {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 4px;
    margin-top: 10px;
}

.config-display div {
    margin-bottom: 8px;
    font-size: 14px;
    color: #333;
}

.config-display div:last-child {
    margin-bottom: 0;
}

.form-actions {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-primary {
    background: #4B9CD3;
    color: white;
}

.btn-primary:hover {
    background: #3A7BB0;
}

.btn-secondary {
    background: #6c757d;
    color: white;
}

.btn-secondary:hover {
    background: #5a6268;
}

.status-message {
    margin-top: 15px;
    padding: 12px;
    border-radius: 4px;
    text-align: center;
    font-weight: 500;
}

.status-message.success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.status-message.error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* Loading Indicator */
.loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
}

.loading-spinner {
    border: 4px solid #f3f3f3;
    border-top: 4px solid #4B9CD3;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 0 auto 10px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Responsive Design */
@media (max-width: 1200px) {
    .main-content {
        flex-direction: column;
    }
    
    .info-panel {
        max-width: 100%;
        flex-direction: row;
    }
    
    .visualization-controls {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .header {
        flex-direction: column;
        gap: 15px;
    }
    
    .header-actions {
        width: 100%;
        justify-content: flex-end;
    }
    
    .info-panel {
        flex-direction: column;
    }
    
    .input-wrapper {
        flex-direction: column;
    }
}
