/* css/eigen.css */

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: #f8f9fa;
    overflow-y: auto;
    overflow-x: hidden;
}

#app-container {
    display: flex;
    width: 100vw;
    min-height: 100vh;
}

#sidebar {
    width: 340px;
    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: 60px;
    padding: 10px;
    text-align: center;
    font-size: 1.1rem;
    font-weight: bold;
    border: 1px solid #ccc;
    border-radius: 4px;
}

.toggle-container {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #eee;
}

.toggle-label {
    font-weight: 600;
    color: #2c3e50;
    font-size: 0.95rem;
}

.switch {
    position: relative;
    display: inline-block;
    width: 46px;
    height: 24px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: .4s;
}

.slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .4s;
}

input:checked+.slider {
    background-color: #e74c3c;
}

input:focus+.slider {
    box-shadow: 0 0 1px #e74c3c;
}

input:checked+.slider:before {
    transform: translateX(22px);
}

.slider.round {
    border-radius: 24px;
}

.slider.round:before {
    border-radius: 50%;
}

.action-btn {
    padding: 12px;
    background: #3498db;
    color: white;
    border: none;
    border-radius: 6px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 1rem;
    margin-bottom: 10px;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
}

.action-btn:hover {
    background: #2980b9;
    transform: translateY(-1px);
}

.action-btn.secondary {
    background: #ecf0f1;
    color: #7f8c8d;
}

.action-btn.secondary:hover {
    background: #bdc3c7;
    color: #2c3e50;
}

#status-box {
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 15px;
    background: #e8f4fd;
    border-left: 5px solid #3498db;
    transition: all 0.3s;
}

#status-box.complex {
    background: #fdedec;
    border-left-color: #e74c3c;
}

#status-box.hidden {
    opacity: 0.4;
    filter: grayscale(1);
}

#status-box h4 {
    margin: 0 0 10px 0;
    color: #2c3e50;
}

.eigen-result {
    margin-bottom: 8px;
    font-family: monospace;
    font-size: 1.1rem;
    color: #333;
}

.eigen-error {
    color: #c0392b;
    font-weight: bold;
    font-size: 0.95rem;
    line-height: 1.4;
}

#explanation-box {
    background: white;
    padding: 15px;
    border-radius: 8px;
    border: 1px solid #eee;
    font-size: 0.9rem;
    color: #555;
    line-height: 1.5;
}

/* Visualization */
#viz-container {
    flex-grow: 1;
    background-color: #ffffff;
    cursor: grab;
    position: relative;
    /* REQUIRED FOR ABSOLUTE SVG */
    min-height: 500px;
}

/* THE FIX */
#viz-container svg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: block;
}

.axis {
    stroke: #bdc3c7;
    stroke-width: 2;
}

.grid-line {
    stroke: #e0e0e0;
    stroke-width: 1.5;
}

.unit-circle {
    fill: none;
    stroke: #95a5a6;
    stroke-width: 2;
    stroke-dasharray: 4, 4;
}

.transformed-circle {
    fill: rgba(52, 152, 219, 0.1);
    stroke: #3498db;
    stroke-width: 2;
}

.eigen-line {
    stroke: #e74c3c;
    stroke-width: 3;
    stroke-linecap: round;
}

.eigen-span {
    stroke: #f5b7b1;
    stroke-width: 2;
    stroke-dasharray: 5, 5;
}

.basis-e1 {
    stroke: #2980b9;
    stroke-width: 3.5;
    stroke-linecap: round;
}

.basis-e2 {
    stroke: #27ae60;
    stroke-width: 3.5;
    stroke-linecap: round;
}

.basis-label {
    font-family: sans-serif;
    font-weight: bold;
    font-size: 15px;
    pointer-events: none;
    text-shadow: 2px 2px 0 #fff, -1px -1px 0 #fff;
}

.transformed-axis {
    stroke: #7f8c8d;
    stroke-width: 2.5;
}

@media (max-width: 900px) {
    #app-container {
        flex-direction: column;
    }

    #sidebar {
        width: 100%;
        min-height: auto;
        box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
    }

    #viz-container {
        min-height: 60vh;
    }
}