/* Covariance Visualization Styles */

#covi-simulation {
    max-width: 800px;
    margin: 0 auto;
    font-family: 'Courier New', monospace;
    background: #000000;
    box-sizing: border-box;
}

/* Main Canvas Container */
#covi-canvas-container {
    position: relative;
    width: 100%;
    max-width: 760px;
    height: 500px;
    background: #000000;
    border: 2px solid #333;
    border-radius: 4px;
    margin: 0 auto 0 20px;
    overflow: hidden;
}

#covi-main-canvas {
    display: block;
    width: 100%;
    height: 100%;
    cursor: crosshair;
}

/* Control Panel */
.covi-control-panel {
    max-width: 800px;
    margin: 20px auto;
    padding: 15px;
    background: #000000;
    border: 1px solid #333;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    color: #00d4ff;
}

.covi-control-row {
    display: flex;
    align-items: center;
    margin: 8px 0;
    gap: 10px;
}

.covi-control-label {
    min-width: 120px;
    color: #00d4ff;
    font-size: 12px;
}

.covi-control-btn {
    padding: 8px 16px;
    background: #333;
    border: 1px solid #666;
    color: #00d4ff;
    cursor: pointer;
    border-radius: 3px;
    font-family: 'Courier New', monospace;
    font-size: 12px;
}

.covi-control-btn:hover {
    background: #444;
    border-color: #00d4ff;
}

.covi-control-btn:active {
    background: #555;
}

.covi-dropdown {
    padding: 6px 12px;
    background: #333;
    border: 1px solid #666;
    color: #00d4ff;
    border-radius: 3px;
    font-family: 'Courier New', monospace;
    font-size: 12px;
    cursor: pointer;
}

.covi-dropdown:hover {
    background: #444;
    border-color: #00d4ff;
}

.covi-dropdown:focus {
    outline: none;
    border-color: #00d4ff;
    background: #444;
}

.covi-control-btn.active {
    background: #0066cc;
    border-color: #00d4ff;
    color: #ffffff;
    font-weight: bold;
}

/* Toggle Switch */
.covi-toggle {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 24px;
}

.covi-toggle input {
    opacity: 0;
    width: 0;
    height: 0;
}

.covi-toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #333;
    transition: 0.3s;
    border-radius: 24px;
    border: 1px solid #666;
}

.covi-toggle-slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 2px;
    bottom: 2px;
    background-color: #666;
    transition: 0.3s;
    border-radius: 50%;
}

.covi-toggle input:checked + .covi-toggle-slider {
    background-color: #00d4ff;
}

.covi-toggle input:checked + .covi-toggle-slider:before {
    transform: translateX(26px);
    background-color: #fff;
}

/* Statistics Display */
.covi-stats-panel {
    margin-top: 15px;
    padding: 10px;
    background: #000000;
    border: 1px solid #333;
    border-radius: 3px;
}

.covi-stat-row {
    display: flex;
    justify-content: space-between;
    margin: 5px 0;
    font-size: 12px;
}

.covi-stat-label {
    color: #00d4ff;
}

.covi-stat-value {
    color: #00ff00;
    font-weight: bold;
    font-family: 'Courier New', monospace;
}

.covi-formula {
    font-family: 'Courier New', monospace;
    background: rgba(0, 212, 255, 0.1);
    padding: 8px;
    margin: 10px 0;
    border: 1px solid #333;
    border-radius: 3px;
    color: #00d4ff;
    font-size: 11px;
}

/* Matrix Grid Layout */
.covi-matrix-container {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    margin-top: 20px;
    align-items: flex-start;
}

.covi-left-column {
    flex-shrink: 0;
    margin-top: 460px;  /* Align matrix grid with editor canvas: 3D h3 (~24px) + 3D canvas (400px) + 3D padding (20px) + gap (20px) - left h3 (~34px) */
}

.covi-matrix-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: repeat(3, 1fr);
    gap: 4px;
    width: 240px;
    height: 240px;
    flex-shrink: 0;
}

.covi-grid-cell {
    border: 1px solid #666;
    position: relative;
    cursor: pointer;
    transition: transform 0.1s;
    background: #111;
}

.covi-grid-cell:hover {
    border-color: #00d4ff;
    z-index: 10;
    transform: scale(1.05);
}

.covi-grid-cell.active {
    border: 3px solid #00d4ff;
    z-index: 10;
}

.covi-grid-label {
    position: absolute;
    top: 2px;
    left: 2px;
    font-size: 9px;
    background: rgba(0, 0, 0, 0.8);
    padding: 2px 4px;
    color: #00d4ff;
    z-index: 5;
}

.covi-grid-cell canvas {
    display: block;
    width: 100%;
    height: 100%;
    image-rendering: pixelated;
}

/* 3D Scatter Plot Container */
#covi-3d-container {
    position: relative;
    background: #000000;
    border: none;
    border-radius: 4px;
    padding: 10px;
    box-sizing: border-box;
    margin-left: -260px;
    width: 520px;  /* 500px canvas + 20px padding (10px each side) */
    flex-shrink: 0;  /* Prevent flex from shrinking it */
}

.covi-camera-controls {
    position: absolute;
    top: 15px;
    left: 10px;
    z-index: 100;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.covi-camera-btn {
    width: 30px;
    height: 30px;
    background: rgba(0, 0, 0, 0.7);
    border: 1px solid #666;
    color: #00d4ff;
    cursor: pointer;
    font-size: 14px;
    font-family: 'Courier New', monospace;
    border-radius: 3px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.covi-camera-btn:hover {
    background: rgba(0, 212, 255, 0.2);
    border-color: #00d4ff;
}

#covi-3d-canvas-wrapper {
    width: 760px;
    height: 400px;
    position: relative;
    background: #000000;
}

#covi-3d-canvas-wrapper canvas {
    display: block;
    width: 100% !important;
    height: 100% !important;
}

/* Editor Canvas */
#covi-editor-container {
    position: relative;
    background: #000000;
    border: 1px solid #333;
    border-radius: 4px;
    padding: 10px;
    flex-grow: 1;
    min-width: 300px;
    max-width: 100%;
    box-sizing: border-box;
    margin-left: -20px;
}

#covi-editor-canvas {
    display: block;
    width: 100%;
    height: auto;
    aspect-ratio: 5/4;
    cursor: crosshair;
    background: #050505;
}

/* Matrix Values Display */
.covi-matrix-values {
    width: 240px;
    margin-top: 10px;
    padding: 8px;
    background: #111;
    border: 1px solid #333;
    border-radius: 3px;
    font-family: 'Courier New', monospace;
    font-size: 9px;
    line-height: 1.4;
    color: #0f0;
    white-space: pre;
    max-height: 200px;
    overflow-y: auto;
    box-sizing: border-box;
}

/* Instructions */
.covi-instructions {
    font-size: 10px;
    color: #aaa;
    margin-top: 10px;
    line-height: 1.4;
}
