/* --- Layout Overrides --- */
@media (min-width: 900px) {
    .module-layout {
        grid-template-columns: 260px 1fr !important; 
        gap: 2rem !important;
    }
}

/* --- Canvas Container --- */
.canvas-container {
    position: relative;
    width: 100%;
    /* Reduced height as requested */
    height: 500px; 
    background: #ffffff;
    border-radius: 16px;
    border: 1px solid var(--glass-border);
    box-shadow: inset 0 2px 10px rgba(0,0,0,0.02);
    overflow: hidden;
    cursor: default; 
}

canvas {
    display: block;
    width: 100%;
    height: 100%;
}

/* --- Sidebar Legend --- */
.legend-sidebar {
    height: 500px;
    display: flex;
    flex-direction: column;
    justify-content: flex-start; 
    padding-top: 2rem;
    
    background: transparent !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    box-shadow: none !important;
    border: none !important;
}

.legend-card {
    background: rgba(255,255,255,0.92); 
    padding: 1.5rem;
    border-radius: 16px;
    border: 1px solid rgba(255,255,255,0.9);
    box-shadow: 0 4px 20px rgba(0,0,0,0.05);
    backdrop-filter: blur(12px);
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.legend-card h3 {
    margin: 0;
    font-size: 1.1rem;
    color: var(--primary);
    border-bottom: 2px solid rgba(59, 89, 152, 0.1);
    padding-bottom: 0.5rem;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.line-icon {
    width: 40px;
    height: 4px;
    border-radius: 2px;
}

.line-sin { background: #ff4757; box-shadow: 0 2px 5px rgba(255, 71, 87, 0.3); }
.line-cos { background: #1e90ff; box-shadow: 0 2px 5px rgba(30, 144, 255, 0.3); }

.legend-text {
    display: flex;
    flex-direction: column;
}

.main-label {
    font-weight: 600;
    color: var(--text-main);
    font-size: 0.95rem;
}

.sub-label {
    font-family: 'Roboto Mono', monospace;
    font-size: 0.8rem;
    color: var(--text-light);
}

.angle-display {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px dashed rgba(0,0,0,0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 600;
    color: var(--text-main);
}

.mono-val {
    font-family: 'Roboto Mono', monospace;
    font-size: 1.1rem;
    color: var(--primary);
}

/* --- UI Controls --- */
.ui-layer {
    position: absolute;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    z-index: 10;
    pointer-events: none;
}

/* New Compact Bottom-Left Panel */
.panel-compact {
    pointer-events: auto;
    position: absolute;
    bottom: 12px;
    left: 12px;
    
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(8px);
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.08);
    border: 1px solid rgba(255,255,255,0.8);
    
    padding: 0.8rem 1.2rem;
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 1rem;
}

.control-btn {
    width: 60px;
    height: 60px;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    background: #f0f2f5;
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.control-btn:hover { 
    background: #e2e8f0; 
    transform: scale(1.05); 
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.panel-divider {
    width: 1px;
    height: 24px;
    background: rgba(0,0,0,0.1);
}

/* Toggle Switch */
.toggle-row {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-light);
    cursor: pointer;
}

.toggle-row input {
    width: 16px;
    height: 16px;
    cursor: pointer;
    accent-color: var(--primary);
}