/* css/diag.css */

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: #f4f6f9;
    overflow-y: auto;
    overflow-x: hidden;
}

#app-container {
    display: flex;
    width: 100%;
    /* Prevents horizontal scrollbar overflow */
    min-height: 100vh;
}

#sidebar {
    width: 360px;
    flex-shrink: 0;
    background: white;
    padding: 25px;
    box-sizing: border-box;
    box-shadow: 2px 0 15px rgba(0, 0, 0, 0.08);
    display: flex;
    flex-direction: column;
    z-index: 20;
}

h2 {
    margin: 0 0 20px 0;
    color: #2c3e50;
    font-size: 1.2rem;
    border-bottom: 2px solid #eee;
    padding-bottom: 10px;
}

.matrix-input-grid {
    display: flex;
    justify-content: center;
    gap: 10px;
    background: #f9f9f9;
    padding: 20px;
    border-radius: 8px;
    border: 1px solid #eee;
    margin-bottom: 20px;
    position: relative;
}

.matrix-input-grid::before,
.matrix-input-grid::after {
    content: '';
    position: absolute;
    top: 10px;
    bottom: 10px;
    width: 10px;
    border: 2px solid #333;
}

.matrix-input-grid::before {
    left: 15px;
    border-right: none;
}

.matrix-input-grid::after {
    right: 15px;
    border-left: none;
}

.input-col {
    display: flex;
    flex-direction: column;
    gap: 10px;
    z-index: 1;
}

input[type="number"] {
    width: 65px;
    padding: 10px;
    text-align: center;
    font-size: 1.1rem;
    font-weight: bold;
    border: 1px solid #ccc;
    border-radius: 4px;
    transition: border-color 0.2s;
}

input[type="number"]:focus {
    border-color: #8e44ad;
    outline: none;
}

#eigen-box {
    background: #fdfefe;
    border: 1px solid #e5e8e8;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 20px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.02);
}

#eigen-box.error {
    background: #fdedec;
    border-left: 5px solid #e74c3c;
}

#eigen-box h4 {
    margin: 0 0 10px 0;
    color: #7f8c8d;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.eigen-result {
    font-family: monospace;
    font-size: 1.05rem;
    color: #333;
    margin-bottom: 5px;
}

/* Controls */
.controls {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
}

.controls button {
    flex: 1;
    padding: 10px 5px;
    border: none;
    border-radius: 6px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.95rem;
}

#btn-prev {
    background: #ecf0f1;
    color: #7f8c8d;
}

#btn-prev:hover:not(:disabled) {
    background: #bdc3c7;
    color: #2c3e50;
}

#btn-reset {
    background: #e0e4e8;
    color: #34495e;
}

#btn-reset:hover {
    background: #bdc3c7;
}

#btn-next {
    background: #8e44ad;
    color: white;
    box-shadow: 0 4px 6px rgba(142, 68, 173, 0.2);
}

#btn-next:hover:not(:disabled) {
    background: #732d91;
    transform: translateY(-1px);
}

.controls button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
}

#status-box {
    padding: 18px;
    border-radius: 8px;
    background: #fdfefe;
    border: 1px solid #e5e8e8;
    border-left: 5px solid #8e44ad;
    transition: all 0.3s;
}

#status-box h4 {
    margin: 0 0 10px 0;
    color: #2c3e50;
    font-size: 1.05rem;
}

.math-display {
    font-family: 'Courier New', monospace;
    font-size: 1rem;
    font-weight: bold;
    color: #333;
    background: #f4f6f7;
    padding: 10px;
    border-radius: 6px;
    text-align: center;
    border: 1px solid #ddd;
    margin-bottom: 12px;
}

#step-desc {
    margin: 0;
    font-size: 0.95rem;
    color: #555;
    line-height: 1.5;
}

/* Visualization Area */
#viz-wrapper {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    padding: 15px;
    gap: 15px;
    background: #e0e4e8;
    min-height: 100vh;
    box-sizing: border-box;
}

.viz-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: white;
    border-radius: 10px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    overflow: hidden;
}

.viz-panel h3 {
    margin: 0;
    padding: 8px 12px;
    text-align: center;
    background: #fafafa;
    border-bottom: 1px solid #eee;
    font-size: 1rem;
    color: #2c3e50;
}

.viz-canvas {
    flex-grow: 1;
    cursor: grab;
    position: relative;
    width: 100%;
    min-height: 350px;
    /* Forces height for calculations */
}

.viz-canvas:active {
    cursor: grabbing;
}

.viz-canvas svg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: block;
}

.axis {
    stroke: #bdc3c7;
    stroke-width: 2.5;
}

.grid-line {
    stroke: #ecf0f1;
    stroke-width: 1.5;
}

.unit-circle {
    fill: rgba(142, 68, 173, 0.05);
    stroke: #8e44ad;
    stroke-width: 2;
    stroke-dasharray: 4, 4;
}

.eigen-v1 {
    stroke: #e74c3c;
    stroke-width: 3.5;
    stroke-linecap: round;
}

.eigen-v2 {
    stroke: #3498db;
    stroke-width: 3.5;
    stroke-linecap: round;
}

.eigen-span-v1 {
    stroke: rgba(231, 76, 60, 0.3);
    stroke-width: 2;
    stroke-dasharray: 5, 5;
}

.eigen-span-v2 {
    stroke: rgba(52, 152, 219, 0.3);
    stroke-width: 2;
    stroke-dasharray: 5, 5;
}

.basis-e1 {
    stroke: #333;
    stroke-width: 2;
    stroke-linecap: round;
}

.basis-e2 {
    stroke: #333;
    stroke-width: 2;
    stroke-linecap: round;
}

@media (max-width: 900px) {
    #app-container {
        flex-direction: column;
    }

    #sidebar {
        width: 100%;
        min-height: auto;
    }
}