/* Reset and base styles for consistent rendering */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #333;
    /* Responsive height based on iframe vs full window */
    height: 450px;
    overflow: hidden;
}

/* Check if running in full window mode */
@media (min-height: 500px) {
    body {
        height: 90vh;
    }
}

/* Main container with proper spacing and layout */
.container {
    display: flex;
    flex-direction: column;
    height: 100%;
    width: 100%;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 8px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    padding: 8px;
    gap: 8px;
}

/* Control panel styling with cognitive load considerations */
.control-panel {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    padding: 8px;
    background: rgba(255, 255, 255, 0.8);
    border-radius: 6px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    align-items: center;
    justify-content: space-between;
}

/* Control group styling for visual hierarchy */
.control-group {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    min-width: 80px;
}

.control-group label {
    font-size: 12px;
    font-weight: 600;
    color: #555;
    text-align: center;
    cursor: help;
}

/* Slider styling with visual feedback */
.slider {
    width: 80px;
    height: 20px;
    border-radius: 10px;
    background: #ddd;
    outline: none;
    transition: all 0.3s ease;
    cursor: pointer;
}

.slider:hover {
    background: #bbb;
    transform: scale(1.05);
}

.slider::-webkit-slider-thumb {
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #4CAF50;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    transition: all 0.3s ease;
}

.slider::-webkit-slider-thumb:hover {
    background: #45a049;
    transform: scale(1.1);
}

/* Button group with mobile-first design */
.button-group {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

/* Button styling optimized for touch and mouse interaction */
button {
    padding: 8px 12px;
    border: none;
    border-radius: 6px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    min-height: 36px;
    white-space: nowrap;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
    background: linear-gradient(135deg, #5a6fd8, #6a4190);
}

button:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

/* Visualization container with flexible layout */
.visualization-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: white;
    border-radius: 6px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    position: relative;
}

/* Canvas styling for visualization */
#visualization-canvas {
    flex: 1;
    width: 100%;
    cursor: crosshair;
    background: linear-gradient(45deg, #f0f8ff, #e6f3ff);
}

/* Test input panel for interactive classification */
.test-input-panel {
    display: flex;
    gap: 8px;
    padding: 8px;
    background: rgba(240, 248, 255, 0.8);
    border-top: 1px solid #ddd;
    align-items: center;
    flex-wrap: wrap;
    justify-content: center;
}

.input-group {
    display: flex;
    align-items: center;
    gap: 4px;
}

.input-group label {
    font-size: 12px;
    font-weight: 600;
    color: #555;
    min-width: 20px;
}

.input-group input[type="number"] {
    width: 60px;
    padding: 4px 6px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 12px;
    text-align: center;
}

.input-group input[type="number"]:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.2);
}

/* Results panel for classification feedback */
.results-panel {
    padding: 8px;
    background: rgba(255, 255, 255, 0.9);
    border-top: 1px solid #ddd;
    min-height: 40px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

#classification-result {
    font-weight: 600;
    font-size: 14px;
    color: #333;
    text-align: center;
}

#nearest-neighbors {
    font-size: 11px;
    color: #666;
    text-align: center;
}

/* 3D rotation controls (hidden by default) */
.rotation-controls {
    display: flex;
    gap: 12px;
    padding: 8px;
    background: rgba(255, 255, 255, 0.8);
    border-radius: 6px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
}

/* Responsive design for mobile devices */
@media (max-width: 768px) {
    .control-panel {
        flex-direction: column;
        gap: 8px;
    }
    
    .control-group {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
        width: 100%;
        max-width: 200px;
    }
    
    .slider {
        width: 100px;
    }
    
    .button-group {
        justify-content: center;
        width: 100%;
    }
    
    button {
        flex: 1;
        min-width: 80px;
    }
    
    .test-input-panel {
        flex-direction: column;
        gap: 6px;
    }
    
    .rotation-controls {
        flex-direction: column;
        gap: 8px;
    }
}

/* Visual feedback for interactive elements */
.control-group:hover label {
    color: #667eea;
}

/* Tooltip styling for enhanced UX */
[title] {
    cursor: help;
}

/* Animation for smooth transitions */
.visualization-container, .control-panel, .rotation-controls {
    transition: all 0.3s ease;
}

/* Color coding for different categories */
.category-0 { color: #ff6b6b; }
.category-1 { color: #4ecdc4; }
.category-2 { color: #45b7d1; }
.category-3 { color: #96ceb4; }
.category-4 { color: #feca57; }